[Pkg-lustre-svn-commit] r271 - in /trunk/debian: changelog kpatches/patch-vanilla-2.6.18 kpatches/patch-vanilla-2.6.20 kpatches/patch-vanilla-2.6.21 linux-patch-lustre.apply linux-patch-lustre.dirs linux-patch-lustre.unpatch rules

goswin-guest at users.alioth.debian.org goswin-guest at users.alioth.debian.org
Wed Sep 5 11:55:03 UTC 2007


Author: goswin-guest
Date: Wed Sep  5 11:55:02 2007
New Revision: 271

URL: http://svn.debian.org/wsvn/pkg-lustre/?sc=1&rev=271
Log:
Introduce custom patch/unpatch script instead of the premade kpatches.


Added:
    trunk/debian/linux-patch-lustre.apply
    trunk/debian/linux-patch-lustre.dirs
    trunk/debian/linux-patch-lustre.unpatch
Removed:
    trunk/debian/kpatches/patch-vanilla-2.6.18
    trunk/debian/kpatches/patch-vanilla-2.6.20
    trunk/debian/kpatches/patch-vanilla-2.6.21
Modified:
    trunk/debian/changelog
    trunk/debian/rules

Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-lustre/trunk/debian/changelog?rev=271&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Wed Sep  5 11:55:02 2007
@@ -9,8 +9,10 @@
   [ Goswin von Brederlow ]
   * Fix -m64 problem causing FTBFS
   * Move kernel patches out of debian/patches and ships them verbatim
+  * Custom patch/unpatch script using quilt, no more prebuild kpatches
+    + FIXME: Only put needed series and patches into linux-patch-lustre
   * FIXME: need 2.6.18 vanilla and 2.6.18 debian ldiskfs series and detection
-    + support for 2.6.18 vanilla
+    + support for 2.6.18 vanilla works
   * Update 2.6.20 patches, FIXME: get pending ldiskfs changes
   * FIXME: update 2.6.21 and 2.6.22 patches, disabled for now
   * Update autogen.sh and autogen-run patches

