[Pkg-multidistrotools-commits] r9 - multidistrotools/trunk/scripts

raphink-guest at alioth.debian.org raphink-guest at alioth.debian.org
Sun Dec 16 16:01:30 UTC 2007


Author: raphink-guest
Date: 2007-12-16 16:01:30 +0000 (Sun, 16 Dec 2007)
New Revision: 9

Added:
   multidistrotools/trunk/scripts/compare-src-bin.bash
Log:
Add compare-src-bin.bash script


Added: multidistrotools/trunk/scripts/compare-src-bin.bash
===================================================================
--- multidistrotools/trunk/scripts/compare-src-bin.bash	                        (rev 0)
+++ multidistrotools/trunk/scripts/compare-src-bin.bash	2007-12-16 16:01:30 UTC (rev 9)
@@ -0,0 +1,67 @@
+#!/bin/bash
+#
+# compare-src-bin.bash - Raphael Pinson <raphink at gmail.com>
+# 
+# Given a distribution in mdt, this script compares the binaries that should be
+# produced by the sources with the ones really present in the repository
+#
+# The result can be useful to detect binary only uploads or FTBFS packages
+
+usage() {
+	echo "mdt compare-src-bin etch"
+}
+	
+set -e
+
+if [ $# -ne 1 ]; then
+	usage
+	exit 1
+elif [ "$1" == '--help' ]; then
+	usage
+	exit 1
+fi
+if [ ! -d $HOME/.multidistrotools/$1 ]; then
+	echo "APT tree named $1 doesn't exist in $HOME/.multidistrotools."
+	exit 1
+fi
+DIST=$1
+
+MCVDIR=$(mktemp -d /tmp/MCV.XXXXXX)
+
+
+# Print src name for the src_packages column
+#awk '/^Package:/ { p = $2} /^Binary:/ { x=2; while(x<=NF) { print $x " " p; x++} }'  $HOME/.multidistrotools/${DIST}/var/lib/apt/lists/*_Sources  | tr "," " " > $MCVDIR/src_packages
+
+
+## PROBLEM: there is no defined order between Binary and Version fields!
+## assume Version comes before Binary is our case (reprepro does that)
+# Print Version for the src_packages column
+# Warning: print bin before $2 in first awk to prevent stuff like ",,"
+#awk '/^Version:/ { bin=$2 } /^Binary:/ { print bin "," $2}' $HOME/.multidistrotools/${DIST}/var/lib/apt/lists/*_Sources | awk -F"," '{ x=2; while(x<=NF) {  if ($x != "") { print $x, $1 }; x++ }  }' | sort > $MCVDIR/src_packages
+awk '/^Version:/ { ver=$2 } /^Binary:/ { bin=""; x=2; while(x<=NF) { bin=bin $x; x++ }; print ver "," bin}'  $HOME/.multidistrotools/${DIST}/var/lib/apt/lists/*_Sources  | awk -F"," '{ x=2; while(x<=NF) {  if ($x != "") { print $x, $1 }; x++ }  }' | sort > $MCVDIR/src_packages
+
+
+# Print BIN for bin_packages
+#sed -n "s@^Package: \(.*\)@\1 at p" ~/.multidistrotools/${DIST}/var/lib/apt/lists/*_Packages | sort | uniq | awk '{print $1, "BIN"}' > $MCVDIR/bin_packages
+
+# Print Version for the bin_packages
+awk '/^Package:/ { p=$2 } /^Version:/ { print p, $2 }' $HOME/.multidistrotools/${DIST}/var/lib/apt/lists/*_Packages | sort > $MCVDIR/bin_packages
+
+
+# Workaround: debian used to provide a patch to uniq which added a -W option,
+# which provided field-based uniqueness.
+uniqW1(){
+awk 'BEGIN { s = "" } { if ($1 != s) { print $0 ; s = $1} }'
+}
+
+
+# get all the packages
+awk '{print $1, "NOTFOUND"}' $MCVDIR/{src,bin}_packages | sort | uniq > $MCVDIR/all_packages
+# add missing packages to the pkg lists
+for D in src bin; do
+        cat $MCVDIR/{${D},all}_packages | sort --stable -k 1,1 | uniqW1 > $MCVDIR/${D}_packages_complete
+done
+join $MCVDIR/{src,bin}_packages_complete
+
+
+rm -rf $MCVDIR


Property changes on: multidistrotools/trunk/scripts/compare-src-bin.bash
___________________________________________________________________
Name: svn:executable
   + *




More information about the Pkg-multidistrotools-commits mailing list