UBUNTU: make module-inclusion selection retain the left overs
authorAndy Whitcroft <apw@canonical.com>
Fri, 16 Sep 2011 13:45:59 +0000 (14:45 +0100)
committerLeann Ogasawara <leann.ogasawara@canonical.com>
Mon, 2 Apr 2012 20:12:23 +0000 (13:12 -0700)
Move module inclusion to a model when the non-included modules
are retained.  This allow two things:

1) processing can now be applied iterativly to carve out any number of
   sub-packages, and
2) we can package the 'remaining' modules.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>

debian/rules.d/2-binary-arch.mk
debian/scripts/module-inclusion

index d0f31f3..c0259e6 100644 (file)
@@ -82,11 +82,17 @@ endif
        # Remove all modules not in the inclusion list.
        #
        if [ -f $(DEBIAN)/control.d/$(target_flavour).inclusion-list ] ; then \
-               $(SHELL) $(DROOT)/scripts/module-inclusion $(pkgdir)/lib/modules/$(abi_release)-$*/kernel \
+               mkdir -p $(pkgdir)-ALL/lib/modules/$(abi_release)-$*; \
+               mv $(pkgdir)/lib/modules/$(abi_release)-$*/kernel \
+                       $(pkgdir)-ALL/lib/modules/$(abi_release)-$*/kernel; \
+               $(SHELL) $(DROOT)/scripts/module-inclusion --master \
+                       $(pkgdir)-ALL/lib/modules/$(abi_release)-$*/kernel \
+                       $(pkgdir)/lib/modules/$(abi_release)-$*/kernel \
                        $(DEBIAN)/control.d/$(target_flavour).inclusion-list 2>&1 | \
                                tee $(target_flavour).inclusion-list.log; \
                /sbin/depmod -b $(pkgdir) -ea -F $(pkgdir)/boot/System.map-$(abi_release)-$* \
                        $(abi_release)-$* 2>&1 |tee $(target_flavour).depmod.log; \
+               rm -rf $(pkgdir)-ALL; \
        fi
 
 ifeq ($(no_dumpfile),)
index ec3ce5e..deb07a8 100755 (executable)
@@ -5,17 +5,33 @@
 # The includsion list format must be a bash regular expression.
 #
 # usage: $0 ROOT INCLUSION_LIST
-# example: $0 debian/build/build-virtual debian.master/control.d/virtual.inclusion-list
-ROOT=$1
-ILIST=$2
+# example: $0 debian/build/build-virtual \
+#       debian/build/build-virtual-ALL debian/build/build-virtual \
+#      debian.master/control.d/virtual.inclusion-list
+master=0
+if [ "$1" = "--master" ]; then
+       master=1
+       shift
+fi
 
-NROOT=${ROOT}.new
+ROOT=$1
+NROOT=$2
+ILIST=$3
 
 #
 # Prep a destination directory.
 #
 mkdir -p ${NROOT}
-rsync -a --exclude="*.ko" ${ROOT}/ ${NROOT}
+
+# Copy over the framework...
+if  [ "$master" -eq 1 ]; then
+       (cd ${ROOT}; find . ! -name "*.ko" -type f) | \
+       while read f
+       do
+               mkdir -p ${NROOT}/`dirname $f`
+               mv ${ROOT}/$f ${NROOT}/$f
+       done
+fi
 
 cat ${ILIST} |while read i
 do
@@ -27,13 +43,13 @@ do
                (cd ${ROOT}; eval find "${i}" -name "*.ko") |while read f
                do
                        mkdir -p ${NROOT}/`dirname $f`
-                       cp ${ROOT}/$f ${NROOT}/$f
+                       mv ${ROOT}/$f ${NROOT}/$f
                done
        else
                if [ -f "${ROOT}/$i" ]
                then
                        mkdir -p ${NROOT}/`dirname $i`
-                       cp ${ROOT}/$i ${NROOT}/$i
+                       mv ${ROOT}/$i ${NROOT}/$i
                else
                        echo Warning: Could not find ${ROOT}/$i
                fi
@@ -41,11 +57,4 @@ do
 
 done
 
-#
-# Cleanup
-#
-rm -rf ${ROOT}
-mv ${NROOT} ${ROOT}
-
 exit 0
-