Added: trunk/debian/linux-patch-lustre.apply
URL: http://svn.debian.org/wsvn/pkg-lustre/trunk/debian/linux-patch-lustre.apply?rev=271&op=file
==============================================================================
--- trunk/debian/linux-patch-lustre.apply (added)
+++ trunk/debian/linux-patch-lustre.apply Wed Sep  5 11:55:02 2007
@@ -1,0 +1,118 @@
+#! /bin/bash
+set -x
+
+if ! [ -d kernel -a -d Documentation ]
+then
+    echo >&2 "Not in kernel top level directory. Exiting"
+    exit 1
+fi
+TOPPATCHDIR=/usr/src/kernel-patches/lustre
+ARCHITECTURE=`dpkg --print-installation-architecture`
+
+QUILT="quilt --quiltrc /dev/null"
+export QUILT_PATCHES="$TOPPATCHDIR/patches"
+
+[ -f debian/APPLIED_all_lustre ] && exit 0
+VERSION=$(grep ^VERSION Makefile 2>/dev/null | \
+        sed -e 's/[^0-9]*\([0-9]*\)/\1/')
+PATCHLEVEL=$( grep ^PATCHLEVEL Makefile 2>/dev/null | \
+        sed -e 's/[^0-9]*\([0-9]*\)/\1/')
+SUBLEVEL=$(grep ^SUBLEVEL Makefile 2>/dev/null | \
+        sed -e 's/[^0-9]*\([0-9]*\)/\1/')
+#EXTRAVERSION=$(grep ^EXTRAVERSION Makefile | head -1 2>/dev/null | \
+#        sed -e 's/EXTRAVERSION =[       ]*\([^  ]*\)$/\1/')
+#KERNELBRANCHLET=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}
+#KERNELRELEASE=${KERNELBRANCHLET}${EXTRAVERSION}
+KERNELRELEASE=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}
+
+cleanup() {
+  echo >&2 Cleaning up
+  if [ -e series ]; then
+    echo >&2 Removing series file
+    rm series
+  fi
+  if [ -e debian/APLLIED_all_lustre_tmp/series.orig ]; then
+    echo >&1 Restoring orig series file
+    mv debian/APLLIED_all_lustre_tmp/series.orig series
+  fi
+  if [ -e .pc ]; then
+    echo >&2 Removing .pc dir
+    rm -r .pc
+  fi
+  if [ -e debian/APPLIED_all_lustre_tmp/.pc.orig ]; then
+    echo >&2 Restoring orig .pc dir
+    mv debian/APPLIED_all_lustre_tmp/.pc.orig .pc
+  fi
+}
+
+mkdir -p debian/APPLIED_all_lustre_tmp
+if [ -e series ]; then
+  echo >&2 Preserving existing series file
+  mv series debian/APPLIED_all_lustre_tmp/series.orig
+fi
+if [ -e .pc ]; then
+  echo >&2 Preserving existing .pc dir
+  mv .pc debian/APPLIED_all_lustre_tmp/.pc.orig
+fi
+
+trap cleanup EXIT
+
+echo >&2 Setting up quilt
+quilt setup $TOPPATCHDIR/series/$KERNELRELEASE-vanilla.series 2>/dev/null
+ERR=$?
+if ! [ $ERR = 0 ]; then
+  echo >&2 Quilt failed to initialize
+  cleanup
+  exit $ERR
+fi
+
+echo >&2 Applying lustre patches
+quilt push -a
+ERR=$?
+if ! [ $ERR = 0 ]; then
+  echo >&2 Lustre patched failed to apply
+  echo >&2 Reverting partialy applied patch
+  quilt pop -a
+  cleanup
+  exit $ERR
+fi
+
+echo >&2 Finalizing lustre patch
+mv series debian/APPLIED_all_lustre_tmp/series.lustre
+mv .pc debian/APPLIED_all_lustre_tmp/.pc.lustre
+cleanup
+
+
+echo >&2 "\"Lustre Filesystem patch for the Linux kernel\" patch for $KVERSION succeeded"
+
+echo >&2 "Removing empty files:"
+# make an exception for ./debian, or else the stamp files will go too.
+find . -path ./debian -prune -o \
+       -type f -size 0 ! -name 'APPLIED*' -exec rm {} \; -print
+echo >&2 "Done."
+
+mkdir -p debian
+cat > 'debian/APPLIED_all_lustre' <<EOF
+SERIES=$KERNELRELEASE-vanilla.series
+EOF
+mkdir -p debian/image.d
+PKGNAME=`dpkg -S $TOPPATCHDIR/series/$KERNELRELEASE-vanilla.series | cut -d: -f1`
+PKGVERS=`grep-dctrl -n -P $PKGNAME -s Version -X /var/lib/dpkg/status`
+cat > 'debian/image.d/register-lustre' <<EOF
+#!/bin/sh
+
+# This scripts documents the "Lustre Filesystem patch for the Linux kernel" kernel patch into the
+# kernel-image package, as being applied to the kernel.
+
+docdir=\${IMAGE_TOP}/usr/share/doc/kernel-image-\${version}
+
+mkdir -p \${docdir}
+
+(
+    printf 'Lustre Filesystem patch for the Linux kernel (lustre)${KPATCH_lustre:+ for kernel ${KPATCH_lustre}},'
+    echo ' from package $PKGNAME, version $PKGVERS'
+) >> \${docdir}/applied-patches
+EOF
+chmod +x 'debian/image.d/register-lustre'
+
+echo >&2 "END applying lustre patch"

Added: trunk/debian/linux-patch-lustre.dirs
URL: http://svn.debian.org/wsvn/pkg-lustre/trunk/debian/linux-patch-lustre.dirs?rev=271&op=file
==============================================================================
--- trunk/debian/linux-patch-lustre.dirs (added)
+++ trunk/debian/linux-patch-lustre.dirs Wed Sep  5 11:55:02 2007
@@ -1,0 +1,3 @@
+usr/src/kernel-patches/lustre/scripts
+usr/src/kernel-patches/lustre/series
+usr/src/kernel-patches/lustre/patches

