[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH 1/2] Convert linux source package to source format 3.0 (quilt)



Changes from v1:
- Moved the compression changes to a second patch
- Cleaned up the 'orig' commands to use the proper exclude option
- Restored the source stamp target in rules.real, which now checks
  that all patches are applied

Not shown in the diff: debian/patches/series-all is renamed to
debian/patches/series.

I've verified that package building doesn't modify the source directory
(at least on amd64) and results in the same binary package contents.

Ben.

Index: debian/rules
===================================================================
--- debian/rules	(revision 19080)
+++ debian/rules	(working copy)
@@ -43,7 +43,8 @@
 TAR_ORIG = $(firstword $(wildcard ../$(TAR_ORIG_NAME)) $(wildcard ../orig/$(TAR_ORIG_NAME)))
 
 orig: $(DIR_ORIG)
-	rsync --delete --exclude debian --exclude .svk --exclude .svn --link-dest=$(DIR_ORIG)/ -a $(DIR_ORIG)/ .
+	rsync --delete --exclude /debian --exclude .svk --exclude .svn --link-dest=$(DIR_ORIG)/ -a $(DIR_ORIG)/ .
+	QUILT_PATCHES='$(CURDIR)/debian/patches' quilt push --quiltrc - -a -q --fuzz=0
 
 $(DIR_ORIG):
 ifeq ($(TAR_ORIG),)
Index: debian/source/local-options
===================================================================
--- debian/source/local-options	(revision 0)
+++ debian/source/local-options	(revision 0)
@@ -0,0 +1 @@
+abort-on-upstream-changes
Index: debian/source/format
===================================================================
--- debian/source/format	(revision 19080)
+++ debian/source/format	(working copy)
@@ -1,2 +1,2 @@
-1.0
+3.0 (quilt)
 
Index: debian/bin/test-patches
===================================================================
--- debian/bin/test-patches	(revision 19080)
+++ debian/bin/test-patches	(working copy)
@@ -55,36 +55,42 @@
     dch -v "$version" --distribution UNRELEASED "Testing patches $*"
 fi
 
-restrictfeature=
+# Make new directory for patches
+mkdir -p debian/patches/test
+
+# Ignore user's .quiltrc
+alias quilt='quilt --quiltrc -'
+
+# Try to clean up any previous test patches
 if [ "$featureset" = none ]; then
-    series="series-all"
+    while quilt top 2>/dev/null | grep -q ^test/; do
+        quilt delete
+    done
 else
-    series="series-${featureset}"
+    sed -i '/^test\//d' debian/patches/series-${featureset}
 fi
 
-# Copy all patches into a new directory
+# Prepare a new directory for the patches
 rm -rf debian/patches/test/
 mkdir debian/patches/test
-cp -t debian/patches/test/ "$@"
 
-# Try to clean up any test patches on exit, but also do it now just in case
-sed -i '/^test\//d' debian/patches/"$series"
-trap "sed -i '/^test\//d' debian/patches/\"$series\"" EXIT
-
-# Append to patch series
-for patch in "$@"; do
-    echo "test/$(basename "$patch")" >>debian/patches/"$series"
-done
-
 # Regenerate control and included rules
 rm debian/control debian/rules.gen
 debian/rules debian/control-real && exit 1 || true
 test -f debian/control
 test -f debian/rules.gen
 
-# Clean and patch source
+# Clean up old build; apply existing patches for featureset
 debian/rules clean
 debian/rules source
 
+# Apply the additional patches
+for patch in "$@"; do
+    patch_abs="$(readlink -f "$patch")"
+    (cd "debian/build/source_${featureset}" && \
+     quilt import -P "test/$(basename "$patch")" "$patch_abs" && \
+     quilt push --fuzz=0)
+done
+
 # Build selected binaries
 fakeroot make -f debian/rules.gen binary-arch_"$arch"_"$featureset"_"$flavour"
