# runs rpm with minimal macroset
minirpm() {
- # we reset macros not to contain macros.build as all the %() macros are
- # executed here, while none of them are actually needed.
- # at the time of this writing macros.build + macros contained 70 "%(...)" macros.
- safe_macrofiles=$(rpm $TARGET_SWITCH --showrc | awk -F: '/^macrofiles/ { gsub(/^macrofiles[ \t]+:/, "", $0); gsub(/:.*macros.build:/, ":", $0); print $0 } ')
+ safe_macrofiles=$(rpm $TARGET_SWITCH --showrc | awk -F: '/^macrofiles/ { gsub(/^macrofiles[ \t]+:/, "", $0); print $0 } ')
# TODO: move these to /usr/lib/rpm/macros
cat > $BUILDER_MACROS <<'EOF'
PACKAGE_DIR=$REPO_DIR/$ASSUMED_NAME
fi
else
- REPO_DIR="."
- PACKAGE_DIR="."
+ TOP_DIR=$(pwd)
+ PACKAGE_DIR=$TOP_DIR
+ REPO_DIR=$PACKAGE_DIR
+ RPMBUILDOPTS="$RPMBUILDOPTS --define '_topdir $TOP_DIR' --define '_builddir %_topdir' --define '_rpmdir %_topdir' --define '_srcrpmdir %_topdir'"
fi
export GIT_WORK_TREE=$PACKAGE_DIR
export GIT_DIR=$PACKAGE_DIR/.git
local specdir=$(insert_gitlog $SPECFILE)
# FIXME: eval here is exactly why?
- PATH=$CLEAN_PATH eval teeboth "'$logfile'" ${NICE_COMMAND} $RPMBUILD $TARGET_SWITCH $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND --define \'_specdir $PACKAGE_DIR\' --define \'_sourcedir $PACKAGE_DIR\' $specdir/$SPECFILE
+ PATH=$CLEAN_PATH eval teeboth "'$logfile'" ${TIME_COMMAND} ${NICE_COMMAND} $RPMBUILD $TARGET_SWITCH $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND --define \'_specdir $PACKAGE_DIR\' --define \'_sourcedir $PACKAGE_DIR\' $specdir/$SPECFILE
retval=$?
rm -r $specdir
fi
}
+init_repository() {
+ local remoterepo=$1
+ local localrepo=$2
+
+ if [ ! -e $localrepo ]; then
+ git clone -o $REMOTE_PLD ${GIT_SERVER}/$remoterepo $localrepo
+ git --git-dir=$localrepo/.git remote set-url --push $REMOTE_PLD ssh://${GIT_PUSH}/$remoterepo
+ fi
+}
+
init_rpm_dir() {
local TOP_DIR=$(eval $RPM $RPMOPTS --eval '%{_topdir}')
local rpmdir=$(eval $RPM $RPMOPTS --eval '%{_rpmdir}')
local buildir=$(eval $RPM $RPMOPTS --eval '%{_builddir}')
local srpmdir=$(eval $RPM $RPMOPTS --eval '%{_srcrpmdir}')
+ local TEMPLATES=template-specs
local tmp
echo "Initializing rpm directories to $TOP_DIR from $GIT_SERVER"
mkdir -p $TOP_DIR $rpmdir $buildir $srpmdir
cd "$TOP_DIR"
- if [ ! -e ../rpm-build-tools ]; then
- git clone ${GIT_SERVER}/${PACKAGES_DIR}/rpm-build-tools.git ../rpm-build-tools
- fi
- for a in adapter builder fetchsrc_request; do
+ init_repository ${PACKAGES_DIR}/rpm-build-tools.git ../rpm-build-tools
+ init_repository projects/$TEMPLATES ../$TEMPLATES
+ for a in adapter builder fetchsrc_request compile repackage; do
ln -sf ../rpm-build-tools/${a}.sh $a
done
+ for a in md5; do
+ ln -sf ../rpm-build-tools/${a} $a
+ done
ln -sf ../rpm-build-tools/mirrors mirrors
init_builder
}
DONT_PRINT_REVISION="yes"
# remove spec and sources
- PATH=$CLEAN_PATH $RPMBUILD --clean --rmsource --rmspec --nodeps --define "_specdir $PACKAGE_DIR" --define "_sourcedir $PACKAGE_DIR" --define "_builddir $builddir" $PACKAGE_DIR/$SPECFILE
+ PATH=$CLEAN_PATH $RPMBUILD --clean --rmsource --rmspec --nodeps --define "__urlgetfile() %nil" --define "_specdir $PACKAGE_DIR" --define "_sourcedir $PACKAGE_DIR" --define "_builddir $builddir" $PACKAGE_DIR/$SPECFILE
rm -rf $PACKAGE_DIR/{.git,.gitignore}
rmdir --ignore-fail-on-non-empty $PACKAGE_DIR
}
NICE_COMMAND="nice -n ${DEF_NICE_LEVEL}"
fi
+# see time(1) for output format that could be used
+TIME_COMMAND="time -p"
+
update_shell_title "$COMMAND"
case "$COMMAND" in
"show_bconds")