From patchwork Fri Sep 16 13:45:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/2] UBUNTU: make module-inclusion selection retain the left overs Date: Fri, 16 Sep 2011 03:45:59 -0000 From: Andy Whitcroft X-Patchwork-Id: 114926 Message-Id: <1316180760-3201-2-git-send-email-apw@canonical.com> To: kernel-team@lists.ubuntu.com Cc: Andy Whitcroft 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 --- debian/rules.d/2-binary-arch.mk | 8 +++++++- debian/scripts/module-inclusion | 37 +++++++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk index d0f31f3..c0259e6 100644 --- a/debian/rules.d/2-binary-arch.mk +++ b/debian/rules.d/2-binary-arch.mk @@ -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),) diff --git a/debian/scripts/module-inclusion b/debian/scripts/module-inclusion index ec3ce5e..deb07a8 100755 --- a/debian/scripts/module-inclusion +++ b/debian/scripts/module-inclusion @@ -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 -