From 1f19193d3c56540aca9fe015ed7d13b5a981d303 Mon Sep 17 00:00:00 2001 From: Steve McIntyre <93sam@debian.org> Date: Thu, 8 Dec 2005 22:55:19 +0000 Subject: [PATCH] Split out the actual ISO/jigdo creation code from the Makefile into tools/make_image --- Makefile | 114 ++++------------------------------------------- debian/changelog | 4 +- tools/make_image | 90 +++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 107 deletions(-) create mode 100755 tools/make_image diff --git a/Makefile b/Makefile index 3547134a..c84a1ab0 100755 --- a/Makefile +++ b/Makefile @@ -111,6 +111,7 @@ fastsums=$(BASEDIR)/tools/fast_sums jigdo_cleanup=$(BASEDIR)/tools/jigdo_cleanup grab_md5=$(BASEDIR)/tools/grab_md5 dedicated-src=$(BASEDIR)/tools/dedicated_source +make_image=$(BASEDIR)/tools/make_image BDIR=$(TDIR)/$(CODENAME)-$(ARCH) ADIR=$(APTTMP)/$(CODENAME)-$(ARCH) @@ -874,117 +875,18 @@ images: bin-images src-images # 2 jigdo, cleanup_jigdo # bin-images: ok bin-md5list $(OUT) - @echo "Generating the binary iso/jigdo images ..." - $(Q)set -e; \ - for file in $(BDIR)/*.packages; do \ - dir=$${file%%.packages}; \ - n=$${dir##$(BDIR)/}; \ - num=$$n; \ - dir=$(BDIR)/CD$$n; \ - cd $$dir/..; \ - opts=`cat $(BDIR)/$$n.mkisofs_opts`; \ - volid=`cat $(BDIR)/$$n.volid`; \ - relname=`echo $(DEBVERSION) | sed -e 's/[. ]//g'`; \ - rm -f $(OUT)/debian-$$relname-$(ARCH)-binary-$$n.raw; \ - if [ "$(DOJIGDO)" = "0" ]; then \ - $(MKISOFS) $(MKISOFS_OPTS) -V "$$volid" \ - -o $(OUT)/debian-$$relname-$(ARCH)-binary-$$n.raw $$opts CD$$n; \ - elif [ "$(DOJIGDO)" = "1" ]; then \ - $(MKISOFS) $(MKISOFS_OPTS) -V "$$volid" \ - -o $(OUT)/debian-$$relname-$(ARCH)-binary-$$n.raw \ - -jigdo-jigdo $(OUT)/debian-$$relname-$(ARCH)-binary-$$n.jigdo \ - -jigdo-template $(OUT)/debian-$$relname-$(ARCH)-binary-$$n.template \ - -jigdo-map Debian=$(MIRROR)/ \ - -jigdo-exclude boot$$n \ - -md5-list $(BDIR)/md5-check \ - $(JIGDO_OPTS) $$opts CD$$n; \ - elif [ "$(DOJIGDO)" = "2" ]; then \ - $(MKISOFS) $(MKISOFS_OPTS) -V "$$volid" \ - -o /dev/null -v \ - -jigdo-jigdo $(OUT)/debian-$$relname-$(ARCH)-binary-$$n.jigdo \ - -jigdo-template $(OUT)/debian-$$relname-$(ARCH)-binary-$$n.template \ - -jigdo-map Debian=$(MIRROR)/ \ - -jigdo-exclude boot$$n \ - -md5-list $(BDIR)/md5-check \ - $(JIGDO_OPTS) $$opts CD$$n; \ - fi; \ - if [ "$(DOJIGDO)" != "0" ]; then \ - $(jigdo_cleanup) $(OUT)/debian-$$relname-$(ARCH)-binary-$$n.jigdo \ - debian-$$relname-$(ARCH)-binary-$$n.iso $(BDIR)/CD$$n \ - "`echo "$(JIGDOTEMPLATEURL)" | sed -e 's|%ARCH%|$(ARCH)|g'`debian-$$relname-$(ARCH)-binary-$$n.template" \ - $(BINDISKINFOND) \ - $(JIGDOFALLBACKURLS) ; \ - fi; \ - done + $(make_image) $(BDIR) $(ARCH) $(OUT) $(DOJIGDO) $(DEBVERSION) $(MIRROR) $(MKISOFS) $(MKISOFS_OPTS) $(JIGDO_OPTS) $(JIGDO_CLEANUP) src-images: ok src-md5list $(OUT) - @echo "Generating the source iso/jigdo images ..." - $(Q)set -e; \ - for file in $(SDIR)/*.sources; do \ - dir=$${file%%.sources}; \ - n=$${dir##$(SDIR)/}; \ - num=$$n; \ - dir=$(SDIR)/CD$$n; \ - cd $$dir/..; \ - opts=`cat $(SDIR)/$$n.mkisofs_opts`; \ - volid=`cat $(SDIR)/$$n.volid`; \ - relname=`echo $(DEBVERSION) | sed -e 's/[. ]//g'`; \ - rm -f $(OUT)/debian-$$relname-source-$$n.raw; \ - if [ "$(DOJIGDO)" = "0" ]; then \ - $(MKISOFS) $(MKISOFS_OPTS) -V "$$volid" \ - -o $(OUT)/debian-$$relname-source-$$n.raw $$opts CD$$n ; \ - elif [ "$(DOJIGDO)" = "1" ]; then \ - $(MKISOFS) $(MKISOFS_OPTS) -V "$$volid" \ - -o $(OUT)/debian-$$relname-source-$$n.raw \ - -jigdo-jigdo $(OUT)/debian-$$relname-source-$$n.jigdo \ - -jigdo-template $(OUT)/debian-$$relname-source-$$n.template \ - -jigdo-map Debian=$(MIRROR)/ \ - -md5-list $(SDIR)/md5-check \ - $(JIGDO_OPTS) $$opts CD$$n ; \ - elif [ "$(DOJIGDO)" = "2" ]; then \ - $(MKISOFS) $(MKISOFS_OPTS) -V "$$volid" \ - -o /dev/null \ - -jigdo-jigdo $(OUT)/debian-$$relname-source-$$n.jigdo \ - -jigdo-template $(OUT)/debian-$$relname-source-$$n.template \ - -jigdo-map Debian=$(MIRROR)/ \ - -md5-list $(SDIR)/md5-check \ - $(JIGDO_OPTS) $$opts CD$$n ; \ - fi; \ - if [ "$(DOJIGDO)" != "0" ]; then \ - $(jigdo_cleanup) $(OUT)/debian-$$relname-source-$$n.jigdo \ - debian-$$relname-source-$$n.iso $(SDIR)/CD$$n \ - "`echo "$(JIGDOTEMPLATEURL)" | sed -e 's|%ARCH%|source|g'`debian-$$relname-source-$$n.template" \ - $(SRCDISKINFOND) \ - $(JIGDOFALLBACKURLS) ; \ - fi; \ - done + $(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) # Generate only one image number $(CD) image: bin-image -bin-image: ok bin-md5list $(OUT) - @echo "Generating the binary iso image n°$(CD) ..." - @test -n "$(CD)" || (echo "Give me a CD= parameter !" && false) - set -e; cd $(BDIR); opts=`cat $(CD).mkisofs_opts`; \ - volid=`cat $(CD).volid`; \ - relname=`echo $(DEBVERSION) | sed -e 's/[. ]//g'`; \ - rm -f $(OUT)/debian-$$relname-$(ARCH)-binary-$(CD).raw; \ - $(MKISOFS) $(MKISOFS_OPTS) -V "$$volid" \ - -o $(OUT)/debian-$$relname-$(ARCH)-binary-$(CD).raw $$opts CD$(CD); \ - if [ -f $(BASEDIR)/tools/boot/$(DI_CODENAME)/post-boot-$(ARCH) ]; then \ - $(BASEDIR)/tools/boot/$(DI_CODENAME)/post-boot-$(ARCH) $(CD) $(BDIR)/CD$(CD) \ - $(OUT)/debian-$$relname-$(ARCH)-binary-$(CD).raw; \ - fi - -src-image: ok src-md5list $(OUT) - @echo "Generating the source iso image n°$(CD) ..." - @test -n "$(CD)" || (echo "Give me a CD= parameter !" && false) - set -e; cd $(SDIR); opts=`cat $(CD).mkisofs_opts`; \ - volid=`cat $(CD).volid`; \ - relname=`echo $(DEBVERSION) | sed -e 's/[. ]//g'`; \ - rm -f $(OUT)/debian-$$relname-source-$(CD).raw; \ - $(MKISOFS) $(MKISOFS_OPTS) -V "$$volid" \ - -o $(OUT)/debian-$$relname-source-$(CD).raw $$opts CD$(CD) - +bin-image: check-number-given bin-images +src-image: check-number-given src-images #Calculate the md5sums for the images (if available), or get from templates imagesums: diff --git a/debian/changelog b/debian/changelog index d5e90bd7..fd1fb9ed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -80,8 +80,10 @@ debian-cd (2.2.24) UNRELEASED; urgency=low [ Steve McIntyre ] * Merged in MAJOR changes for jigdo creation - the long-separated JTE patch. + * Split out the actual ISO/jigdo creation code from the Makefile into + tools/make_image - -- Joey Hess Wed, 7 Dec 2005 00:26:04 +0000 + -- Joey Hess Thu, 8 Dec 2005 22:53:16 +0000 debian-cd (2.2.23) unstable; urgency=low diff --git a/tools/make_image b/tools/make_image new file mode 100755 index 00000000..4e9a2b3d --- /dev/null +++ b/tools/make_image @@ -0,0 +1,90 @@ +#!/bin/sh +# +# Debian-cd helper script for making ISO / jigdo images +# +# Split out from the top-level Makefile SAM 2005/12/08 + +set -e + +DIR=$1 +ARCH=$2 +OUT=$3 +DOJIGDO=$4 +DEBVERSION=$5 +MIRROR=$6 +MKISOFS=$7 +MKISOFS_OPTS=$8 +JIGDO_OPTS=$9 +JIGDO_CLEANUP=$10 + +if [ "$CD"x = ""x ] ; then + echo "Generating the $ARCH iso/jigdo images ..." + FILES=$DIR/*.volid +else + echo "Generating $ARCH iso/jigdo image number $CD ..." + FILES=$DIR/$CD.volid +fi + +for file in $FILES +do + dir=${file%%.volid} + n=${dir##$DIR/} + num=$n + dir=$DIR/CD$n + + cd $dir/.. + + opts=`cat $DIR/$n.mkisofs_opts` + volid=`cat $DIR/$n.volid` + relname=`echo $DEBVERSION | sed -e 's/[. ]//g'` + + if [ $ARCH = "source" ] ; then + OUTFILE="debian-$relname-$ARCH-$n" + else + OUTFILE="debian-$relname-$ARCH-binary-$n" + fi + + # Clean up any old files + rm -f $OUT/$OUTFILE.raw $OUT/$OUTFILE.jigdo $OUT/$OUTFILE.template + + # Actually make the ISO/jigdo images. Long command lines + # here... :-( + case $DOJIGDO in + + 0) # No jigdo files, just straight ISO + $MKISOFS $MKISOFS_OPTS -V "$volid" -o $OUT/$OUTFILE.raw $opts CD$n + ;; + + + 1) # jigdo files _and_ ISO + $MKISOFS $MKISOFS_OPTS -V "$volid" \ + -o $OUT/$OUTFILE.raw \ + -jigdo-jigdo $OUT/$OUTFILE.jigdo + -jigdo-template $OUT/$OUTFILE.template + -jigdo-map Debian=$MIRROR/ \ + -jigdo-exclude boot$n \ + -md5-list $DIR/md5-check \ + $JIGDO_OPTS $opts CD$n + ;; + + 2) # jigdo only, no ISO + $MKISOFS $MKISOFS_OPTS -V "$volid" \ + -o /dev/null -v \ + -jigdo-jigdo $OUT/$OUTFILE.jigdo \ + -jigdo-template $OUT/$OUTFILE.template \ + -jigdo-map Debian=$MIRROR/ \ + -jigdo-exclude boot$n \ + -md5-list $DIR/md5-check \ + $JIGDO_OPTS $opts CD$n + ;; + esac + + # If we've made jigdo files, tweak them with extra info now + if [ "$DOJIGDO" != "0" ] ; then + $JIGDO_CLEANUP $OUT/$OUTFILE.jigdo \ + $OUTFILE.iso $DIR/CD$n \ + "`echo "$JIGDOTEMPLATEURL" | sed -e 's|%ARCH%|$ARCH|g'`$OUTFILE.template" \ + $BINDISKINFOND \ + $JIGDOFALLBACKURLS + fi +done