git-lfs/rpm/INSTALL.md

88 lines
3.0 KiB
Markdown
Raw Normal View History

2015-05-27 02:47:34 +00:00
# Building RPMs #
2015-06-24 18:56:19 +00:00
All of the code to build the RPM is stored in a SPECS/git-lfs.spec file. The
source code tarball needs to be put in a SOURCES directory. The BUILD and
BUILDROOT directories are used during the build process. The final RPM ends up
2015-06-20 16:14:54 +00:00
in the RPMS directory and a source-rpm in SRPMS.
2015-06-24 18:56:19 +00:00
In order to expedite installing all dependencies (mainly ruby-ronn and golang)
and download any needed files a build_rpms.bsh script is included. This is the
**RECOMMENDED** way to build the rpms. It will install all yum packages in
order to build the rpm. This can be especially difficult in CentOS 5 and 6,
but it will build and install a suitable golang/ruby so that git-lfs can be
2015-06-20 16:14:54 +00:00
built.
2015-05-27 02:47:34 +00:00
Simple run:
```
2015-05-29 23:49:56 +00:00
./clean.bsh
2015-05-27 02:47:34 +00:00
./build_rpms.bsh
```
2015-06-24 18:56:19 +00:00
The clean.bsh script removes previous rpms, etc... and removed the source
tar.gz file. Otherwise you might end up creating an rpm with pieces from
2015-06-20 16:14:54 +00:00
different versions.
2015-05-29 23:49:56 +00:00
2015-06-24 18:56:19 +00:00
Practice is to run rpmbuild as non-root user. This prevents inadvertently
installing files in the operating system. The intent is to run build_rpms.bsh
as a non-root user with sudo privileges. If you have a different command for
sudo, set the SUDO environment variable to the other command.
2015-05-27 02:47:34 +00:00
2015-06-20 16:14:54 +00:00
When all is down, install (or distribute) RPMS/git-lfs.rpm
2015-05-27 02:47:34 +00:00
2015-06-20 16:14:54 +00:00
```
yum install RPMS/x86_64/git-lfs*.rpm
```
2015-05-27 02:47:34 +00:00
2015-06-20 16:14:54 +00:00
### Alternative build method ###
2015-06-24 18:56:19 +00:00
If you want to use your own ruby/golang without using the version from
build_rpms.bsh, you will have to disable dependencies on the rpms. It's pretty
2015-06-20 16:14:54 +00:00
easy, just make sure ronn and go are in the path, and run
2015-05-27 02:47:34 +00:00
```
NODEPS=1 ./build_rpms.bsh
```
2015-06-20 16:14:54 +00:00
### Manual build method ###
2015-06-24 18:56:19 +00:00
If you want to use your own ruby/golang without using build_rpms.bsh, it's a
little more complicated. You have to make sure ronn and go are in the path,
and create the build structure, and download/create the tar.gz file used. This
2015-06-20 16:14:54 +00:00
is not recommended, but it is possible.
```
mkdir -p {BUILD,BUILDROOT,SOURCES,RPMS,SRPMS}
#download file to SOURCES/v{version number}.tar.gz
2015-05-27 02:47:34 +00:00
rpmbuild --define "_topdir `pwd`" -bb SPECS/git-lfs.spec --nodeps
#(and optionally)
rpmbuild --define "_topdir `pwd`" -bs SPECS/git-lfs.spec --nodeps
```
2015-05-29 23:49:56 +00:00
### Releases ###
2015-05-27 02:47:34 +00:00
2015-06-24 18:56:19 +00:00
It is no longer necessary to update SPECS/git-lfs.spec every version. As long
as lfs/lfs.go is updated, build_rpms.bsh parses the version number using the
pattern ```s|const Version = "\([0-9.]*\)"|\1|``` and updates
2015-06-20 16:14:54 +00:00
SPECS/git-lfs.spec. The version number is then used to download:
2015-05-27 02:47:34 +00:00
2016-11-15 17:07:11 +00:00
https://github.com/git-lfs/git-lfs/archive/v%{version}.tar.gz
2015-05-27 02:47:34 +00:00
2015-06-24 18:56:19 +00:00
This way when a new version is archived, it will get downloaded and built
against. When developing, it is advantageous to use the currently checked out
version to test against. In order do that, after running ```./clean.bsh```,
2015-06-20 16:14:54 +00:00
set the environment variable BUILD_LOCAL to 1
2015-05-29 23:49:56 +00:00
```
./clean.bsh
BUILD_LOCAL=1 ./build_rpms.bsh
```
2015-05-27 02:47:34 +00:00
### Troubleshooting ###
**Q**) I ran build_rpms.bsh as root and now there are root owned files in the
rpm dir
2015-05-27 02:47:34 +00:00
**A**) That happens. Either run build_rpms.bsh as a user with sudo permissions
or ```chown -R username:groupname rpm``` as root after building.