rev 8636 - scripts

Fathi Boudra fabo at alioth.debian.org
Sat Dec 29 16:48:40 UTC 2007


Author: fabo
Date: 2007-12-29 16:48:38 +0000 (Sat, 29 Dec 2007)
New Revision: 8636

Modified:
   scripts/create-buildprep
Log:
* Add filter for Makefile.in.
* Add note about automake and version recommended.


Modified: scripts/create-buildprep
===================================================================
--- scripts/create-buildprep	2007-12-29 16:24:50 UTC (rev 8635)
+++ scripts/create-buildprep	2007-12-29 16:48:38 UTC (rev 8636)
@@ -3,17 +3,18 @@
 # Usage: create-buildprep untarred-dir-with-debian-drectory
 
 # Script to create a buildprep patch.
-# This script takes an untarred package directory with the debian
-# dir already in it as input.  It makes a copy in dirname.orig,
-# runs debian/rules buildprep, and then creates the 98_buildprep.diff.
-# It unapplies the patch when it is done, and removes the copy
-# of the source directory.
 
-# The only difference should be a new 98_buildprep.diff, and lots of
-# change mtimes.
+# This script takes an untarred package directory with the debian dir already in it as input.
+# It makes a copy in dirname.orig, runs debian/rules buildprep, and then creates the 98_buildprep.diff.
+# It unapplies the patch when it is done, and removes the copy of the source directory.
 
+# The only difference should be a new 98_buildprep.diff, and lots of change mtimes.
+
 # Notes:
-#  - this script depends on the filter-buildprep script
+#  - this script depends on the filter-buildprep script, filterdiff and fakeroot
+#  - use same automake version to reduce garbage. (Hint: head -1 Makefile.in | cut -f6 -d ' ')
+#    admin/detect-autoconf.pl does not compare autoconf version properly.
+#    fixed in kde svn revision 725558, Mon Oct 15 17:20:51 2007 UTC
 
 # (C) 2005, Josh Metzler <joshdeb at metzlers.org>
 # GPL'ed code follow.
@@ -21,42 +22,48 @@
 test $# -gt 0 || { echo "Usage: create-buildprep untarred-dir-with-debian-directory" && exit 1; }
 
 FILTERBP=`which filter-buildprep` || FILTERBP=`which $(dirname $0)/filter-buildprep` || { echo "Failed to find filter-buildprep" && exit 1; }
+FILTERDIFF=`which filterdiff` || { echo "Failed to find filterdiff" && exit 1; }
+FAKEROOT=`which fakeroot` || { echo "Failed to find fakeroot" && exit 1; }
 
 # remove trailing slash if there is one
 DIRNAME=${1%/}
-# strip everything after the first underscore to get the base name
-BASENAME=${1%%_*}
 
 # bail out if this doesn't look like a source directory
 test -d $DIRNAME/debian || { echo "Failed to find a debian subdir" && exit 1; }
 
 # clean the source tree before making the backup copy
-cd $DIRNAME && fakeroot debian/rules clean
+cd $DIRNAME && $FAKEROOT debian/rules clean
 cd ..
 
-# make a hardlinked backup copy
-# autotools does the *right thing* with hardlinks
+# remove the current buildprep patch
+test -e $DIRNAME/debian/patches/98_buildprep.diff && rm $DIRNAME/debian/patches/98_buildprep.diff
+
+# filter Makefile.in patches.
+for patch in `find $DIRNAME/debian/patches -type f -name '*.diff'`; do \
+    filterdiff -x '*Makefile.in' $patch > $patch.tmp; \
+    if cmp --quiet $patch $patch.tmp; then \
+        rm -f $patch.tmp; \
+    else \
+        mv -f $patch.tmp $patch; \
+        echo "fixed patch: $patch"; \
+    fi; \
+done
+
+# make a hardlinked backup copy. autotools does the *right thing* with hardlinks
 cp -lr $DIRNAME $DIRNAME.orig || { echo "Failed to create copy of source directory" && exit 1; }
 echo "Made a copy of the source directory"
 
-# remove the current buildprep patch
-test -e $DIRNAME/debian/patches/98_buildprep.diff && rm $DIRNAME/debian/patches/98_buildprep.diff
-
-# run the buildprep
-cd $DIRNAME && fakeroot debian/rules buildprep
+# run the buildprep: debian/rules clean, debian/rules apply-patches, make -f admin/Makefile.common dist, debian/rules clean
+cd $DIRNAME && $FAKEROOT debian/rules buildprep
 cd ..
 
 # create the new buildprep patch where it belongs
-diff -x debian -Nrua $DIRNAME.orig $DIRNAME | $FILTERBP > $DIRNAME/debian/patches/98_buildprep.diff
+diff -Nrua --exclude debian $DIRNAME.orig $DIRNAME | $FILTERBP > $DIRNAME.orig/debian/patches/98_buildprep.diff
 echo "Created the buildprep patch"
 
-# unapply the patch
-cd $DIRNAME && patch -p0 -R < debian/patches/98_buildprep.diff
-cd ..
-
 # remove the copied directory
-rm -rf $DIRNAME.orig
+rm -rf $DIRNAME
+mv $DIRNAME.orig $DIRNAME
 echo "Removed the source copy"
 
 exit 0
-




More information about the pkg-kde-commits mailing list