[PATCH 3/4] Add support for producing disks with (optional) extra variants.
This patch just adds the generic support code: * CONF.sh: Add $(VARIANTS) configuration variable. * eash-build.sh: Add command line parameter to enable variants. * Makefile: Define VARIANT_xxx when preprocessing package list. * boot/?/common.sh: Add a function for checking if a variant is enabled. * generate_di_list: Allow variant overrides in udeb exclusion list. The generate_di_list change introduces an extended syntax to the udeb exclusion lists. A line in the exclusion list may now include zero or more conditionals in the form of a positive "variant" or negative "!variant". In the positive case the relevant udeb will only be excluded if the given variant is enabled. In the negative case the relevant udeb will only be excluded if the given variant is disabled. (This seems like a double negative but I think in the context of reading the exclude list it is the least confusing was around). If multiple conditions are given then if any condition is satisfied the udeb will be excluded. The intention is to use this support to add support for installing a Xen guest from an ISO image. Thanks to Frans Pop for suggesting the approach. --- CONF.sh |3 +++ Makefile |5 - easy-build.sh|7 +-- tools/boot/squeeze/common.sh |7 +++ tools/generate_di_list | 18 +++--- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/CONF.sh b/CONF.sh index 2cf848a..d92f534 100644 --- a/CONF.sh +++ b/CONF.sh @@ -189,6 +189,9 @@ export DISKTYPE=CD # included. See tasks/README.tasksel for further info. export TASK_LANGLIST=tasksel_d-i.languages +# Extra variants to enable: +export VARIANTS= + # We don't want certain packages to take up space on CD1... #export EXCLUDE1=exclude # ...but they are okay for other CDs (UNEXCLUDEx == may be included diff --git a/Makefile b/Makefile index 1a9b377..ce8f3ec 100755 --- a/Makefile +++ b/Makefile @@ -311,9 +311,12 @@ $(BDIR)/rawlist: ARCHDEFS="$$ARCHDEFS -D ARCH_$(subst -,_,$$ARCH)"; \ ARCHUNDEFS="$$ARCHUNDEFS -U $$ARCH"; \ done; \ + for VARIANT in $(VARIANTS); do \ + VARIANTDEFS="$$VARIANTDEFS -D VARIANT_$$VARIANT)"; \ + done; \ if [ "$(SOURCEONLY)"x != "yes"x ] ; then \ cat $(TASKDIR)/$(TASK) | \ - cpp -nostdinc -nostdinc++ -P -undef $$ARCHDEFS \ + cpp -nostdinc -nostdinc++ -P -undef $$ARCHDEFS $$VARIANTDEFS\ $$ARCHUNDEFS -U i386 -U linux -U unix \ -DFORCENONUSONCD1=0 \ -I $(TASKDIR) - - >> $(BDIR)/rawlist; \ diff --git a/easy-build.sh b/easy-build.sh index d85d810..8076620 100755 --- a/easy-build.sh +++ b/easy-build.sh @@ -6,7 +6,7 @@ set -e ## See also CONF.sh for the meaning of variables used here. show_usage() { - echo "Usage: $(basename $0) [-d gnome|kde|lxde|xfce|light|all] BC|NETINST|CD|DVD [ ...]" + echo "Usage: $(basename $0) [-d gnome|kde|lxde|xfce|light|all] [-v VARIANTS] BC|NETINST|CD|DVD [ ...]" } @@ -25,7 +25,8 @@ if [ $# -eq 0 ]; then fi desktop= -while getopts d:h OPT ; do +VARIANTS= +while getopts d:hV: OPT ; do case $OPT in d) case $OPTARG in @@ -38,11 +39,13 @@ while getopts d:h OPT ; do exit 1 ;; esac ;; + V) VARIANTS="$VARIANTS $OPTARG" ;; h) show_usage; exit 1;; esac done shift $(expr $OPTIND - 1) +export VARIANTS export DISKTYPE="$1" shift diff --git a/tools/boot/squeeze/common.sh b/tools/boot/squeeze/common.sh index 7735837..d3ccc00 100644 --- a/tools/boot/squeeze/common.sh +++ b/tools/boot/squeeze/common.sh @@ -48,3 +48,10 @@ add_mkisofs_opt() { echo -n "$NEW_OPT " >> $OPTS_FILE fi } + +variant_enabled() { +VARIANT=$1 + +echo ${VARIANTS} | grep -qw "${VARIANT}" +return $? +} diff --git a/tools/generate_di_list b/tools/generate_di_list index f148d62..8ee7349 100755 --- a/tools/generate_di_list +++ b/tools/generate_di_list @@ -18,6 +18,8 @@ if ( $ENV{ARCHES} ) { } @ARCHES = qw{i386 amd64} unless @ARCHES; +...@variants = split(" ", $ENV{VARIANTS}); + my $DATE=`date`; chomp $DATE; open(OUT, ">debian-installer") || die "write: $!"; @@ -78,9 +80,19 @@ sub read_exclude { chomp; s/^#.*//; next unless length; - $_=quotemeta($_); - $_=~s/\\\*/.*/g; - push @ret, $_; + my ($pkg,@cond) = split(" ", $_); + my $skip = 0; + foreach my $cond ( @cond ) { + if ($cond =~ /^!(.*)/) { + $skip = 1 if grep { $_ eq $1 } @VARIANTS; + } else { + $skip = 1 unless grep { $_ eq $cond } @VARIANTS; + } + } + next if
Re: [PATCH 3/4] Add support for producing disks with (optional) extra variants.
(No need to CC me on replies.) On Friday 07 August 2009, Ian Campbell wrote: > show_usage() { > - echo "Usage: $(basename $0) [-d gnome|kde|lxde|xfce|light|all] > BC|NETINST|CD|DVD [ ...]" > + echo "Usage: $(basename $0) [-d gnome|kde|lxde|xfce|light|all] [-v > VARIANTS] BC|NETINST|CD|DVD [ ...]" } This line is getting too long now. Suggest changing it to: echo "Usage: $(basename $0) [OPTIONS] BC|NETINST|CD|DVD [ ...]" echo " Options:" echo " -d gnome|kde|lxde|xfce|light|all : desktop variant (task) to use" echo " -v : ..." echo " -h help" > @@ -25,7 +25,8 @@ if [ $# -eq 0 ]; then > fi > > desktop= > -while getopts d:h OPT ; do > +VARIANTS= > +while getopts d:hV: OPT ; do Why capital V instead of lower case v as shown in usage? > case $OPT in > d) > case $OPTARG in > @@ -38,11 +39,13 @@ while getopts d:h OPT ; do > exit 1 > ;; > esac ;; > + V) VARIANTS="$VARIANTS $OPTARG" ;; Idem.
Re: [PATCH 3/4] Add support for producing disks with (optional) extra variants.
On Friday 07 August 2009, Ian Campbell wrote: > This patch just adds the generic support code: > * CONF.sh: Add $(VARIANTS) configuration variable. > * eash-build.sh: Add command line parameter to enable variants. > * Makefile: Define VARIANT_xxx when preprocessing package list. >* boot/?/common.sh: Add a function for checking if a variant is enabled. >* generate_di_list: Allow variant overrides in udeb exclusion list. It would be nice to have the variants functionality documented a bit, especially as it adds syntax extentions in various existing files. Given the already fragmented state of the documentation, a separate document in the docs directory probably makes most sense. -- To UNSUBSCRIBE, email to debian-cd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Re: [PATCH 3/4] Add support for producing disks with (optional) extra variants.
On Fri, 2009-08-07 at 16:08 +0200, Frans Pop wrote: > (No need to CC me on replies.) Sorry about that. > On Friday 07 August 2009, Ian Campbell wrote: > > show_usage() { > > - echo "Usage: $(basename $0) [-d gnome|kde|lxde|xfce|light|all] > > BC|NETINST|CD|DVD [ ...]" > > + echo "Usage: $(basename $0) [-d gnome|kde|lxde|xfce|light|all] [-v > > VARIANTS] BC|NETINST|CD|DVD [ ...]" } > > This line is getting too long now. Suggest changing it to: > echo "Usage: $(basename $0) [OPTIONS] BC|NETINST|CD|DVD [ ...]" > echo " Options:" > echo " -d gnome|kde|lxde|xfce|light|all : desktop variant (task) to use" > echo " -v : ..." > echo " -h help" ACK. > > @@ -25,7 +25,8 @@ if [ $# -eq 0 ]; then > > fi > > > > desktop= > > -while getopts d:h OPT ; do > > +VARIANTS= > > +while getopts d:hV: OPT ; do > > Why capital V instead of lower case v as shown in usage? I started with one and changed my mind to use the other. I think I intended to switch completely to -V in order to leave -v free for the more common use of "verbose" if that ever became useful or necessary (maybe unlikely). Since fixing up the usage spans multiple patches I'll repost the entire series with all the feedback so far. Ian. -- Ian Campbell Marriage is the waste-paper basket of the emotions. -- To UNSUBSCRIBE, email to debian-cd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Re: [PATCH 3/4] Add support for producing disks with (optional) extra variants.
On Fri, 2009-08-07 at 16:13 +0200, Frans Pop wrote: > On Friday 07 August 2009, Ian Campbell wrote: > > This patch just adds the generic support code: > >* CONF.sh: Add $(VARIANTS) configuration variable. > >* eash-build.sh: Add command line parameter to enable variants. > >* Makefile: Define VARIANT_xxx when preprocessing package list. > >* boot/?/common.sh: Add a function for checking if a variant is enabled. > >* generate_di_list: Allow variant overrides in udeb exclusion list. > > It would be nice to have the variants functionality documented a bit, > especially as it adds syntax extentions in various existing files. Sure. > Given the already fragmented state of the documentation, a separate > document in the docs directory probably makes most sense. Do I need to html it up and wire it into the existing documents? Looks like that stuff is very incomplete, a bunch of the links are dead and a variants chapter doesn't really seem to fit in anywhere in the existing narrative (such as it is), would a simple standalone text document to acceptable? Ian. -- Ian Campbell Current Noise: Black Label Society - Genocide Junkies That wouldn't be good enough. -- Larry Wall in <199710131621.jaa14...@wall.org> -- To UNSUBSCRIBE, email to debian-cd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Re: [PATCH 3/4] Add support for producing disks with (optional) extra variants.
On Friday 07 August 2009, Ian Campbell wrote: > On Fri, 2009-08-07 at 16:13 +0200, Frans Pop wrote: > > On Friday 07 August 2009, Ian Campbell wrote: > > > This patch just adds the generic support code: > > >* CONF.sh: Add $(VARIANTS) configuration variable. > > >* eash-build.sh: Add command line parameter to enable > > > variants. * Makefile: Define VARIANT_xxx when > > > preprocessing package list. * boot/?/common.sh: Add a function for > > > checking if a variant is enabled. * generate_di_list: Allow > > > variant overrides in udeb exclusion list. > > > > It would be nice to have the variants functionality documented a bit, > > especially as it adds syntax extentions in various existing files. > > Sure. > > > Given the already fragmented state of the documentation, a separate > > document in the docs directory probably makes most sense. > > Do I need to html it up and wire it into the existing documents? Looks > like that stuff is very incomplete, a bunch of the links are dead and a > variants chapter doesn't really seem to fit in anywhere in the existing > narrative (such as it is), would a simple standalone text document to > acceptable? Eh, that's why I wrote "a separate document in the docs directory" :-) I'd suggest a simple 'README.variants' text document. I'd also suggest adding a reference to that doc in the CONF.sh instead of the example, and documenting the supported variants in the README. -- To UNSUBSCRIBE, email to debian-cd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org