Index: debian/rules.real
===================================================================
--- debian/rules.real	(revision 19080)
+++ debian/rules.real	(working copy)
@@ -60,37 +60,37 @@
 $(BUILD_DIR)/config.$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(KCONFIG)
 	python debian/bin/kconfig.py '$@' $(KCONFIG) $(KCONFIG_OPTIONS)
 
-$(BUILD_DIR)/linux-source-$(UPSTREAMVERSION).tar.bz2: SOURCE_DIR=$(BUILD_DIR)/source
+define copy_source
+mkdir -p '$(1)'
+cp -al $(filter-out debian .pc .svk .svn, $(wildcard * .[^.]*)) '$(1)'
+endef
+
 $(BUILD_DIR)/linux-source-$(UPSTREAMVERSION).tar.bz2: DIR = $(BUILD_DIR)/linux-source-$(UPSTREAMVERSION)
 $(BUILD_DIR)/linux-source-$(UPSTREAMVERSION).tar.bz2: $(STAMPS_DIR)/source
 	rm -rf '$@' '$(DIR)'
-	cp -al '$(SOURCE_DIR)' '$(DIR)'
+	$(call copy_source,$(DIR))
 	chmod -R u+rw,go=rX '$(DIR)'
 	cd '$(BUILD_DIR)'; tar -cjf 'linux-source-$(UPSTREAMVERSION).tar.bz2' 'linux-source-$(UPSTREAMVERSION)'
 	rm -rf '$(DIR)'
 
 define patch_cmd
-cd '$(DIR)' && QUILT_PATCHES='$(CURDIR)/debian/patches' QUILT_SERIES=series-$(1) quilt push --quiltrc - -a -q --fuzz=1
+cd '$(DIR)' && QUILT_PATCHES='$(CURDIR)/debian/patches' QUILT_SERIES=series-$(1) quilt push --quiltrc - -a -q --fuzz=0
 endef
 
-$(STAMPS_DIR)/source: SOURCE_FILES = $(filter-out debian, $(wildcard * .[^.]*))
-$(STAMPS_DIR)/source: DIR = $(BUILD_DIR)/source
 $(STAMPS_DIR)/source:
-	rm -rf '$(DIR)'
-	mkdir -p '$(DIR)'
-	cp -al $(SOURCE_FILES) '$(DIR)'
-	$(call patch_cmd,all)
+	test -d .pc
+	set +e; quilt unapplied --quiltrc - >/dev/null && echo 'Patch series not fully applied'; test $$? -eq 1
 	@$(stamp)
 
 $(STAMPS_DIR)/source_$(FEATURESET): SOURCE_DIR=$(BUILD_DIR)/source
 $(STAMPS_DIR)/source_$(FEATURESET): DIR=$(BUILD_DIR)/source_$(FEATURESET)
 $(STAMPS_DIR)/source_$(FEATURESET): $(STAMPS_DIR)/source
+	mkdir -p '$(BUILD_DIR)'
 	rm -rf '$(DIR)'
 ifeq ($(FEATURESET),none)
-	ln -s source '$(DIR)'
+	ln -s '$(CURDIR)' '$(DIR)'
 else
-	cp -al '$(SOURCE_DIR)' '$(DIR)'
-	rm -rf '$(DIR)/.pc'
+	$(call copy_source,$(DIR))
 	$(call patch_cmd,$(FEATURESET))
 endif
 	@$(stamp)
@@ -136,13 +136,12 @@
 	python debian/bin/buildcheck.py $(DIR) $(ARCH) $(FEATURESET) $(FLAVOUR)
 	@$(stamp)
 
-$(STAMPS_DIR)/build-doc: SOURCE_DIR=$(BUILD_DIR)/source
 $(STAMPS_DIR)/build-doc: DIR=$(BUILD_DIR)/build-doc
 $(STAMPS_DIR)/build-doc: $(STAMPS_DIR)/source
 	rm -rf $(DIR)