Added: trunk/debian/linux-patch-lustre.unpatch
URL: http://svn.debian.org/wsvn/pkg-lustre/trunk/debian/linux-patch-lustre.unpatch?rev=271&op=file
==============================================================================
--- trunk/debian/linux-patch-lustre.unpatch (added)
+++ trunk/debian/linux-patch-lustre.unpatch Wed Sep  5 11:55:02 2007
@@ -1,0 +1,117 @@
+#! /bin/bash
+set -x
+
+if ! [ -d kernel -a -d Documentation ]
+then
+    echo >&2 "Not in kernel top level directory. Exiting"
+    exit 1
+fi
+TOPPATCHDIR=/usr/src/kernel-patches/lustre
+ARCHITECTURE=`dpkg --print-installation-architecture`
+
+QUILT="quilt --quiltrc /dev/null"
+export QUILT_PATCHES="$TOPPATCHDIR/patches"
+
+if ! [ -f debian/APPLIED_all_lustre ]; then
+  echo >&2 "Lustre patch not applied."
+  exit 0
+fi
+VERSION=$(grep ^VERSION Makefile 2>/dev/null | \
+        sed -e 's/[^0-9]*\([0-9]*\)/\1/')
+PATCHLEVEL=$( grep ^PATCHLEVEL Makefile 2>/dev/null | \
+        sed -e 's/[^0-9]*\([0-9]*\)/\1/')
+SUBLEVEL=$(grep ^SUBLEVEL Makefile 2>/dev/null | \
+        sed -e 's/[^0-9]*\([0-9]*\)/\1/')
+#EXTRAVERSION=$(grep ^EXTRAVERSION Makefile | head -1 2>/dev/null | \
+#        sed -e 's/EXTRAVERSION =[       ]*\([^  ]*\)$/\1/')
+#KERNELBRANCHLET=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}
+#KERNELRELEASE=${KERNELBRANCHLET}${EXTRAVERSION}
+KERNELRELEASE=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}
+
+# Check for depends on lustre
+if grep -l "^DEPENDS=.*[' ]all/unpatch/lustre[' ]" debian/APPLIED_* >/dev/null 2>/dev/null; then
+    # There are patches depending on this one, to be removed before.
+    # the dep will be removed by the last of those other patches.
+    echo >&2 "NOT unpatching \"Lustre Filesystem patch for the Linux kernel\" since other patches still rely on it"
+    exit 0
+fi
+
+if ! [ -d debian/APPLIED_all_lustre_tmp/.pc.lustre ]; then
+  cat >&2 <<EOF
+ERROR: .pc directory missing for unpatching. I strongly suggest
+you remove this kernel tree and unpack a clean one.
+EOF
+  exit 1
+fi
+
+if ! [ -e debian/APPLIED_all_lustre_tmp/series.lustre ]; then
+  cat >&2 <<EOF
+ERROR: series file missing for unpatching. I strongly suggest
+you remove this kernel tree and unpack a clean one.
+EOF
+  exit 1
+fi
+
+cleanup() {
+  echo >&2 Cleaning up
+  if [ -e series ]; then
+    echo >&2 Removing series file
+    rm series
+  fi
+  if [ -e debian/APPLIED_all_lustre_tmp/series.orig ]; then
+    echo >&1 Restoring orig series file
+    mv debian/APPLIED_all_lustre_tmp/series.orig series
+  fi
+  if [ -e .pc ]; then
+    echo >&2 Removing .pc dir
+    rm -r .pc
+  fi
+  if [ -e debian/APPLIED_all_lustre_tmp/.pc.orig ]; then
+    echo >&2 Restoring orig .pc dir
+    mv debian/APPLIED_all_lustre_tmp/.pc.orig .pc
+  fi
+}
+
+if [ -e series ]; then
+  echo >&2 Preserving existing series file
+  mv series debian/APPLIED_all_lustre_tmp/series.orig
+fi
+if [ -e .pc ]; then
+  echo >&2 Preserving existing .pc dir
+  mv .pc debian/APPLIED_all_lustre_tmp/.pc.orig
+fi
+
+trap cleanup EXIT
+
+echo >&2 Restoring lustre quilt
+mv debian/APPLIED_all_lustre_tmp/series.lustre series
+mv debian/APPLIED_all_lustre_tmp/.pc.lustre .pc
+
+echo >&2 Unpatching lustre patches
+quilt pop -a
+ERR=$?
+if ! [ $ERR = 0 ]; then
+  cat >&2 <<EOF
+ERROR: Lustre patches failed to unpatch. I strongly suggest
+you remove this kernel tree and unpack a clean one.
+EOF
+  cleanup
+  exit $ERR
+fi
+
+echo >&2 Removing lustre quilt
+rm -rf .pc series
+cleanup
+rm debian/APPLIED_all_lustre debian/image.d/register-lustre
+
+echo >&2 "\"Lustre Filesystem patch for the Linux kernel\" patch for $KVERSION removed successfully"
+
+echo >&2 "Removing empty files:"
+# make an exception for ./debian, or else the stamp files will go too.
+find . -path ./debian -prune -o \
+       -type f -size 0 ! -name 'APPLIED*' -exec rm {} \; -print
+echo >&2 "Done."
+
+rmdir debian/image.d debian/APPLIED_all_lustre_tmp || true
+
+echo >&2 "END unpatching lustre patch"

