SPECS: builder - shared minirpm() which is now used in cache_rpm_d...

glen glen at pld-linux.org
Mon Mar 5 17:40:08 CET 2007


Author: glen                         Date: Mon Mar  5 16:40:08 2007 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- shared minirpm() which is now used in cache_rpm_dump() and check_buildarch()

---- Files affected:
SPECS:
   builder (1.487 -> 1.488) 

---- Diffs:

================================================================
Index: SPECS/builder
diff -u SPECS/builder:1.487 SPECS/builder:1.488
--- SPECS/builder:1.487	Mon Mar  5 11:03:44 2007
+++ SPECS/builder	Mon Mar  5 17:40:03 2007
@@ -370,29 +370,20 @@
 	fi
 }
 
-cache_rpm_dump () {
-	if [ -n "$DEBUG" ]; then
-		set -x
-		set -v
-	fi
-
-	update_shell_title "cache_rpm_dump"
-	local rpm_dump
-	rpm_dump=`
-
+# 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.
-	# what we need from dump is NAME, VERSION, RELEASE and PATCHES/SOURCES.
 	# at the time of this writing macros.build + macros contained 70 "%(...)" macros.
 	macrofiles="/usr/lib/rpm/macros:$SPECS_DIR/.builder-rpmmacros:~/etc/.rpmmacros:~/.rpmmacros"
-	dump='%{echo:dummy: PACKAGE_NAME %{name} }%dump'
 	if [ -f /usr/lib/rpm/rpmrc ]; then
 		# FIXME: better ideas than .rpmrc?
 		printf 'include:/usr/lib/rpm/rpmrc\nmacrofiles:%s\n' $macrofiles > .builder-rpmrc
 	else
 		printf 'macrofiles:%s\n' $macrofiles > .builder-rpmrc
 	fi
-# TODO: move these to /usr/lib/rpm/macros
+
+	# TODO: move these to /usr/lib/rpm/macros
 	cat > .builder-rpmmacros <<'EOF'
 %alt_kernel %{nil}
 %_alt_kernel %{nil}
@@ -429,21 +420,36 @@
 ) \
 %{nil}
 EOF
-	case "$RPMBUILD" in
-	rpm)
-		ARGS='-bp'
-		;;
-	rpmbuild)
-		ARGS='--nodigest --nosignature --nobuild'
-		;;
-	esac
 	if [ "$NOINIT" = "yes" ] ; then
 		cat >> .builder-rpmmacros <<'EOF'
 %_specdir ./
 %_sourcedir ./
 EOF
 	fi
-	$RPMBUILD --rcfile .builder-rpmrc $ARGS $ARGDIRS --nodeps --define "prep $dump" $BCOND $TARGET_SWITCH $SPECFILE 2>&1
+#	set -x
+	eval $RPMBUILD --rcfile .builder-rpmrc $QUIET $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $* 2>&1
+}
+
+cache_rpm_dump() {
+	if [ -n "$DEBUG" ]; then
+		set -x
+		set -v
+	fi
+
+	update_shell_title "cache_rpm_dump"
+	local rpm_dump
+	rpm_dump=`
+		# what we need from dump is NAME, VERSION, RELEASE and PATCHES/SOURCES.
+		dump='%{echo:dummy: PACKAGE_NAME %{name} }%dump'
+		case "$RPMBUILD" in
+		rpm)
+			ARGS='-bp'
+			;;
+		rpmbuild)
+			ARGS='--nodigest --nosignature --nobuild'
+			;;
+		esac
+		minirpm $ARGS --define "'prep $dump'" --nodeps $SPECFILE
 	`
 	if [ $? -gt 0 ]; then
 		error=$(echo "$rpm_dump" | sed -ne '/^error:/,$p')
@@ -462,7 +468,7 @@
 	update_shell_title "cache_rpm_dump: OK!"
 }
 
-rpm_dump () {
+rpm_dump() {
 	if [ -z "$rpm_dump_cache" ] ; then
 		echo "internal error: cache_rpm_dump not called! (missing %prep?)" 1>&2
 	fi
@@ -1183,7 +1189,7 @@
 # this avoids unneccessary BR filling.
 check_buildarch() {
 	local out ret
-	out=$($RPMBUILD --short-circuit -bp --define 'prep exit 0' --nodeps $QUIET $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $SPECFILE 2>&1)
+	out=$(minirpm --short-circuit -bp --define "'prep exit 0'" --nodeps $SPECFILE 2>&1)
 	ret=$?
 	if [ $ret -ne 0 ]; then
 		echo >&2 "$out"
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/builder?r1=1.487&r2=1.488&f=u



More information about the pld-cvs-commit mailing list