-	mkdir $(DIR)
-	+$(MAKE_CLEAN) -C $(SOURCE_DIR) O='$(CURDIR)/$(DIR)' xmldocs
-	+$(MAKE_CLEAN) -C $(SOURCE_DIR) O='$(CURDIR)/$(DIR)' htmldocs mandocs
+	mkdir -p $(DIR)
+	+$(MAKE_CLEAN) O='$(CURDIR)/$(DIR)' xmldocs
+	+$(MAKE_CLEAN) O='$(CURDIR)/$(DIR)' htmldocs mandocs
 	@$(stamp)
 
 install-base:
@@ -164,14 +163,13 @@
 
 install-doc: PACKAGE_NAME = linux-doc-$(VERSION)
 install-doc: DIR = $(BUILD_DIR)/build-doc
-install-doc: SOURCE_DIR = $(BUILD_DIR)/source
 install-doc: PACKAGE_DIR = debian/$(PACKAGE_NAME)
 install-doc: OUT_DIR = $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)
 install-doc: DH_OPTIONS = -p$(PACKAGE_NAME)
 install-doc: $(STAMPS_DIR)/build-doc
 	dh_prep
 	mkdir -p $(OUT_DIR)
-	cp -a $(addprefix $(SOURCE_DIR)/, CREDITS MAINTAINERS README REPORTING-BUGS Documentation) $(OUT_DIR)
+	cp -a CREDITS MAINTAINERS README REPORTING-BUGS Documentation $(OUT_DIR)
 	rm -rf $(OUT_DIR)/Documentation/DocBook
 	cd $(DIR)/Documentation/DocBook; \
 	find * -name '*.html' -print \
@@ -280,7 +278,6 @@
 
 install-libc-dev_$(ARCH): PACKAGE_NAME = linux-libc-dev
 install-libc-dev_$(ARCH): DH_OPTIONS = -p$(PACKAGE_NAME)
-install-libc-dev_$(ARCH): SOURCE_DIR = $(BUILD_DIR)/source
 install-libc-dev_$(ARCH): DIR = $(BUILD_DIR)/build-libc-dev
 install-libc-dev_$(ARCH): OUT_DIR = debian/$(PACKAGE_NAME)/usr
 install-libc-dev_$(ARCH):
@@ -288,9 +285,9 @@
 	dh_testroot
 	dh_prep
 	rm -rf '$(DIR)'
-	mkdir $(DIR)
-	+$(MAKE_CLEAN) -C $(SOURCE_DIR) O='$(CURDIR)/$(DIR)' headers_check ARCH=$(KERNEL_ARCH)
-	+$(MAKE_CLEAN) -C $(SOURCE_DIR) O='$(CURDIR)/$(DIR)' headers_install ARCH=$(KERNEL_ARCH) INSTALL_HDR_PATH='$(CURDIR)'/$(OUT_DIR)
+	mkdir -p $(DIR)
+	+$(MAKE_CLEAN) O='$(CURDIR)/$(DIR)' headers_check ARCH=$(KERNEL_ARCH)
+	+$(MAKE_CLEAN) O='$(CURDIR)/$(DIR)' headers_install ARCH=$(KERNEL_ARCH) INSTALL_HDR_PATH='$(CURDIR)'/$(OUT_DIR)
 
 	rm -rf $(OUT_DIR)/include/drm $(OUT_DIR)/include/scsi
 	find $(OUT_DIR)/include \( -name .install -o -name ..install.cmd \) -execdir rm {} +
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 19080)
+++ debian/changelog	(working copy)
@@ -16,7 +16,8 @@
   * linux-patch-debian: Remove; it is no longer necessary for GPL compliance
     and does not work with our current patch management
   * test-patches: Recognise the rt featureset automatically
-  * Convert patch system to quilt, except for the 'orig' patch series
+  * Convert source package format to 3.0 (quilt)
+    - Convert patch system to quilt, except for the 'orig' patch series
 
  -- Ben Hutchings <ben@decadent.org.uk>  Sat, 02 Jun 2012 20:31:53 +0100
 


-- 
Ben Hutchings
It is impossible to make anything foolproof because fools are so ingenious.


Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: