From bc2d929fe096699e3052edcdfce1bfb0507562fc Mon Sep 17 00:00:00 2001 From: Andy Neff Date: Fri, 29 May 2015 19:49:56 -0400 Subject: [PATCH] Added tests to building rpms --- rpm/INSTALL.md | 20 +++++++++++++++----- rpm/SPECS/git-lfs.spec | 5 ++++- rpm/build_rpms.bsh | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/rpm/INSTALL.md b/rpm/INSTALL.md index cc887503..66b34f64 100644 --- a/rpm/INSTALL.md +++ b/rpm/INSTALL.md @@ -14,9 +14,13 @@ and install a suitable golang/ruby so that git-lfs can be built. Simple run: ``` +./clean.bsh ./build_rpms.bsh ``` +The clean.bsh script removes previoeu rpms, etc... and removed the source tar.gz +file. Otherwise you might end up creating an rpm with pieces from different versions + Practice is to run rpmbuild as non-root user. This prevents inadvertently installing files in the operating system. The intent was to run build_rpms.bsh as a non-root user with sudo privileges. If you have a different command for sudo, or do not have sudo @@ -24,6 +28,7 @@ installed (which is possible, but unlikely), you can set the SUDO environment va to nothing or another command and you can run as root if that is your style. Example: ``` +./clean.bsh SUDO=echo ./build_rpms.bsh or (as root) SUDO= ./build_rpms.bsh @@ -46,17 +51,22 @@ rpmbuild --define "_topdir `pwd`" -bb SPECS/git-lfs.spec --nodeps rpmbuild --define "_topdir `pwd`" -bs SPECS/git-lfs.spec --nodeps ``` -### Releasing ### +### Releases ### The only thing that needs to be updated with a new version is the version number in git-lfs.spec needs to be updated. It will download: https://github.com/github/git-lfs/archive/v%{version}.tar.gz -This way when a new version is archived, it will always download get downloaded. Of -course this is a bit of a chicken/egg issue with the spec being stored in the repo... -detail details... If you always want the master branch, I guess you can change the -version to master, but I'm not not sure why you would bother making an rpm for that. +This way when a new version is archived, it will always download get downloaded. When +preparing for a release, it would be advantageous to use the currentlt checked out +version to test against. In order do that, after running ./clean.bsh to set the +environment variable BUILD_LOCAL to 1 + +``` +./clean.bsh +BUILD_LOCAL=1 ./build_rpms.bsh +``` ### Troubleshooting ### diff --git a/rpm/SPECS/git-lfs.spec b/rpm/SPECS/git-lfs.spec index 9e261e7b..0e283984 100644 --- a/rpm/SPECS/git-lfs.spec +++ b/rpm/SPECS/git-lfs.spec @@ -8,7 +8,7 @@ License: MIT URL: https://git-lfs.github.com/ Source0: https://github.com/github/git-lfs/archive/v%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: golang, tar, which, bison, rubygem-ronn +BuildRequires: golang, tar, which, bison, rubygem-ronn, git Requires: git %if 0%{?rhel} == 7 @@ -39,6 +39,9 @@ install -D bin/git-lfs ${RPM_BUILD_ROOT}/usr/bin/git-lfs mkdir -p -m 755 ${RPM_BUILD_ROOT}/usr/share/man/man1 install -D man/*.1 ${RPM_BUILD_ROOT}/usr/share/man/man1 +%check +GOPATH=`pwd` ./script/test + %clean rm -rf %{buildroot} diff --git a/rpm/build_rpms.bsh b/rpm/build_rpms.bsh index 8f2ddb2a..c109c700 100755 --- a/rpm/build_rpms.bsh +++ b/rpm/build_rpms.bsh @@ -19,7 +19,7 @@ exec 2>> $LOG set -vx echo "Downloading/checking for some essentials..." >&6 -$SUDO yum install -y make curl which rpm-build tar bison +$SUDO yum install -y make curl which rpm-build tar bison git REDHAT_VERSION=($(head -n 1 /etc/redhat-release | \grep -Eo '[0-9]+')) REDHAT_NAME=$(awk '{print $1}' /etc/redhat-release)