Debian Codegraph @

rpm/INSTALL.md

raw symbols SCIP
1 # Building RPMs #
2
3 All of the code to build the RPM is stored in a SPECS/git-lfs.spec file. The
4 source code tarball needs to be put in a SOURCES directory. The BUILD and
5 BUILDROOT directories are used during the build process. The final RPM ends up
6 in the RPMS directory and a source-rpm in SRPMS.
7
8 In order to expedite installing all dependencies (mainly asciidoctor and golang)
9 and download any needed files a build_rpms.bsh script is included. This is the
10 **RECOMMENDED** way to build the rpms. It will install all yum packages in
11 order to build the rpm.
12
13 Simple run:
14
15 ```
16 ./clean.bsh
17 ./build_rpms.bsh
18 ```
19
20 The clean.bsh script removes previous rpms, etc... and removed the source
21 tar.gz file. Otherwise you might end up creating an rpm with pieces from
22 different versions.
23
24 Practice is to run rpmbuild as non-root user. This prevents inadvertently
25 installing files in the operating system. The intent is to run build_rpms.bsh
26 as a non-root user with sudo privileges. If you have a different command for
27 sudo, set the SUDO environment variable to the other command.
28
29 When all is down, install (or distribute) RPMS/git-lfs.rpm
30
31 ```
32 yum install RPMS/x86_64/git-lfs*.rpm
33 ```
34
35 ### Alternative build method ###
36
37 If you want to use your own ruby/golang without using the version from
38 build_rpms.bsh, you will have to disable dependencies on the rpms. It's pretty
39 easy, just make sure asciidoctor and go are in the path, and run
40
41 ```
42 NODEPS=1 ./build_rpms.bsh
43 ```
44
45 ### Manual build method ###
46
47 If you want to use your own ruby/golang without using build_rpms.bsh, it's a
48 little more complicated. You have to make sure asciidoctor and go are in the path,
49 and create the build structure, and download/create the tar.gz file used. This
50 is not recommended, but it is possible.
51
52 ```
53 mkdir -p {BUILD,BUILDROOT,SOURCES,RPMS,SRPMS}
54 #download file to SOURCES/v{version number}.tar.gz
55 rpmbuild --define "_topdir `pwd`" -bb SPECS/git-lfs.spec --nodeps
56
57 #(and optionally)
58 rpmbuild --define "_topdir `pwd`" -bs SPECS/git-lfs.spec --nodeps
59 ```
60
61 ### Releases ###
62
63 It is no longer necessary to update SPECS/git-lfs.spec every version. As long
64 as lfs/lfs.go is updated, build_rpms.bsh parses the version number using the
65 pattern ```s|const Version = "\([0-9.]*\)"|\1|``` and updates
66 SPECS/git-lfs.spec. The version number is then used to download:
67
68 https://github.com/git-lfs/git-lfs/archive/v%{version}.tar.gz
69
70 This way when a new version is archived, it will get downloaded and built
71 against. When developing, it is advantageous to use the currently checked out
72 version to test against. In order do that, after running ```./clean.bsh```,
73 set the environment variable BUILD_LOCAL to 1
74
75 ```
76 ./clean.bsh
77 BUILD_LOCAL=1 ./build_rpms.bsh
78 ```
79
80 ### Troubleshooting ###
81
82 **Q**) I ran build_rpms.bsh as root and now there are root owned files in the
83 rpm dir
84
85 **A**) That happens. Either run build_rpms.bsh as a user with sudo permissions
86 or ```chown -R username:groupname rpm``` as root after building.