Skip to content

Commit 56ffe42

Browse files
committed
Stuff
Normalized rpm names Upped build environment to 0.5.4 which included docker-scripts Fixes ownership problem Added unit tests to rpms now they are all passing
1 parent 43624a3 commit 56ffe42

File tree

10 files changed

+89
-38
lines changed

10 files changed

+89
-38
lines changed

docker/build_dockers.bsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ CUR_DIR=$(dirname "${BASH_SOURCE[0]}")
1313
#If you are not in docker group and you have sudo, default value is sudo
1414
: ${SUDO=`if ( [ ! -w /var/run/docker.sock ] && id -nG | grep -qwv docker && [ "${DOCKER_HOST:+dh}" != "dh" ] ) && which sudo > /dev/null 2>&1; then echo sudo; fi`}
1515

16-
export DOCKER_LFS_BUILD_VERSION=${DOCKER_LFS_BUILD_VERSION:-v0.5.3}
16+
export DOCKER_LFS_BUILD_VERSION=${DOCKER_LFS_BUILD_VERSION:-v0.5.4}
1717

1818
if [[ $# == 0 ]]; then
1919
IMAGE_NAMES=($(ls -d ${CUR_DIR}/git-lfs_*.dockerfile))

docker/centos_script.bsh

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,33 @@ REPO_DIR=${REPO_DIR:-/repo}
66
GIT_LFS_BUILD_DIR=${GIT_LFS_BUILD_DIR:-/tmp/docker_run/git-lfs}
77
SRC_DIR=${SRC_DIR:-/src}
88

9+
if [ -e /etc/os-release ]; then
10+
VERSION_ID=$(source /etc/os-release; echo ${VERSION_ID})
11+
OS_NAME=$(source /etc/os-release; echo ${NAME})
12+
OS_NAME=${OS_NAME,,}
13+
else #Basically Centos 5/6
14+
VERSION_ID=($(head -n 1 /etc/redhat-release | \grep -Eo '[0-9]+'))
15+
OS_NAME=$(awk '{print tolower($1)}' /etc/redhat-release)
16+
#Stupid ancient bash 3...
17+
fi
18+
19+
case "${OS_NAME}" in
20+
centos*|red*)
21+
RPM_DIST=".el${VERSION_ID}"
22+
;;
23+
fedora)
24+
RPM_DIST=".fc${VERSION_ID}"
25+
;;
26+
sles)
27+
RPM_DIST=".sles${VERSION_ID}"
28+
;;
29+
opensuse)
30+
RPM_DIST=".opensuse${VERSION_ID}"
31+
;;
32+
*)
33+
RPM_DIST="%{nil}"
34+
;;
35+
esac
936

1037
mkdir -p $(dirname "${GIT_LFS_BUILD_DIR}")
1138
cp -r -T "${SRC_DIR}" "${GIT_LFS_BUILD_DIR}"
@@ -16,12 +43,12 @@ touch "${GIT_LFS_BUILD_DIR}"/rpm/build.log
1643
tail -f "${GIT_LFS_BUILD_DIR}"/rpm/build.log &
1744
"${GIT_LFS_BUILD_DIR}"/rpm/build_rpms.bsh
1845
pkill -P $$ tail
19-
rpmbuild --define "_topdir ${GIT_LFS_BUILD_DIR}/rpm/" --target=i686 -bb "${GIT_LFS_BUILD_DIR}"/rpm/SPECS/git-lfs.spec
46+
rpmbuild --define "dist ${RPM_DIST}" --define "_topdir ${GIT_LFS_BUILD_DIR}/rpm/" --target=i686 -bb "${GIT_LFS_BUILD_DIR}"/rpm/SPECS/git-lfs.spec
2047
if [ "${REPO_HOSTNAME-}" != "" ]; then
2148
sed -r -i 's/(^baseurl=https?:\/\/)[^/]*/\1'"${REPO_HOSTNAME}"'/' ./rpm/SOURCES/git-lfs.repo
2249
fi
2350

24-
rpmbuild --define "_topdir ${GIT_LFS_BUILD_DIR}/rpm" -ba ${GIT_LFS_BUILD_DIR}/rpm/SPECS/git-lfs-repo-release.spec
51+
rpmbuild --define "dist ${RPM_DIST}" --define "_topdir ${GIT_LFS_BUILD_DIR}/rpm" -ba ${GIT_LFS_BUILD_DIR}/rpm/SPECS/git-lfs-repo-release.spec
2552

2653
rsync -ra ${GIT_LFS_BUILD_DIR}/rpm/{SRPMS,RPMS} ${REPO_DIR}
2754

@@ -33,4 +60,8 @@ fi
3360
createrepo ${REPO_DIR}/SRPMS
3461
createrepo ${REPO_DIR}/RPMS
3562

36-
gpg --export /repo/RPM-GPG-KEY-GITLFS
63+
gpg --export /repo/RPM-GPG-KEY-GITLFS
64+
65+
if [ "${FINAL_UID-}:${FINAL_GID-}" != ":" ]; then
66+
chown ${FINAL_UID-}:${FINAL_GID-} -R /repo
67+
fi