Modified: trunk/debian/rules
URL: http://svn.debian.org/wsvn/pkg-lustre/trunk/debian/rules?rev=271&op=diff
==============================================================================
--- trunk/debian/rules (original)
+++ trunk/debian/rules Wed Sep  5 11:55:02 2007
@@ -101,12 +101,36 @@
 
 binary: binary-indep binary-arch
 
-binary-$(PATCH_PKG): patch-stamp $(patsubst %,debian/kpatches/patch-vanilla-%,$(SUPPORTED_KERNELS))
+binary-$(PATCH_PKG): patch-stamp
 	dh_testdir
 	dh_testroot
 	dh_installdirs -p $(PATCH_PKG)
 	dh_installdocs -p $(PATCH_PKG)
-	dh_installkpatches -p $(PATCH_PKG)
+#	dh_installkpatches -p $(PATCH_PKG)
+	dh_install -p $(PATCH_PKG)
+
+	# Install apply script
+	cp $(TOP_DIR)/debian/linux-patch-lustre.apply $(TOP_DIR)/debian/$(PATCH_PKG)/usr/src/kernel-patches/lustre/scripts/apply
+	chmod a+x $(TOP_DIR)/debian/$(PATCH_PKG)/usr/src/kernel-patches/lustre/scripts/apply
+	set -e; for KERNEL in $(SUPPORTED_KERNELS); do \
+	  mkdir -p $(TOP_DIR)/debian/$(PATCH_PKG)/usr/src/kernel-patches/all/$$KERNEL/apply/; \
+	  ln -s ../../../lustre/scripts/apply $(TOP_DIR)/debian/$(PATCH_PKG)/usr/src/kernel-patches/all/$$KERNEL/apply/lustre; \
+	done
+
+	# Install unpatch script
+	cp $(TOP_DIR)/debian/linux-patch-lustre.unpatch $(TOP_DIR)/debian/$(PATCH_PKG)/usr/src/kernel-patches/lustre/scripts/unpatch
+	chmod a+x $(TOP_DIR)/debian/$(PATCH_PKG)/usr/src/kernel-patches/lustre/scripts/unpatch
+	set -e; for KERNEL in $(SUPPORTED_KERNELS); do \
+	  mkdir -p $(TOP_DIR)/debian/$(PATCH_PKG)/usr/src/kernel-patches/all/$$KERNEL/unpatch/; \
+	  ln -s ../../../lustre/scripts/unpatch $(TOP_DIR)/debian/$(PATCH_PKG)/usr/src/kernel-patches/all/$$KERNEL/unpatch/lustre; \
+	done
+
+	# Install series
+	cp lustre/kernel_patches/series/* $(TOP_DIR)/debian/$(PATCH_PKG)/usr/src/kernel-patches/lustre/series/
+
+	# Install patches
+	cp lustre/kernel_patches/patches/* $(TOP_DIR)/debian/$(PATCH_PKG)/usr/src/kernel-patches/lustre/patches/
+
 	dh_installchangelogs -p $(PATCH_PKG) lustre/ChangeLog
 	dh_compress -p $(PATCH_PKG)
 	dh_installdeb -p $(PATCH_PKG)




More information about the Pkg-lustre-svn-commit mailing list