@@ -69,10 +69,12 @@ ulimit -s 16384
6969# get the package arch used in the container (eg. "x86_64_v2")
7070RPMARCH=$( rpm -q glibc --qf " %{arch}" )
7171
72- if [ -n " $BUILD_LOCAL " ]; then
72+ if [ -n " $BUILD_LOCAL$BUILD_DEPS " ]; then
7373 time (
7474 cd ~ /rpmbuild
75- rm BUILD BUILDROOT RPMS SRPMS -rf
75+ if [ -n " $BUILD_LOCAL " ]; then
76+ rm BUILD BUILDROOT RPMS SRPMS -rf
77+ fi
7678
7779 if specs=$( ls * .spec 2> /dev/null) ; then
7880 SPECFLAGS=(
@@ -88,28 +90,40 @@ if [ -n "$BUILD_LOCAL" ]; then
8890
8991 case " $OS_RELEASE " in
9092 8.2.* |8.3.* ) ;; # sources always available via git-lfs
91- 8.99.* |9.* ) if [ -r sources ]; then alma_get_sources -i sources; fi ;;
93+ 8.99.* |9.* )
94+ if [ -r sources ]; then alma_get_sources -i sources; fi
95+ # FIXME: if [ -n "$BUILD_DEPS" ]; then exfiltrate alma_get_sources
96+ ;;
9297 * ) echo >&2 " ERROR: unknown release, cannot know package manager" ; exit 1 ;;
9398 esac
9499
95- sudo $BDEP " ${SPECFLAGS[@]} " -y $specs
96-
97- : ${RPMBUILD_STAGE:= a} # default if not specified: -ba
98- RPMBUILDFLAGS=(
99- -b${RPMBUILD_STAGE} $specs
100- --target " $RPMARCH "
101- $RPMBUILD_OPTS
102- " ${SPECFLAGS[@]} "
103- )
104- # in case the build deps contain xs-opam-repo, source the added profile.d file
105- [ ! -f /etc/profile.d/opam.sh ] || source /etc/profile.d/opam.sh
106- if [ $? == 0 ]; then
107- if [ -n " $RPMBUILD_DEFINE " ]; then
108- RPMBUILDFLAGS+=(--define " $RPMBUILD_DEFINE " )
100+ if [ -n " $BUILD_DEPS " ]; then
101+ BDEPFLAGS=()
102+ if [ -d ~ /builddep/ ]; then
103+ BDEPFLAGS+=(--downloaddir ~ /builddep/)
109104 fi
110- rpmbuild " ${RPMBUILDFLAGS[@]} "
111- if [ $? == 0 -a -d ~ /output/ ]; then
112- cp -rf RPMS SRPMS ~ /output/
105+ sudo $BDEP " ${SPECFLAGS[@]} " --downloadonly " ${BDEPFLAGS[@]} " -y $specs
106+ fi
107+
108+ if [ -n " $BUILD_LOCAL " ]; then
109+ sudo $BDEP " ${SPECFLAGS[@]} " -y $specs
110+ : ${RPMBUILD_STAGE:= a} # default if not specified: -ba
111+ RPMBUILDFLAGS=(
112+ -b${RPMBUILD_STAGE} $specs
113+ --target " $RPMARCH "
114+ $RPMBUILD_OPTS
115+ " ${SPECFLAGS[@]} "
116+ )
117+ # in case the build deps contain xs-opam-repo, source the added profile.d file
118+ [ ! -f /etc/profile.d/opam.sh ] || source /etc/profile.d/opam.sh
119+ if [ $? == 0 ]; then
120+ if [ -n " $RPMBUILD_DEFINE " ]; then
121+ RPMBUILDFLAGS+=(--define " $RPMBUILD_DEFINE " )
122+ fi
123+ rpmbuild " ${RPMBUILDFLAGS[@]} "
124+ if [ $? == 0 -a -d ~ /output/ ]; then
125+ cp -rf RPMS SRPMS ~ /output/
126+ fi
113127 fi
114128 fi
115129 )
0 commit comments