docker/common.bsh

Lines changed: 0 additions & 4 deletions
This file was deleted.

docker/debian_script.bsh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@ for DSC in $(ls /tmp/docker_run/*.changes); do
4747
done
4848

4949
gpg --export /repo/RPM-GPG-KEY-GITLFS
50+
51+
if [ "${FINAL_UID-}:${FINAL_GID-}" != ":" ]; then
52+
chown ${FINAL_UID-}:${FINAL_GID-} -R /repo
53+
fi

docker/gpg-agent_preload.bsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -eu
55
CUR_DIR=$(dirname ${BASH_SOURCE[0]})
66
IMAGE_NAME=gpg-agent_debian_8
77

8-
source ${CUR_DIR}/common.bsh
8+
: ${SUDO=`if ( [ ! -w /var/run/docker.sock ] && id -nG | grep -qwv docker && [ "${DOCKER_HOST:+dh}" != "dh" ] ) && which sudo > /dev/null 2>&1; then echo sudo; fi`}
99

1010
if [[ $# > 0 ]] && [ "$1" == "-r" ]; then
1111
${CUR_DIR}/gpg-agent_stop.bsh

docker/gpg-agent_start.bsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -eu
55
CUR_DIR=$(dirname ${BASH_SOURCE[0]})
66
IMAGE_NAME=gpg-agent_debian_8
77

8-
source ${CUR_DIR}/common.bsh
8+
: ${SUDO=`if ( [ ! -w /var/run/docker.sock ] && id -nG | grep -qwv docker && [ "${DOCKER_HOST:+dh}" != "dh" ] ) && which sudo > /dev/null 2>&1; then echo sudo; fi`}
99

1010
if [ "$(docker inspect -f {{.State.Running}} git-lfs-gpg)" != "true" ]; then
1111
#Don't rebuild WHILE RUNNING

docker/gpg-agent_stop.bsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eu
44

55
CUR_DIR=$(dirname ${BASH_SOURCE[0]})
66

7-
source ${CUR_DIR}/common.bsh
7+
: ${SUDO=`if ( [ ! -w /var/run/docker.sock ] && id -nG | grep -qwv docker && [ "${DOCKER_HOST:+dh}" != "dh" ] ) && which sudo > /dev/null 2>&1; then echo sudo; fi`}
88

99
function docker_wait(){
1010
# Image seconds

docker/run_dockers.bsh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ set -eu
1919
CUR_DIR=$(cd $(dirname "${BASH_SOURCE[0]}"); pwd)
2020
REPO_DIR=$(cd ${CUR_DIR}/..; pwd)
2121
PACKAGE_DIR=${REPO_DIR}/repos
22+
mkdir -p ${PACKAGE_DIR}/centos || :
23+
mkdir -p ${PACKAGE_DIR}/debian || :
2224

2325
#If you are not in docker group and you have sudo, default value is sudo
2426
: ${SUDO=`if ( [ ! -w /var/run/docker.sock ] && id -nG | grep -qwv docker && [ "${DOCKER_HOST:+dh}" != "dh" ] ) && which sudo > /dev/null 2>&1; then echo sudo; fi`}
@@ -88,8 +90,12 @@ for DOCKER_FILE in "${IMAGES[@]}"; do
8890
IMAGE_REPO_DIR="${PACKAGE_DIR}"/"${IMAGE_INFO[1]}"/"${IMAGE_INFO[2]}"
8991
$SUDO docker run "${OTHER_OPTIONS[@]}" \
9092
-e REPO_HOSTNAME=${REPO_HOSTNAME:-git-lfs.github.com} \
93+
-e FINAL_UID=$(id -u) \
94+
-e FINAL_GID=$(id -g) \
9195
-v ${REPO_DIR}:/src \
9296
-v ${IMAGE_REPO_DIR}:/repo \
9397
git-lfs/${IMAGE_NAME} ${DOCKER_CMD-}
9498

9599
done
100+
101+
echo "Docker run completed successfully!"

rpm/SPECS/git-lfs.spec

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,8 @@ mkdir -p -m 755 ${RPM_BUILD_ROOT}/usr/share/man/man1
4545
install -D man/*.1 ${RPM_BUILD_ROOT}/usr/share/man/man1
4646

4747
%check
48-
if ! git config --global user.name; then
49-
RPM_GIT_USER_NAME=1
50-
git config --global user.name "User Name"
51-
fi
52-
if ! git config --global user.email; then
53-
RPM_GIT_USER_EMAIL=1
54-
git config --global user.email "[email protected]"
55-
fi
56-
#GOPATH=`pwd` ./script/test
57-
#GOPATH=`pwd` ./script/integration
58-
if [ "${RPM_GIT_USER_NAME}" == "1" ]; then
59-
git config --global --unset user.name
60-
fi
61-
if [ "${RPM_GIT_USER_EMAIL}" == "1" ]; then
62-
git config --global --unset user.email
63-
fi
48+
GOPATH=`pwd` ./script/test
49+
GOPATH=`pwd` ./script/integration
6450

6551
%clean
6652
rm -rf %{buildroot}
@@ -72,6 +58,9 @@ rm -rf %{buildroot}
7258
/usr/share/man/man1/*.1.gz
7359

7460
%changelog
61+
* Sun Aug 2 2015 Andrew Neff <[email protected]> - 0.5.4-1
62+
- Added tests back in
63+
7564
* Sat Jul 18 2015 Andrew Neff <[email protected]> - 0.5.2-1
7665
- Changed Source0 filename
7766

rpm/build_rpms.bsh

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,37 @@
33
set -eu
44

55
CURDIR=$(cd $(dirname ${BASH_SOURCE[0]}); pwd)
6-
SPEC=${CURDIR}/SPECS/git-lfs.spec
7-
if [[ ${NODEPS:-0} == 0 ]]; then
8-
RPMBUILD=(rpmbuild --define "_topdir ${CURDIR}")
9-
else
10-
RPMBUILD=(rpmbuild --define "_topdir ${CURDIR}" --nodeps)
6+
if [ -e /etc/os-release ]; then
7+
VERSION_ID=$(source /etc/os-release; echo ${VERSION_ID})
8+
OS_NAME=$(source /etc/os-release; echo ${NAME})
9+
OS_NAME=${OS_NAME,,}
10+
else #Basically Centos 5/6
11+
VERSION_ID=($(head -n 1 /etc/redhat-release | \grep -Eo '[0-9]+'))
12+
OS_NAME=$(awk '{print tolower($1)}' /etc/redhat-release)
13+
#Stupid ancient bash 3...
14+
fi
15+
16+
case "${OS_NAME}" in
17+
centos*|red*)
18+
RPM_DIST=".el${VERSION_ID}"
19+
;;
20+
fedora)
21+
RPM_DIST=".fc${VERSION_ID}"
22+
;;
23+
sles)
24+
RPM_DIST=".sles${VERSION_ID}"
25+
;;
26+
opensuse)
27+
RPM_DIST=".opensuse${VERSION_ID}"
28+
;;
29+
*)
30+
RPM_DIST="%{nil}"
31+
;;
32+
esac
33+
34+
RPMBUILD=(rpmbuild --define "_topdir ${CURDIR}" --define "dist ${RPM_DIST}")
35+
if [[ ${NODEPS:-0} != 0 ]]; then
36+
RPMBUILD=("${RPMBUILD[@]}" --nodeps)
1137
fi
1238
LOG=${CURDIR}/build.log
1339
SUDO=${SUDO=`if which sudo > /dev/null 2>&1; then echo sudo; fi`}
@@ -32,10 +58,9 @@ else
3258
GIT_VERSION=(0 0 0)
3359
fi
3460

35-
REDHAT_VERSION=($(head -n 1 /etc/redhat-release | \grep -Eo '[0-9]+'))
36-
REDHAT_NAME=$(awk '{print $1}' /etc/redhat-release)
61+
SPEC=${CURDIR}/SPECS/git-lfs.spec
3762

38-
if [[ ${REDHAT_VERSION[0]} == 5 ]]; then
63+
if [[ ${VERSION_ID[0]} == 5 ]]; then
3964
if ! rpm -q epel-release > /dev/null 2>&1; then
4065
$SUDO yum install -y epel-release
4166
fi
@@ -45,7 +70,7 @@ $SUDO yum install -y make curl which rpm-build tar bison perl-Digest-SHA
4570
mkdir -p ${CURDIR}/{BUILD,BUILDROOT,SOURCES,RPMS,SRPMS}
4671

4772
if ( [[ ${GIT_VERSION[0]} == 1 ]] && [[ ${GIT_VERSION[1]} < 8 ]] ) || [[ ${GIT_VERSION[0]} < 1 ]]; then
48-
if [[ ${REDHAT_VERSION[0]} != 6 ]]; then
73+
if [[ ${VERSION_ID[0]} != 6 ]]; then
4974
$SUDO yum install -y git
5075
else
5176
$SUDO yum install -y curl-devel expat-devel gettext openssl-devel zlib-devel perl-Error perl-ExtUtils-MakeMaker emacs asciidoc xmlto gcc
@@ -63,7 +88,7 @@ fi
6388

6489
if ! which go; then
6590
echo "Installing go... one way or another" >&6
66-
if [[ ${REDHAT_VERSION[0]} == 5 ]]; then
91+
if [[ ${VERSION_ID[0]} == 5 ]]; then
6792
$SUDO yum install -y curl.x86_64 glibc gcc
6893
${CURDIR}/golang_patch.bsh
6994
"${RPMBUILD[@]}" -ba ${CURDIR}/SPECS/golang.spec
@@ -88,7 +113,7 @@ else
88113
fi
89114

90115
if [[ ${RUBY_VERSION[0]} < 2 ]]; then
91-
if [[ ${REDHAT_VERSION[0]} < 7 ]]; then
116+
if [[ ${VERSION_ID[0]} < 7 ]]; then
92117
echo "Downloading ruby..." >&6
93118

94119
if ! rpm -q epel-release; then

0 commit comments

Comments
 (0)