[Debtags-commits] [svn] r1542 - tagdb

Enrico Zini enrico at costa.debian.org
Tue Feb 7 00:27:02 UTC 2006


Author: enrico
Date: Tue Feb  7 00:27:01 2006
New Revision: 1542

Added:
   tagdb/filterpkgs   (contents, props changed)
Modified:
   tagdb/process
Log:
Exclude non existing packages and not-yet-tagged tags as well when generating the main patch

Modified: tagdb/process
==============================================================================
--- tagdb/process	(original)
+++ tagdb/process	Tue Feb  7 00:27:01 2006
@@ -25,12 +25,29 @@
 
 PATCHDIR=corrections
 
+CACHEDIR=cache
+
 # Rebuild the main patch
 make_mainpatch() {
+	echo "Generating the list of valid packages..."
+	mkdir -p $CACHEDIR
+	if [ -e $CACHEDIR/AllPackages.gz ] && [ $((`date +%s` - `date +%s -r $CACHEDIR/AllPackages.gz`)) -le 86400 ]
+	then
+		# Reuse the existing file if it was downloaded less than one day ago
+		true
+	else
+		wget -O- http://people.debian.org/~enrico/AllPackages.gz > $CACHEDIR/AllPackages.gz
+	fi
+	PKGS=`mktemp`
+	cat $CACHEDIR/AllPackages.gz | gunzip | grep-dctrl -sPackage -n . > $PKGS
+
 	CLEANOLD=`mktemp`
 	CLEANNEW=`mktemp`
-	tagcoll --remove-unfaceted copy $CHECKED > $CLEANOLD
-	tagcoll --remove-unfaceted copy $TOCHECK > $CLEANNEW
+
+	# Remove from CHECKED the data about packages that are not present in the
+	# archive anymore, tags without facets and special::not-yet-tagged*
+	./filterpkgs $PKGS < $CHECKED | tagcoll --remove-unfaceted --remove-tags="special::not-yet-tagged*" copy > $CLEANOLD
+	./filterpkgs $PKGS < $TOCHECK | tagcoll --remove-unfaceted --remove-tags="special::not-yet-tagged*" copy > $CLEANNEW
 	tagcoll diff $CLEANOLD $CLEANNEW > $MAINPATCH
 	rm $CLEANOLD $CLEANNEW
 }
@@ -47,7 +64,7 @@
 		for patch in `find $PATCHDIR`
 		do
 			TMPCOLL=`mktemp`
-			tagcoll --patch-with=$CHANGES copy $TOCHECK > $TMPCOLL
+			tagcoll --patch-with=$patch copy $TOCHECK > $TMPCOLL
 			mv $TMPCOLL $TOCHECK
 		done
 	fi
@@ -178,35 +195,47 @@
 
 	if [ $APPLY = yes ]
 	then
-		echo "Applying changes..."
-		PATCHNAME=""
-		while [ "$PATCHNAME" = "" ]
-		do
-			echo -n "Please enter a file name for your manual changes: "
-			read PATCHNAME
-		done
-		if [ $PATCHNAME != q ]
+		if [ -z "$CHANGES" ]
 		then
 			NEWCHECKED=`mktemp`
 			tagcoll --patch-with=$FILE copy $CHECKED > $NEWCHECKED
 			if [ -s $NEWCHECKED ]
 			then
 				mv $NEWCHECKED $CHECKED
-
-				# Archive the patch
-				mkdir -p $PATCHDIR
-				cp $CHANGES $PATCHDIR/$PATCHNAME
-
-				# Apply the corrections to $TOCHECK
-				TMPCOLL=`mktemp`
-				tagcoll --patch-with=$CHANGES copy $TOCHECK > $TMPCOLL
-				mv $TMPCOLL $TOCHECK
-
-				# Rebuild the main patch
-				make_mainpatch
 			else
 				rm $NEWCHECKED
 			fi
+		else
+			echo "Applying changes..."
+			PATCHNAME=""
+			while [ "$PATCHNAME" = "" ]
+			do
+				echo -n "Please enter a file name for your manual changes: "
+				read PATCHNAME
+			done
+			if [ $PATCHNAME != q ]
+			then
+				NEWCHECKED=`mktemp`
+				tagcoll --patch-with=$FILE copy $CHECKED > $NEWCHECKED
+				if [ -s $NEWCHECKED ]
+				then
+					mv $NEWCHECKED $CHECKED
+
+					# Archive the patch
+					mkdir -p $PATCHDIR
+					cp $CHANGES $PATCHDIR/$PATCHNAME
+
+					# Apply the corrections to $TOCHECK
+					TMPCOLL=`mktemp`
+					tagcoll --patch-with=$CHANGES copy $TOCHECK > $TMPCOLL
+					mv $TMPCOLL $TOCHECK
+
+					# Rebuild the main patch
+					make_mainpatch
+				else
+					rm $NEWCHECKED
+				fi
+			fi
 		fi
 	fi
 
@@ -250,6 +279,7 @@
 	done
 }
 
+# Show some statistics about the work to do
 do_stats() {
 	echo ""
 	echo "Statistics"



More information about the Debtags-commits mailing list