From c275d5187dbb5b626b04b397609b1c4446dabcb9 Mon Sep 17 00:00:00 2001 From: Steve McIntyre <93sam@debian.org> Date: Sun, 11 Dec 2005 00:39:10 +0000 Subject: [PATCH] * Split out the code that copies debs into the temporary trees and creates Packages files from the Makefile into tools/add_debs * Split out the code that copies sources into the temporary trees and creates Sources files from the Makefile into tools/add_source_packages --- Makefile | 128 ++------------------------------------ debian/changelog | 6 ++ tools/add_debs | 124 ++++++++++++++++++++++++++++++++++++ tools/add_source_packages | 57 +++++++++++++++++ 4 files changed, 193 insertions(+), 122 deletions(-) create mode 100755 tools/add_debs create mode 100755 tools/add_source_packages diff --git a/Makefile b/Makefile index 8db5b6fb..06dc2bdd 100755 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ #!/usr/bin/make -f -# Main Makefile for YACS +# Main Makefile for debian-cd # # Copyright 1999 Raphaël Hertzog # See the README file for the license @@ -112,6 +112,8 @@ jigdo_cleanup=$(BASEDIR)/tools/jigdo_cleanup grab_md5=$(BASEDIR)/tools/grab_md5 dedicated-src=$(BASEDIR)/tools/dedicated_source make_image=$(BASEDIR)/tools/make_image +add_debs=$(BASEDIR)/tools/add_debs +add_source_packages=$(BASEDIR)/tools/add_source_packages BDIR=$(TDIR)/$(CODENAME)-$(ARCH) ADIR=$(APTTMP)/$(CODENAME)-$(ARCH) @@ -496,130 +498,12 @@ $(SDIR)/CD1/.disk/info: # Adding the deb files to the images packages: bin-infos bin-list $(BDIR)/packages-stamp $(BDIR)/packages-stamp: - @echo "Current disk usage on the binary CDs (before the debs are added) :" - @cd $(BDIR) && du -sm CD[0123456789]* - @echo "Adding the selected packages to each CD :" - @# Check that all packages required by debootstrap are included - @# and create .disk/base_installable if yes - @# Also create .disk/base_components - mkdir -p $(TDIR) - $(Q)for DISK in $(FIRSTDISKS); do \ - DISK=$${DISK##CD}; \ - ok=yes; \ - for p in `debootstrap --arch $(ARCH) --print-debs $(CODENAME) $(TDIR)/debootstrap.tmp file:$(MIRROR)`; do \ - if ! grep -q ^$$p$$ $(BDIR)/$$DISK.packages; then \ - if [ -n "$(BASE_EXCLUDE)" ] && grep -q ^$$p$$ $(BASE_EXCLUDE); then \ - echo "Missing debootstrap-required $$p but included in $(BASE_EXCLUDE)"; \ - continue; \ - fi; \ - ok=no; \ - echo "Missing debootstrap-required $$p"; \ - fi; \ - done; \ - rm -rf $(TDIR)/debootstrap.tmp; \ - if [ "$$ok" = "yes" ]; then \ - echo "CD$$DISK contains all packages needed by debootstrap"; \ - touch $(BDIR)/CD$$DISK/.disk/base_installable; \ - else \ - echo "CD$$DISK missing some packages needed by debootstrap"; \ - fi; \ - echo 'main' > $(BDIR)/CD$$DISK/.disk/base_components; \ - if [ -n "$(LOCAL)" ]; then \ - echo 'local' >> $(BDIR)/CD$$DISK/.disk/base_components; \ - fi; \ - if [ -n "$(UDEB_INCLUDE)" ] ; then \ - if [ -r "$(UDEB_INCLUDE)" ] ; then \ - cp -af "$(UDEB_INCLUDE)" \ - "$(BDIR)/CD$$DISK/.disk/udeb_include"; \ - else \ - echo "ERROR: Unable to read UDEB_INCLUDE file $(UDEB_INCLUDE)"; \ - fi; \ - fi; \ - if [ -n "$(UDEB_EXCLUDE)" ] ; then \ - if [ -r "$(UDEB_EXCLUDE)" ] ; then \ - cp -af "$(UDEB_EXCLUDE)" \ - "$(BDIR)/CD$$DISK/.disk/udeb_exclude"; \ - else \ - echo "ERROR: Unable to read UDEB_EXCLUDE file $(UDEB_EXCLUDE)"; \ - fi; \ - fi; \ - if [ -n "$(BASE_INCLUDE)" ] ; then \ - if [ -r "$(BASE_INCLUDE)" ] ; then \ - cp -af "$(BASE_INCLUDE)" \ - "$(BDIR)/CD$$DISK/.disk/base_include"; \ - else \ - echo "ERROR: Unable to read BASE_INCLUDE file $(BASE_INCLUDE)"; \ - fi; \ - fi; \ - if [ -n "$(BASE_EXCLUDE)" ] ; then \ - if [ -r "$(BASE_EXCLUDE)" ] ; then \ - cp -af $(BASE_EXCLUDE) \ - $(BDIR)/CD$$DISK/.disk/base_exclude; \ - else \ - echo "ERROR: Unable to read BASE_EXCLUDE file $(BASE_EXCLUDE)"; \ - fi; \ - fi; \ - done - $(Q)set -e; \ - for i in $(BDIR)/*.packages; do \ - dir=$${i%%.packages}; \ - n=$${dir##$(BDIR)/}; \ - dir=$(BDIR)/CD$$n; \ - echo "$$n ... "; \ - cat $$i | xargs -n 200 -r $(add_packages) $$dir; \ - if [ -x "$(HOOK)" ]; then \ - cd $(BDIR) && $(HOOK) $$n before-scanpackages; \ - fi; \ - $(scanpackages) scan $$dir; \ - echo "done."; \ - done - @#Now install the Packages and Packages.cd files - $(Q)set -e; \ - for i in $(BDIR)/*.packages; do \ - dir=$${i%%.packages}; \ - dir=$${dir##$(BDIR)/}; \ - dir=$(BDIR)/CD$$dir; \ - $(scanpackages) install $$dir; \ - done + $(Q)$(add_debs) "$(BDIR)" "$(TDIR)" "$(FIRSTDISKS)" "$(ARCH)" "$(BASE_INCLUDE)" "$(BASE_EXCLUDE)" "$(UDEB_INCLUDE)" "$(UDEB_EXCLUDE)" "$(add_packages)" "$(scanpackages)" $(Q)touch $(BDIR)/packages-stamp sources: src-infos src-list $(SDIR)/sources-stamp $(SDIR)/sources-stamp: - @echo "Adding the selected sources to each CD." - $(Q)set -e; \ - for i in $(SDIR)/*.sources; do \ - dir=$${i%%.sources}; \ - n=$${dir##$(SDIR)/}; \ - dir=$(SDIR)/CD$$n; \ - echo -n "$$n ... "; \ - echo -n "main ... "; \ - grep -vE "(non-US/|/local/)" $$i > $$i.main || true ; \ - if [ -s $$i.main ] ; then \ - cat $$i.main | xargs $(add_files) $$dir $(MIRROR); \ - fi ; \ - if [ -n "$(LOCAL)" ]; then \ - echo -n "local ... "; \ - grep "/local/" $$i > $$i.local || true ; \ - if [ -s $$i.local ] ; then \ - if [ -n "$(LOCALDEBS)" ] ; then \ - cat $$i.local | xargs $(add_files) \ - $$dir $(LOCALDEBS); \ - else \ - cat $$i.local | xargs $(add_files) \ - $$dir $(MIRROR); \ - fi; \ - fi; \ - fi; \ - if [ -n "$(NONUS)" ]; then \ - echo -n "non-US ... "; \ - grep "non-US/" $$i > $$i.nonus || true ; \ - if [ -s $$i.nonus ] ; then \ - cat $$i.nonus | xargs $(add_files) $$dir $(NONUS); \ - fi; \ - fi; \ - $(scansources) $$dir; \ - echo "done."; \ - done + $(Q)$(add_source_packages) "$(SDIR)" "$(add_files)" "$(MIRROR)" "$(LOCAL)" "$(LOCALDEBS)" "$(scansources)" $(Q)touch $(SDIR)/sources-stamp ## BOOT & DOC & INSTALL ## @@ -878,7 +762,7 @@ bin-images: ok bin-md5list $(OUT) $(make_image) "$(BDIR)" "$(ARCH)" "$(OUT)" "$(DOJIGDO)" "$(DEBVERSION)" "$(MIRROR)" "$(MKISOFS)" "$(MKISOFS_OPTS)" "$(JIGDO_OPTS)" "$(jigdo_cleanup)" src-images: ok src-md5list $(OUT) - $(make_image) "$(SDIR)" source "$(OUT)" "$(DOJIGDO)" "$(DEBVERSION)" "$(MIRROR)" "$(MKISOFS)" "$(MKISOFS_OPTS)" "$(JIGDO_OPTS)" "$(jigdo_cleanup)" + $(make_image) "$(SDIR)" "source" "$(OUT)" "$(DOJIGDO)" "$(DEBVERSION)" "$(MIRROR)" "$(MKISOFS)" "$(MKISOFS_OPTS)" "$(JIGDO_OPTS)" "$(jigdo_cleanup)" check-number-given: @test -n "$(CD)" || (echo "Give me a CD= parameter !" && false) diff --git a/debian/changelog b/debian/changelog index 22d9e5e8..d7b055a5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -86,6 +86,12 @@ debian-cd (2.2.24) UNRELEASED; urgency=low [ Joey Hess ] * Explicitly list ppp and pppoeconf in generate_d-i+k_list, since they are not installed by debootstrap and we do want them on netinst CDs. + + [ Steve McIntyre ] + * Split out the code that copies debs into the temporary trees and + creates Packages files from the Makefile into tools/add_debs + * Split out the code that copies sources into the temporary trees and + creates Sources files from the Makefile into tools/add_source_packages -- Joey Hess Thu, 8 Dec 2005 22:53:16 +0000 diff --git a/tools/add_debs b/tools/add_debs new file mode 100755 index 00000000..ba9772d5 --- /dev/null +++ b/tools/add_debs @@ -0,0 +1,124 @@ +#!/bin/sh +# +# add_debs +# +# Simple helper script for debian-cd +# +# Split out of the top-level Makefile by SAM 2005/12/10 +# +# 1. Check that the lists of packages look valid (e.g. installer +# packages are on CD#1 +# +# 2. Add deb files into each CD root +# +# 3. Create Packages files within each CD root + +set -e + +BDIR=$1 +TDIR=$2 +FIRSTDISKS=$3 +ARCH=$4 +BASE_INCLUDE=$5 +BASE_EXCLUDE=$6 +UDEB_INCLUDE=$7 +UDEB_EXCLUDE=$8 +ADDPACKAGES=$9 +shift +SCANPACKAGES=$9 + +echo "Current disk usage on the binary CDs (before the debs are added):" +cd $BDIR && du -sm CD[0123456789]* +echo "Adding the selected packages to each CD:" + +# Check that all packages required by debootstrap are included +# and create .disk/base_installable if yes +# Also create .disk/base_components +mkdir -p $TDIR + +for DISK in $FIRSTDISKS +do + DISK=${DISK##CD} + ok=yes + for p in `debootstrap --arch $ARCH --print-debs $CODENAME $TDIR/debootstrap.tmp file:$MIRROR` + do + if ! grep -q ^$p$ $BDIR/$DISK.packages ; then + if [ -n "$BASE_EXCLUDE" ] && grep -q ^$p$ $BASE_EXCLUDE ; then + echo "Missing debootstrap-required $p but included in $BASE_EXCLUDE" + continue + fi + ok=no + echo "Missing debootstrap-required $p" + fi + done + + rm -rf $TDIR/debootstrap.tmp + + if [ "$ok" = "yes" ] ; then + echo "CD$DISK contains all packages needed by debootstrap" + touch $BDIR/CD$DISK/.disk/base_installable + else + echo "CD$DISK missing some packages needed by debootstrap" + fi + + echo 'main' > $BDIR/CD$DISK/.disk/base_components + if [ -n "$LOCAL" ] ; then + echo 'local' >> $BDIR/CD$DISK/.disk/base_components + fi + + # Sort out the udeb include and exclude files + if [ -n "$UDEB_INCLUDE" ] ; then + if [ -r "$UDEB_INCLUDE" ] ; then + cp -af "$UDEB_INCLUDE" "$BDIR/CD$DISK/.disk/udeb_include" + else + echo "ERROR: Unable to read UDEB_INCLUDE file $UDEB_INCLUDE" + fi + fi + if [ -n "$UDEB_EXCLUDE" ] ; then + if [ -r "$UDEB_EXCLUDE" ] ; then + cp -af "$UDEB_EXCLUDE" "$BDIR/CD$DISK/.disk/udeb_exclude" + else + echo "ERROR: Unable to read UDEB_EXCLUDE file $UDEB_EXCLUDE" + fi + fi + + # Ditto the base include and exclude + if [ -n "$BASE_INCLUDE" ] ; then + if [ -r "$BASE_INCLUDE" ] ; then + cp -af "$BASE_INCLUDE" "$BDIR/CD$DISK/.disk/base_include" + else + echo "ERROR: Unable to read BASE_INCLUDE file $BASE_INCLUDE" + fi + fi + if [ -n "$BASE_EXCLUDE" ] ; then + if [ -r "$BASE_EXCLUDE" ] ; then + cp -af $BASE_EXCLUDE $BDIR/CD$DISK/.disk/base_exclude + else + echo "ERROR: Unable to read BASE_EXCLUDE file $BASE_EXCLUDE" + fi + fi +done + +# Generate the Packages files +for i in $BDIR/*.packages +do + dir=${i%%.packages} + n=${dir##$BDIR/} + dir=$BDIR/CD$n + echo "$n ... " + cat $i | xargs -n 200 -r $ADDPACKAGES $dir + if [ -x "$HOOK" ] ; then + cd $BDIR && $HOOK $n before-scanpackages + fi + $SCANPACKAGES scan $dir + echo "done." +done + +# Now install the Packages and Packages.cd files +for i in $BDIR/*.packages +do + dir=${i%%.packages} + dir=${dir##$BDIR/} + dir=$BDIR/CD$dir + $SCANPACKAGES install $dir +done diff --git a/tools/add_source_packages b/tools/add_source_packages new file mode 100755 index 00000000..914dad31 --- /dev/null +++ b/tools/add_source_packages @@ -0,0 +1,57 @@ +#!/bin/sh +# +# add_source_packages +# +# Simple helper script for debian-cd +# +# Split out of the top-level Makefile by SAM 2005/12/10 +# +# 1. Add source files into each CD root +# +# 2. Create Sources files within each CD root + +set -e + +SDIR=$1 +ADD_FILES=$2 +MIRROR=$3 +LOCAL=$4 +LOCALDEBS=$5 +SCANSOURCES=$6 + +echo "Adding the selected sources to each CD." +for i in $SDIR/*.sources +do + dir=${i%%.sources} + n=${dir##$SDIR/} + dir=$SDIR/CD$n + echo -n "$n ... " + echo -n "main ... " + grep -vE "(non-US/|/local/)" $i > $i.main || true + if [ -s $i.main ] ; then + cat $i.main | xargs $ADD_FILES $dir $MIRROR + fi + + if [ -n "$LOCAL" ] ; then + echo -n "local ... " + grep "/local/" $i > $i.local || true + if [ -s $i.local ] ; then + if [ -n "$LOCALDEBS" ] ; then + cat $i.local | xargs $ADD_FILES $dir $LOCALDEBS + else + cat $i.local | xargs $ADD_FILES $dir $MIRROR + fi + fi + fi + + if [ -n "$NONUS" ] ; then + echo -n "non-US ... " + grep "non-US/" $i > $i.nonus || true + if [ -s $i.nonus ] ; then + cat $i.nonus | xargs $ADD_FILES $dir $NONUS + fi + fi + + $SCANSOURCES $dir + echo "done." +done