SPECS: builder - prior giving poldek packages to install check tha...

glen glen at pld-linux.org
Sun Jul 31 03:21:08 CEST 2005


Author: glen                         Date: Sun Jul 31 01:21:08 2005 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- prior giving poldek packages to install check that those are not needed (in cases you have installed stuff from elsewhere than current poldek auto sources allows)

---- Files affected:
SPECS:
   builder (1.321 -> 1.322) 

---- Diffs:

================================================================
Index: SPECS/builder
diff -u SPECS/builder:1.321 SPECS/builder:1.322
--- SPECS/builder:1.321	Sun Jul 31 02:47:03 2005
+++ SPECS/builder	Sun Jul 31 03:21:03 2005
@@ -1155,13 +1155,52 @@
 	fi
 }
 
+# checks a given list of packages/files/provides agains current rpmdb.
+# outputs all dependencies whcih current rpmdb doesn't satisfy.
+# input can be either STDIN or parameters
+_rpm_prov_check()
+{
+	 local DEPS
+
+	 if [ "$#" -gt 0 ]; then
+		  DEPS="$@"
+	 else
+		  DEPS=$(cat)
+	 fi
+
+	 DEPS=$(rpm -q --whatprovides $DEPS 2>&1 | awk '/^(error:|no package provides)/ { print }')
+
+	 # packages
+	 echo "$DEPS" | awk '/^no package provides/ { print "@" $NF }'
+
+	 # other deps (files)
+	 echo "$DEPS" | awk -F: '/^error:.*No such file/{o=$2; gsub("^ file ", "", o); print "@" o}'
+}
+
+# checks if given package/files/provides exists in rpmdb.
+# inout can be either stdin or parameters
+# returns packages wchi hare present in the rpmdb
+_rpm_cnfl_check()
+{
+	 local DEPS
+
+	 if [ "$#" -gt 0 ]; then
+		  DEPS="$@"
+	 else
+		  DEPS=$(cat)
+	 fi
+
+	 rpm -q --whatprovides $DEPS 2>/dev/null | awk '!/no package provides/ { print }'
+}
+
 fetch_build_requires()
 {
 	if [ "${FETCH_BUILD_REQUIRES}" = "yes" ]; then
 		if [ "$FETCH_BUILD_REQUIRES_RPMGETDEPS" = "yes" ]; then
-			CONF=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\-/ { print "@" $3 } ' | xargs)
-			DEPS=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\+/ { print "@" $3 } ' | xargs)
-			if [ -n "$CONF" -o -n "$DEPS" ]; then
+			CONF=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\-/ { print $3 } ' | _rpm_cnfl_check | xargs)
+			DEPS=$(rpm-getdeps $BCOND $SPECFILE 2> /dev/null | awk '/^\+/ { print $3 } ' | _rpm_prov_check | xargs)
+
+			if [ -n "$CONF" ] || [ -n "$DEPS" ]; then
 				$SU_SUDO /usr/bin/poldek --update || $SU_SUDO /usr/bin/poldek --upa
 			fi
 			if [ -n "$CONF" ]; then
================================================================

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




More information about the pld-cvs-commit mailing list