[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#489516: Handle arbitrary components



tags 489156 patch
thanks

I'm re-submitting a patch I wrote a year ago, but that I never managed to submit to the bug itself. This patch is therefore outdated, but I would like some feedback before I bring the patch up to date for the latest version of debian-cd, as I feel that the interface I came up with might be a bit clunky. It also includes some cleanups, that arguably don't belong with this patch.

Here is the original message I sent, back in Apr 2010:

I finally have a patch that provides the functionality described by bug 489516. I want to post it here before I post it to the actual bug, to get some peer review, because admittedly, it does a few things beyond *just* solving the bug. Most notably, it "strictifies" most of the perl scripts (at least the ones I had to touch/debug in the process of solving this bug), and adds some (optional) debugging output in one or two places, as well. I don't know if changes like that are best done independently of adding features like this or not... So if I need to strip some of that out, I can, and submit it separately. In a nutshell, this bug changes the functionality of the LOCAL (and related) variable... (while retaining backward compatibility). It introduces a new variable called $EXTRA, which can take the place of $LOCAL and $LOCALDEBS. The $EXTRA variable may contain simply a list of additional sections to include with an optional path to that section following the section name. (I'm a little concerned this may be confusing--so if I need to rework this, I suppose I can do that, too... but I'm not sure how else to do it more elegantly for N sections).
Examples:

export EXTRA="foo /var/ftp/local bar /home/someone/debian-files"

This supports two additional sections, 'foo' and 'bar', located in /var/ftp/local and /home/someone/debian-files, respectively.
By eliminating a path, the previous path is assumed:

export EXTRA="foo /var/ftp/local bar baz qux"

This adds four new sections, 'foo', 'bar', 'baz', and 'qux', all located under /var/ftp/local With no path specified at all, the default $MIRROR location is used. Additionally, $LOCAL and $LOCALDEBS are appended to $EXTRA, and in effect $MIRROR and $CONTRIB, and related variables, affect prependage to the $EXTRA variable....
So in other words, the following config:

export MIRROR=/srv/mirror/debian
export CONTRIB=1
export LOCAL=1
export LOCALDEBS=/home/joey/debian/va/debian
export EXTRA="foo bar baz"

Would get turned into:

EXTRA="main /srv/mirror/debian contrib foo bar baz local /home/joey/debian/va/debian" I then have code to handle this string appropriately for both perl and bash, and modified the
rest of the code to use this system when searching for packages, etc.

I cannot say I have tested every corner case... but I have tested for my own needs, which were pretty straight forward; just adding two additional components, that are physically in the same tree as 'main' from Debian lenny, and required only a trivial configuration change:
export EXTRA="core free"

I look forward to any feedback or suggestions anyone has!


diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/CONF.sh debian-cd/CONF.sh
--- debian-cd-3.1.3/CONF.sh     2010-02-21 15:40:25.000000000 -0600
+++ debian-cd/CONF.sh   2010-04-01 12:07:45.000000000 -0500
@@ -18,6 +18,7 @@
 unset EXTRANONFREE      || true
 unset LOCAL             || true
 unset LOCALDEBS         || true
+unset EXTRA             || true
 unset SECURITY          || true
 unset PROPOSED_UPDATES  || true
 unset BOOTDIR           || true
@@ -138,6 +139,15 @@
 # containing dists/$CODENAME/local/binary-$ARCH
 # export LOCALDEBS=/home/joey/debian/va/debian

+# If you have additional components you wish to include, this is the place.
+# An arbitrary number of additional components and paths can be specified in
+# the EXTRA variable, separated by whitespace.  Words with at least one
+# slash (/) character in them are considered to be paths, all else are
+# considered to be section names.  If you do not specify a path for a given
+# section name, the script will assume the last specified path.
+
+#export EXTRA="multiverse /var/ftp/mirrors/ubuntu/pool universe"
+
 # Where to find the security patches.  This directory should be the
 # top directory of a security.debian.org mirror.
 #export SECURITY="$TOPDIR"/debian/debian-security
@@ -419,3 +429,35 @@
 # The disc_end hook. This will be called *right* at the end of the
 # image-making process in make_disc_trees.pl.
 #export DISC_END_HOOK=/bin/true
+
+# For legacy support; if $LOCAL is set, prepend the 'local' component to the EXTRA variable
+if [ "$LOCAL" ]; then
+    EXTRA="local $LOCALDEBS $EXTRA";
+fi
+
+if [ "$EXTRA" ]; then
+    COMPS="";
+    PATHS="";
+    path=$MIRROR
+    comp=""
+    for x in $EXTRA; do
+        if [ "$comp" ]; then
+            case $x in */*) path=$x;; esac
+            COMPS="$COMPS $comp"
+            PATHS="$PATHS $path"
+            let count=$count+1
+            comp=""
+            if [ "$path" != "$x" ]; then
+                comp=$x;
+            fi
+        else
+            comp=$x
+        fi
+    done
+    if [ "$comp" ]; then
+        COMPS="$COMPS $comp"
+        PATHS="$PATHS $path"
+    fi
+    export COMPS
+    export PATHS
+fi
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/debian/CONF.sh debian-cd/debian/CONF.sh
--- debian-cd-3.1.3/debian/CONF.sh      2010-02-21 15:40:25.000000000 -0600
+++ debian-cd/debian/CONF.sh    1969-12-31 18:00:00.000000000 -0600
@@ -1,421 +0,0 @@
-#
-# This file will have to be sourced where needed
-
-# To prevent sourcing this file twice when using scripts to build CD images,
-# use the following code at the top of your script:
-#    CF=CONF.sh
-#    . $CF
-#    export DEBIAN_CD_CONF_SOURCED=true
-
-# Allow to prevent double sourcing of this file
-if [ "$DEBIAN_CD_CONF_SOURCED" = true ]; then
-       return 0
-fi
-
-# Unset all optional variables first to start from a clean state
-unset NONFREE           || true
-unset CONTRIB           || true
-unset EXTRANONFREE      || true
-unset LOCAL             || true
-unset LOCALDEBS         || true
-unset SECURITY          || true
-unset PROPOSED_UPDATES  || true
-unset BOOTDIR           || true
-unset SYMLINK           || true
-unset COPYLINK          || true
-unset MKISOFS           || true
-unset MKISOFS_OPTS      || true
-unset ISOLINUX          || true
-unset EXCLUDE           || true
-unset NORECOMMENDS      || true
-unset NOSUGGESTS        || true
-unset IMAGESUMS         || true
-unset JIGDOTEMPLATEURL  || true
-unset JIGDOFALLBACKURLS || true
-unset JIGDOINCLUDEURLS  || true
-unset JIGDOSCRIPT       || true
-unset JIGDO_OPTS        || true
-unset PUBLISH_URL       || true
-unset PUBLISH_PATH      || true
-unset UDEB_INCLUDE      || true
-unset UDEB_EXCLUDE      || true
-unset BASE_INCLUDE      || true
-unset BASE_EXCLUDE      || true
-unset INSTALLER_CD      || true
-unset MAXCDS            || true
-unset MAXISOS           || true
-unset MAXJIGDOS         || true
-unset SPLASHPNG         || true
-unset OMIT_MANUAL       || true
-unset OMIT_RELEASE_NOTES || true
-unset OMIT_DOC_TOOLS     || true
-unset MAX_PKG_SIZE       || true
-
-# The debian-cd dir
-# Where I am (hoping I'm in the debian-cd dir)
-export BASEDIR=`pwd`
-
-# Name of the distribution for the image filename (Defaults to 'debian')
-# export CDNAME=debian
-
-# Building squeeze cd set ...
-export CODENAME=squeeze
-
-# By default use Debian installer packages from $CODENAME
-if [ -z "$DI_CODENAME" ]; then
-       export DI_CODENAME=$CODENAME
-fi
-
-# If set, controls where the d-i components are downloaded from.
-# This may be an url, or "default", which will make it use the default url
-# for the daily d-i builds. If not set, uses the official d-i images from
-# the Debian mirror.
-#export DI_WWW_HOME=default
-
-# Version number, "2.2 r0", "2.2 r1" etc.
-export DEBVERSION="6.0"
-
-# Official or non-official set.
-# NOTE: THE "OFFICIAL" DESIGNATION IS ONLY ALLOWED FOR IMAGES AVAILABLE
-# ON THE OFFICIAL DEBIAN CD WEBSITE http://cdimage.debian.org
-export OFFICIAL="Unofficial"
-#export OFFICIAL="Official"
-#export OFFICIAL="Official Beta"
-
-# ... for arch
-if [ -z "$ARCHES" ]; then
-       CPU=`dpkg-architecture -qDEB_HOST_DPKG_CPU 2>/dev/null || true`
-       if [ -z "$CPU" ]; then
-               CPU=`dpkg-architecture -qDEB_HOST_ARCH`
-       fi
-       KERNEL=`dpkg-architecture -qDEB_HOST_DPKG_OS 2>/dev/null || true`
-       if [ -z "$KERNEL" ]; then
-               KERNEL=linux
-       fi
-       if [ $KERNEL = linux ] ; then
-               ARCHES=$CPU
-       else
-               ARCHES="$KERNEL-$CPU"
-       fi
-       export ARCHES
-fi
-
-# IMPORTANT : The 4 following paths must be on the same partition/device.
-#            If they aren't then you must set COPYLINK below to 1. This
-#            takes a lot of extra room to create the sandbox for the ISO
-#            images, however. Also, if you are using an NFS partition for
-#            some part of this, you must use this option.
-# Paths to the mirrors
-export MIRROR=/srv/mirror/debian
-
-# Path of the temporary directory
-export TDIR=/srv/mirror/tmp
-
-# Path where the images will be written
-export OUT=/srv/mirror/debian-cd-test
-
-# Where we keep the temporary apt stuff.
-# This cannot reside on an NFS mount.
-export APTTMP=/srv/mirror/tmp/apt
-
-# Do I want to have NONFREE merged in the CD set
-# export NONFREE=1
-
-# Do I want to have CONTRIB merged in the CD set
-export CONTRIB=1
-
-# Do I want to have NONFREE on a separate CD (the last CD of the CD set)
-# WARNING: Don't use NONFREE and EXTRANONFREE at the same time !
-# export EXTRANONFREE=1
-
-# If you have a $MIRROR/dists/$CODENAME/local/binary-$ARCH dir with
-# local packages that you want to put on the CD set then
-# uncomment the following line
-# export LOCAL=1
-
-# If your local packages are not under $MIRROR, but somewhere else,
-# you can uncomment this line and edit to to point to a directory
-# containing dists/$CODENAME/local/binary-$ARCH
-# export LOCALDEBS=/home/joey/debian/va/debian
-
-# Where to find the security patches.  This directory should be the
-# top directory of a security.debian.org mirror.
-#export SECURITY="$TOPDIR"/debian/debian-security
-
-# Include proposed updates
-# Note that on the CDs it will not be visible where packages came from:
-# from the released archive or from proposed updates archive.
-# NOTE: intended to be used for pre-release testing, not for publication!
-#export PROPOSED_UPDATES=$CODENAME-proposed-updates
-
-# Sparc only : bootdir (location of cd.b and second.b)
-# export BOOTDIR=/boot
-
-# Symlink farmers should uncomment this line :
-# export SYMLINK=1
-
-# Use this to force copying the files instead of symlinking or hardlinking
-# them. This is useful if your destination directories are on a different
-# partition than your source files.
-# export COPYLINK=1
-
-# Options
-# export MKISOFS=mkisofs
-# export MKISOFS_OPTS="-r"             #For normal users
-# export MKISOFS_OPTS="-r -F ."        #For symlink farmers
-
-# ISOLinux support for multiboot on CD1 for i386
-export ISOLINUX=1
-
-# uncomment this to if you want to see more of what the Makefile is doing
-#export VERBOSE_MAKE=1
-
-# The maximum size allowed for an individual package, in bytes; if
-# larger than this, it will be excluded (and all dependents, of
-# course). We'll create a README.excluded in the root of CD1 listing
-# them too
-export MAX_PKG_SIZE=600000000
-
-# uncoment this to make build_all.sh try to build a simple CD image if
-# the proper official CD run does not work
-ATTEMPT_FALLBACK=yes
-
-# Set your disk type here. Known types are:
-# BC (businesscard): 650 MiB max (should be limited elsewhere,
-#                    should never fill a CD anyway)
-# NETINST:           650 MiB max (ditto)
-# CD:                standard 74-min CD (650 MiB)
-# CD700:             (semi-)standard 80-min CD (700 MiB)
-# DVD:               standard 4.7 GB DVD
-# DLDVD:             standard 8.5 GB dual-layer DVD
-# BD:                standard 25 GB blu-ray
-# DLBD:              standard 50 GB dual-layer blu-ray
-# CUSTOM:            up to you - specify a size to go with it (in 2K blocks)
-export DISKTYPE=CD
-#export DISKTYPE=CUSTOM
-#export CUSTOMSIZE=XXXX
-
-# List of languages for which language tasks from tasksel should be
-# included. See tasks/README.tasksel for further info.
-export TASK_LANGLIST=tasksel_d-i.languages
-
-# Extra variants to enable. See docs/README.variants for more information.
-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
-# on CD x if not already covered)
-#export UNEXCLUDE2=unexclude-CD2
-# Any packages listed in EXCLUDEx but not in any UNEXCLUDE will be
-# excluded completely. The same goes for packages listed in EXCLUDE.
-
-# Set this if the recommended packages should be skipped when adding
-# package on the CD.  The default is 'false'.
-export NORECOMMENDS=1
-
-# Set this if the suggested packages should be skipped when adding
-# package on the CD.  The default is 'true'.
-#export NOSUGGESTS=1
-
-# Set to 1 to generate MD5 and SHA1 sums for generated images
-export IMAGESUMS=1
-
-# We may have to extract files from packages to put them onto the CD
-# (e.g. bootloader files). If you make those packages (and their
-# sources) available somewhere, list it here so that README.source
-# can point to it
-export ARCHIVE_EXTRACTED_SOURCES="http://cdimage.debian.org/cdimage/cd-sources/";;
-
-# Produce iso/jigdo files: specify how many iso/jigdo files should be
-# produced in your set. If not set or when the value is "ALL" they will
-# be created for all images. One of the variables can be set to zero if
-# either iso or jigdo files are not wanted.
-# Replaces the old "DOJIGDO" setting with something much more flexible.
-#export MAXISOS=0
-#export MAXJIGDOS=0
-
-# HTTP/FTP URL for directory where you intend to make the templates
-# available. You should not need to change this; the default value ""
-# means "template in same dir as the .jigdo file", which is usually
-# correct. If it is non-empty, it needs a trailing slash. "%ARCH%"
-# will be substituted by the current architecture.
-#export JIGDOTEMPLATEURL=""
-#
-# Name of a directory on disc to create data for a fallback server in.
-# Should later be made available by you at the URL given in
-# JIGDOFALLBACKURLS. In the directory, two subdirs named "Debian" and
-# "Non-US" will be created, and filled with hard links to the actual
-# files in your FTP archive. Because of the hard links, the dir must
-# be on the same partition as the FTP archive! If unset, no fallback
-# data is created, which may cause problems - see README.
-#export JIGDOFALLBACKPATH="$(OUT)/snapshot/"
-#
-# Space-separated list of label->URL mappings for "jigdo fallback
-# server(s)" to add to .jigdo file. If unset, no fallback URL is
-# added, which may cause problems - see README.
-#export JIGDOFALLBACKURLS="Debian=http://myserver/snapshot/Debian/ Non-US=http://myserver/snapshot/Non-US/";;
-#
-# Space-separated list of "include URLs" to add to the .jigdo file.
-# The included files are used to provide an up-to-date list of Debian
-# mirrors to the jigdo _GUI_application_ (_jigdo-lite_ doesn't support
-# "[Include ...]").
-export JIGDOINCLUDEURLS="http://cdimage.debian.org/debian-cd/debian-servers.jigdo";;
-#
-# $JIGDOTEMPLATEURL and $JIGDOINCLUDEURLS are passed to
-# "tools/jigdo_header", which is used by default to generate the
-# [Image] and [Servers] sections of the .jigdo file. You can provide
-# your own script if you need the .jigdo file to contain different
-# data.
-#export JIGDOSCRIPT="myscript"
-
-# A couple of things used only by publish_cds, so it can tweak the
-# jigdo files, and knows where to put the results.
-# You need to run publish_cds manually, it is not run by the Makefile.
-export PUBLISH_URL="http://cdimage.debian.org/jigdo-area";;
-export PUBLISH_PATH="/home/jigdo-area/"
-
-# Specify files and directories to *exclude* from jigdo processing. These
-# files on each CD are expected to be different to those on the mirror, or
-# are often subject to change. Any files matching entries in this list will
-# simply be placed straight into the template file.
-export JIGDO_EXCLUDE="'README*' /doc/ /md5sum.txt /.disk/ /pics/ 'Release*' 'Packages*' 'Sources*'"
-
-# Specify files that MUST match entries in the externally-supplied
-# md5-list. If they do not, the CD build process will fail; something
-# must have been corrupted. Replaces the old mirrorcheck code.
-export JIGDO_INCLUDE="/pool/"
-
-# Specify the minimum file size to consider for jigdo processing. Any files
-# smaller than this will simply be placed straight into the template file.
-export JIGDO_OPTS="-jigdo-min-file-size 0"
-
-for EXCL in $JIGDO_EXCLUDE; do
-       JIGDO_OPTS="$JIGDO_OPTS -jigdo-exclude $EXCL"
-done
-
-for INCL in $JIGDO_INCLUDE; do
-       JIGDO_OPTS="$JIGDO_OPTS -jigdo-force-md5 $INCL"
-done
-
-# File with list of packages to include when fetching modules for the
-# first stage installer (debian-installer). One package per line.
-# Lines starting with '#' are comments.  The package order is
-# important, as the packages will be installed in the given order.
-#export UDEB_INCLUDE="$BASEDIR"/data/$CODENAME/udeb_include
-
-# File with list of packages to exclude as above.
-#export UDEB_EXCLUDE="$BASEDIR"/data/$CODENAME/udeb_exclude
-
-# File with list of packages to include when running debootstrap from
-# the first stage installer (currently only supported in
-# debian-installer). One package per line.  Lines starting with '#'
-# are comments.  The package order is important, as the packages will
-# be installed in the given order.
-#export BASE_INCLUDE="$BASEDIR"/data/$CODENAME/base_include
-
-# File with list of packages to exclude as above.
-#export BASE_EXCLUDE="$BASEDIR"/data/$CODENAME/base_exclude
-
-# Only put the installer onto the cd (set NORECOMMENDS,... as well,
-# and if you're not using build.sh then also make sure you set TASK
-# appropriately here)
-# INSTALLER_CD=0: nothing special (default)
-# INSTALLER_CD=1: just add debian-installer (use TASK=debian-installer)
-# INSTALLER_CD=2: add d-i and base (use TASK=debian-installer+kernel)
-#export INSTALLER_CD=2
-#export TASK=debian-installer+kernel
-
-# Parameters to pass to kernel (or d-i) when the CD boots. Not currently
-# supported for all architectures.
-#export KERNEL_PARAMS="DEBCONF_PRIORITY=critical"
-
-# Default desktop (currently only used by win32-loader)
-#export DESKTOP=kde
-
-# If set, limits the number of images to produce. The maximum
-# value of MAXISOS and MAXJIGDOS are limited to this setting.
-#export MAXCDS=1
-
-# If set, overrides the boot picture used.
-#export SPLASHPNG="$BASEDIR/data/$CODENAME/splash-img.png"
-
-# Set to 1 to save space by omitting the installation manual.
-# If so the README will link to the manual on the web site.
-#export OMIT_MANUAL=1
-
-# Set to 1 to save space by omitting the release notes
-# If so we will link to them on the web site.
-export OMIT_RELEASE_NOTES=1
-
-# Set to 1 to not include the doc/tools directories on CD1
-# Useful to save space and avoids failures if you have a mirror
-# without those directories.
-#export OMIT_DOC_TOOLS=1
-
-# Set this to override the default location
-#export RELEASE_NOTES_LOCATION="http://www.debian.org/releases/$CODENAME";;
-
-case "$OFFICIAL" in
-    "Official")
-       export OFFICIAL_VAL=2
-       ;;
-    "Official Beta")
-       export OFFICIAL_VAL=1
-       ;;
-    *)
-       export OFFICIAL_VAL=0
-       ;;
-esac
-
-# Set this to force the Release file(s) to say "stable". Used in first
-# Etch builds to allow us to build before the archive updated
-#EARLY_BUILD_HACK=1
-
-##################################
-# LOCAL HOOK DEFINITIONS
-##################################
-#
-# Set these to point to scripts/programs to be called at various
-# points in the debian-cd image-making process. This is the ideal place
-# to customise what's on the CDs, for example to add extra files or
-# modify existing ones. Each will be called with the arguments in order:
-#
-# $TDIR (the temporary dir containing the build tree)
-# $MIRROR (the location of the mirror)
-# $DISKNUM (the image number in the set)
-# $CDDIR (the root of the temp disc tree)
-# $ARCHES (the set of architectures chosen)
-#
-# BE CAREFUL about what you do at each point: in the first couple of
-# cases, files and directories you're looking to use may not exist yet,
-# you may need to worry about adding entries into md5sum.txt yourself
-# and (in the last couple of cases) if you add any extra files you may
-# end up over-filling the disc. If you *do* need to add files at the end
-# of the process, see RESERVED_BLOCKS_HOOK below. It's strongly
-# recommended to do this kind of customisation up-front if you can, it's
-# much simpler that way!
-
-# The disc_start hook. This will be called near the beginning of the
-# start_new_disc script, just after the directory tree has been created
-# but before any files have been added
-#export DISC_START_HOOK=/bin/true
-
-# The disc_pkg hook. This will be called just after the
-# start_new_disc script has finished, just before make_disc_trees.pl
-# starts to add package files.
-#export DISC_PKG_HOOK=/bin/true
-
-# The reserved_blocks hook; if set, this script should print the
-# number of 2K blocks that need to be reserved for data to be added
-# *after* a disc tree is filled with packages.
-#export RESERVED_BLOCKS_HOOK=/bin/true
-
-# The disc_finish hook. This will be called once a disc image is full,
-# just after the last package rollback but before the last bits of
-# cleanup are done on the temp disc tree
-#export DISC_FINISH_HOOK=/bin/true
-
-# The disc_end hook. This will be called *right* at the end of the
-# image-making process in make_disc_trees.pl.
-#export DISC_END_HOOK=/bin/true
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/debian/rules debian-cd/debian/rules
--- debian-cd-3.1.3/debian/rules        2008-11-23 12:04:12.000000000 -0600
+++ debian-cd/debian/rules      2010-04-01 12:07:44.000000000 -0500
@@ -26,7 +26,7 @@
        cp -r contrib tools tasks data Makefile README README.devel build.sh \
               build_all.sh update-cd easy-build.sh README.easy-build \
               debian/debian-cd/usr/share/debian-cd/
-       cp debian/CONF.sh debian/debian-cd/etc/debian-cd/conf.sh
+       cp CONF.sh debian/debian-cd/etc/debian-cd/conf.sh
        ln -sf /etc/debian-cd/conf.sh \
                debian/debian-cd/usr/share/debian-cd/CONF.sh
        find debian/debian-cd -name '.svn' | xargs -r rm -rf
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/docs/setup.html debian-cd/docs/setup.html
--- debian-cd-3.1.3/docs/setup.html     2008-10-14 03:02:25.000000000 -0500
+++ debian-cd/docs/setup.html   2010-04-01 12:07:45.000000000 -0500
@@ -56,10 +56,11 @@
 <li><code>CONTRIB</code> - whether or not to allow packages from the contrib section onto the CDs
 <li><code>NONFREE</code> - whether or not to allow packages from the non-free section onto the CDs
 <li><code>EXTRANONFREE</code> - like <code>NONFREE</code>, but sort the non-free packages to a separate last CD instead of mixing them in
-<li><code>LOCAL</code> - if you have a local set of packages that you want to merge into your CDs, specify the location here. The location should look just like the other sections (main, contrib, non-free) with Packages files etc.
+<li><code>LOCAL</code> - if you have a local set of packages that you want to merge into your CDs, specify the location here. The location should look just like the other sections (main, contrib, non-free) with Packages files etc. <b>NOTE:</b> This option is being replaced by the <b>EXTRA</b> option mentioned below.
 <li><code>LOCALDEBS</code> - if you have set <code>LOCAL</code> above
 and the local packages are outside of the <code>MIRROR</code> tree,
-specify the local here.
+specify the local here. <b>NOTE:</b> This option is being replaced by the <b>EXTRA</b> option mentioned below.
+<li><code>EXTRA</code> - if you have a local set of packages that you want to merge into your CDs, specify the name of the section(s) here.  Each section may be followed by an optional path name.  If the path name is ommitted, the scripts will look in the previously defined path for the specified section--by default, the path used for the 'main' section.  This EXTRA option will replace <b>LOCAL</b> and <b>LOCALDEBS</b> in the future.
 <li><code>EXCLUDE</code> - specifies a file listing packages that should be omitted from consideration when laying out the CDs
 <li><code>UNEXCLUDE$N</code> - a way to re-add excluded packages back into the set, starting with CD number $N. Using <code>EXCLUDE</code> and <code>UNEXCLUDE</code> allows some finer-grained control of package placement if desired
 <li><code>DOJIGDO</code> - specify what to create: 0 means ISOs only; 1 means ISOs and jigdo files; 2 means jigdo files only
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/easy-build.sh debian-cd/easy-build.sh
--- debian-cd-3.1.3/easy-build.sh       2009-08-09 09:32:55.000000000 -0500
+++ debian-cd/easy-build.sh     2010-04-01 12:07:45.000000000 -0500
@@ -18,8 +18,7 @@
 export CF=./CONF.sh
 . $CF
 export DEBIAN_CD_CONF_SOURCED=true
-unset UPDATE_LOCAL
-
+unset UPDATE_EXTRA

 ## Parse the parameters passed to the script

@@ -97,10 +96,15 @@

 ## Other options

-# Include local packages in the build
+# Include local packages in the build -- Please use the $EXTRA variable instead now
 #export LOCAL=1
-# Automatically update the Packages file(s) for the "local" repository?
-#UPDATE_LOCAL=1
+# Automatically update the Packages file(s) for the extra repositories?
+#UPDATE_EXTRA=1
+
+# For legacy support; if $LOCAL is set, prepend the 'local' component to the EXTRA variable
+if [ "$LOCAL" ]; then
+    EXTRA="local $LOCALDEBS $EXTRA";
+fi

 # Number of CD/DVDs to build; comment out to build full set
 MAX_CDS=1
@@ -172,13 +176,13 @@
        export KERNEL_PARAMS DESKTOP
 fi

-if [ "$LOCAL" ] && [ "$UPDATE_LOCAL" ]; then
-       echo "Updating Packages files for local repository..."
-       for arch in $ARCHES; do
-               ./tools/Packages-gen $CODENAME $arch
-               ./tools/Packages-gen -i $DI_CODENAME $arch
-       done
-       echo
+if [ "$EXTRA" -a "$UPDATE_EXTRA" ]; then
+        echo "Updating Packages files for local repository..."
+        for arch in $ARCHES; do
+                ./tools/Packages-gen $CODENAME $arch
+                ./tools/Packages-gen -i $DI_CODENAME $arch
+        done
+        echo
 fi

 echo "Starting the actual debian-cd build..."
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/Makefile debian-cd/Makefile
--- debian-cd-3.1.3/Makefile    2009-08-23 06:08:30.000000000 -0500
+++ debian-cd/Makefile  2010-04-01 12:07:45.000000000 -0500
@@ -51,7 +51,6 @@
 make_image=$(BASEDIR)/tools/make_image
 merge_package_lists=$(BASEDIR)/tools/merge_package_lists
 update_popcon=$(BASEDIR)/tools/update_popcon
-update_tasks=$(BASEDIR)/tools/update_tasks
 grab_source_list=$(BASEDIR)/tools/grab_source_list
 which_deb=$(BASEDIR)/tools/which_deb

diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/README debian-cd/README
--- debian-cd-3.1.3/README      2008-12-05 08:12:36.000000000 -0600
+++ debian-cd/README    2010-04-01 12:07:45.000000000 -0500
@@ -1,7 +1,7 @@
 debian-cd
 =========

-Copyright 1999-2001 Raphaël Hertzog <hertzog@debian.org> and others,
+Copyright 1999-2001 Rapha�l Hertzog <hertzog@debian.org> and others,
 2004-2006 Steve McIntyre <steve@einval.com>
 This set of tools is licensed under the General Public License version
 2 or any later version. You can find it in
@@ -243,21 +243,18 @@
 Local packages
 ==============

-If you provide some custom made packages and you want to put them on
-Debian CD set you can do it. Simply put your packages in
-$MIRROR/dists/$CODENAME/local/binary-$ARCH/<section>.
-The organization of this sub-tree is the same than what you can find
-in the main, contrib or non-free part. You may use different section
-names if you want. Be sure to create Packages files (and Sources.gz if you
-include sources).
-
-You can also put your local packages under $MIRROR/pool/local (just a new
-facility for people who don't want packages under dists/). To include local
-packages, the LOCAL environment variable must be set to "1" while building
-the CDs.
-
-You can also set the LOCALDEBS environment variable, and it will be used
-instead of MIRROR when looking for local packages.
+If you provide some custom made packages and you want to put them on Debian
+CD set you can do it. Simply put your packages somewhere on your disk
+(ought to be the same physical partition as the rest of your mirror), and
+set the "EXTRA" environment variable to include the name of the new
+component, and the directory path where it exists, separated by spaces.
+For example, setting "EXTRA" to "foo /var/ftp/dc/local/pool" would look for
+a section 'foo' under the /var/ftp/dc/local/pool directory.
+
+You may specify an arbitrary number of extra sections by appending them to
+the "EXTRA" environment variable, separated by whitespace.  The path is
+optional, and if it is ommitted, then the previously set path (or the value
+found in "MIRROR") will be used.


 Additional targets
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/README.easy-build debian-cd/README.easy-build
--- debian-cd-3.1.3/README.easy-build   2009-08-29 10:24:30.000000000 -0500
+++ debian-cd/README.easy-build 2010-04-01 12:07:45.000000000 -0500
@@ -222,7 +222,7 @@
 from the CD during the installation.

 Whether custom debs and udebs are used is determined by the environment
-variable LOCAL. Whether custom D-I images are used is determined by
+variable EXTRA. Whether custom D-I images are used is determined by
 selecting the correct source from them, in most cases that will be by
 setting DI_DIR (see comments in easy-build.sh). Both variables can be set
 in easy-build.sh.
@@ -230,9 +230,9 @@
 Using custom packages
 ---------------------
 The repository for the custom packages has the same basic structure as an
-official mirror. The main difference is the category: instead of "main"
-(or "contrib" or "non-free") this has to be "local". You should also make
-sure to use the release codename and not the suite.
+official mirror. The main difference is the category: it may not be "main",
+"contrib", or "non-free". You should also make sure to use the release
+codename and not the suite.

 So you get for example:
 .../dists/lenny/local/binary-amd64/
@@ -250,39 +250,40 @@
 unstable), you will need to place your custom debs and udebs under different
 codenames.

-The local category does not need to have a Release file, but each
+Local categories do not need to have a Release file, but each
 'binary-<arch>' directory must have a Packages file.

 It is possible to have the packages themselves in a pool directory, but it
 is probably easier to just place them under the 'binary-<arch>' directories.
 You can group packages in subdirectories.

-By default debian-cd will look for the "local" category in the same place
-as the official mirror (as defined by the envvar MIRROR), but in most cases
-it will be simpler to specify an alternative location by setting the
-environment variable LOCALDEBS in your CONF.sh. In that case you can also
-let easy-build.sh take care of generating an updated Packages.gz file for
-each source that is used in a build by setting the envvar UPDATE_LOCAL in
-easy-build.sh (see tools/Packages-gen).
+You can control your local components with the "EXTRA" environment variable.
+Assign the name of your extra component, followed by whitespace, followed by
+the path to your extra component.  An arbitrary number of extra components
+may be specified in the same "EXTRA" environment variable; simply use white
+space to separate the component names and paths.  Additionally, the path
+value may be ommitted, in which case the most recently specified path name,
+or the official mirror (as defined by the envar MIRROR) will be used
+instead.

 Example, assuming we are building for and i386 CD for lenny:
 1) in CONF.sh, set for example:
    export MIRROR=/srv/mirror/debian
-   export LOCALDEBS=/srv/mirror/custom
+   export EXTRA="local /srv/mirror/custom"
 2) create the following directories:
    /srv/mirror/custom/dists/lenny/local/binary-i386
    /srv/mirror/custom/dists/lenny/local/debian-installer/binary-i386
 3) copy your custom debs to the first directory
 4) copy your custom udebs to the second directory
 5) in easy-build.sh, set:
-   export LOCAL=1
-   UPDATE_LOCAL=1
+   UPDATE_EXTRA=1

-Note that debian-cd will fail if you set LOCAL but the "local" directory for
-a codename/arch/section that is referenced in a build does not exist.
-You will need to create the 'dists/<codename>/local' directories, but if
-UPDATE_LOCAL is set, easy-build.sh will automatically create any missing
-'binary-<codename>' subdirectories and (empty) Packages.gz files.
+Note that debian-cd will fail if you set an EXTRA component, but the
+specified directory for a codename/arch/section that is referenced in a
+build does not exist.  You will need to create the 'dists/<codename>/local'
+directories, but if UPDATE_EXTRA is set, easy-build.sh will automatically
+create any missing 'binary-<codename>' subdirectories and (empty)
+Packages.gz files.

 Using custom debian-installer images
 ------------------------------------
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/apt-selection debian-cd/tools/apt-selection
--- debian-cd-3.1.3/tools/apt-selection 2009-08-04 16:55:03.000000000 -0500
+++ debian-cd/tools/apt-selection       2010-04-01 12:07:44.000000000 -0500
@@ -56,39 +56,37 @@
     touch "$APTTMP/$CODENAME-$ARCH/status"
 fi
 if [ ! -e "$APTTMP/$CODENAME-$ARCH/apt/sources.list" ]; then
-
        # Generating a correct sources.list file
-       echo "$ADEB file:$MIRROR $CODENAME $sections" \
-       > $APTTMP/$CODENAME-$ARCH/apt/sources.list

        if [ -n "$PROPOSED_UPDATES" ]; then
                echo "$ADEB file:$MIRROR $PROPOSED_UPDATES $sections" \
                        >> $APTTMP/$CODENAME-$ARCH/apt/sources.list
        fi

-       # Local packages ...
-       if [ -n "$LOCAL" ]; then
-               echo "$ADEB file:${LOCALDEBS:-$MIRROR} $CODENAME local" \
+       x=0;
+       echo "apt-selection COMPS='main $COMPS'"
+       echo "apt-selection PATHS='$MIRROR $PATHS'"
+       COMPSA=(main $COMPS)
+       PATHSA=($MIRROR $PATHS)
+       while [ $x -lt ${#COMPSA[*]} ]; do
+               path=${PATHSA[$x]}
+               comp=${COMPSA[$x]}
+               if [ -z "$path" ]; then path=$MIRROR; fi
+               echo "$ADEB file:$path $CODENAME $comp" \
                        >> $APTTMP/$CODENAME-$ARCH/apt/sources.list
-       fi
+              # Debian-installer
+               if [ -e "$path/dists/$DI_CODENAME/$comp/debian-installer" ]; then
+                       echo "$ADEB file:$path $DI_CODENAME $comp/debian-installer" \
+                               >> $APTTMP/$CODENAME-$ARCH/apt/sources.list
+               fi
+               let x=$x+1
+       done

        # Security mirror ...
        if [ -n "$SECURITY" ]; then
                echo "$ADEB file:${SECURITY:-$MIRROR} $CODENAME/updates $sections" \
                >> $APTTMP/$CODENAME-$ARCH/apt/sources.list
        fi
-
-       # Debian-installer
-       if [ $ARCH != source ] ; then
-               if [ -e "$MIRROR/dists/$DI_CODENAME/main/debian-installer" ]; then
-                       echo "$ADEB file:$MIRROR $DI_CODENAME main/debian-installer" \
-                               >> $APTTMP/$CODENAME-$ARCH/apt/sources.list
-               fi
-               if [ -n "$LOCAL" -a -e "${LOCALDEBS:-$MIRROR}/dists/$DI_CODENAME/local/debian-installer" ]; then
-                       echo "$ADEB file:${LOCALDEBS:-$MIRROR} $DI_CODENAME local/debian-installer" \
-                               >> $APTTMP/$CODENAME-$ARCH/apt/sources.list
-               fi
-       fi
 fi

 temp=$APTTMP/$CODENAME-$ARCH/temp.apt-selection
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/boot/etch/boot-amd64 debian-cd/tools/boot/etch/boot-amd64
--- debian-cd-3.1.3/tools/boot/etch/boot-amd64  2008-11-23 12:19:25.000000000 -0600
+++ debian-cd/tools/boot/etch/boot-amd64        2010-04-01 12:07:44.000000000 -0500
@@ -47,13 +47,28 @@

 BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinuz cdrom/debian-cd_info.tar.gz"

+copy_from_extra() {
+    "$EXTRA" || return;
+    image=$1
+    x=0;
+    while [ $x -le ${#COMPS[*]} ]; do
+        path = "${PATHS[$x]}/dists/$DI_DIST/${COMPS[$x]}/installer-$ARCH/current/images/$image"
+        if [ -f "$path" ]; then
+            cp "$path" $image;
+            return
+        fi
+        let x=$x+1
+    done
+}
+
 # Download boot images.
 for image in $BOOT_IMAGES; do
     if [ ! -e "$image" ]; then
        dir=$(dirname $image)
        mkdir -p $dir
-       if [ -n "$LOCAL"  -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
-               cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
+       copy_from_extra $image
+       if [ -f $image ]; then
+          # Do nothing
        elif [ ! "$DI_WWW_HOME" ];then
                if [ ! "$DI_DIR" ];then
                   DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/boot/etch/boot-i386 debian-cd/tools/boot/etch/boot-i386
--- debian-cd-3.1.3/tools/boot/etch/boot-i386   2008-11-23 12:19:25.000000000 -0600
+++ debian-cd/tools/boot/etch/boot-i386 2010-04-01 12:07:44.000000000 -0500
@@ -59,13 +59,28 @@
        #EXTRA_DISK_IMAGES="cdrom/boot.img"
 fi

+copy_from_extra() {
+    "$EXTRA" || return;
+    image=$1
+    x=0;
+    while [ $x -le ${#COMPS[*]} ]; do
+        path = "${PATHS[$x]}/dists/$DI_DIST/${COMPS[$x]}/installer-$ARCH/current/images/$image"
+        if [ -f "$path" ]; then
+            cp "$path" $image;
+            return
+        fi
+        let x=$x+1
+    done
+}
+
 # Download boot images and floppies.
 for image in $BOOT_IMAGES; do
     if [ ! -e "$image" ]; then
        dir=$(dirname $image)
        mkdir -p $dir
-       if [ -n "$LOCAL"  -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
-               cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
+       copy_from_extra $image
+       if [ -f "$image" ]; then
+          # Do nothing
        elif [ ! "$DI_WWW_HOME" ];then
                if [ ! "$DI_DIR" ];then
                   DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
@@ -83,8 +98,9 @@
     if [ ! -e "$image" ]; then
        dir=$(dirname $image)
        mkdir -p $dir
-       if [ -n "$LOCAL"  -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
-               cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
+       copy_from_extra $image
+       if [ -f $image ]; then
+          # Do nothing
        elif [ ! "$DI_WWW_HOME" ];then
                if [ ! "$DI_DIR" ];then
                   DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/boot/etch/boot-s390 debian-cd/tools/boot/etch/boot-s390
--- debian-cd-3.1.3/tools/boot/etch/boot-s390   2007-02-27 14:05:32.000000000 -0600
+++ debian-cd/tools/boot/etch/boot-s390 2010-04-01 12:07:44.000000000 -0500
@@ -2,7 +2,7 @@
 #
 # boot-s390 version 0.2
 #
-# (C) 2001 Jochen Röhrig <jr@debian.org>
+# (C) 2001 Jochen R�hrig <jr@debian.org>
 #     2005 Frans Pop <fjp@debian.org>
 #
 # Released under the GNU general Public License.
@@ -53,6 +53,20 @@

 images_S390="generic/parmfile.debian generic/initrd.debian generic/kernel.debian tape/kernel.debian tape/kernel.debian-nolabel"

+copy_from_extra() {
+    "$EXTRA" || return;
+    image=$1
+    x=0;
+    while [ $x -le ${#COMPS[*]} ]; do
+        path = "${PATHS[$x]}/dists/$DI_DIST/${COMPS[$x]}/installer-$ARCH/current/images/$image"
+        if [ -f "$path" ]; then
+            cp "$path" $image;
+            return
+        fi
+        let x=$x+1
+    done
+}
+
 for image in $images_S390; do
        case $image in
                generic/parmfile.debian)
@@ -68,8 +82,10 @@
        esac
        imagedest="$imagedir/$imagedest"

-       if [ -n "$LOCAL"  -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
-               cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$imagedest"
+       copy_from_extra $image
+
+       if [ -f $image ]; then
+          # Do nothing
        elif [ ! "$DI_WWW_HOME" ];then
                if [ ! "$DI_DIR" ];then
                        DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/boot/lenny/boot-s390 debian-cd/tools/boot/lenny/boot-s390
--- debian-cd-3.1.3/tools/boot/lenny/boot-s390  2009-10-11 13:12:06.000000000 -0500
+++ debian-cd/tools/boot/lenny/boot-s390        2010-04-01 12:07:44.000000000 -0500
@@ -2,7 +2,7 @@
 #
 # boot-s390 version 0.2
 #
-# (C) 2001 Jochen Röhrig <jr@debian.org>
+# (C) 2001 Jochen R�hrig <jr@debian.org>
 #     2005 Frans Pop <fjp@debian.org>
 #
 # Released under the GNU general Public License.
@@ -24,6 +24,20 @@

 cd $CDDIR/..

+copy_from_extra() {
+    "$EXTRA" || return;
+    image=$1
+    x=0;
+    while [ $x -le ${#COMPS[*]} ]; do
+        path = "${PATHS[$x]}/dists/$DI_DIST/${COMPS[$x]}/installer-$ARCH/current/images/$image"
+        if [ -f "$path" ]; then
+            cp "$path" $image;
+            return
+        fi
+        let x=$x+1
+    done
+}
+
 if [ $N != "1" ] && [ $N != "1_NONUS" ] ; then
     add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-J -joliet-long"
        exit 0
@@ -68,8 +82,9 @@
        esac
        imagedest="$imagedir/$imagedest"

-       if [ -n "$LOCAL"  -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
-               cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$imagedest"
+        copy_from_extra $image
+        if [ -f $image ]; then
+            # Do nothing
        elif [ ! "$DI_WWW_HOME" ];then
                if [ ! "$DI_DIR" ];then
                        DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/boot/lenny/boot-x86 debian-cd/tools/boot/lenny/boot-x86
--- debian-cd-3.1.3/tools/boot/lenny/boot-x86   2009-08-18 10:01:25.000000000 -0500
+++ debian-cd/tools/boot/lenny/boot-x86 2010-04-01 12:07:44.000000000 -0500
@@ -1,3 +1,4 @@
+#!/bin/sh
 # This script gets sourced from boot-i386 and boot-amd64.
 #
 # Do install stuff for x86, including making bootable CDs
@@ -68,6 +69,20 @@
        INSTALLDIR="$INSTALLDIR_amd64"
 fi

+copy_from_extra() {
+    "$EXTRA" || return;
+    image=$1
+    x=0;
+    while [ $x -le ${#COMPS[*]} ]; do
+        path = "${PATHS[$x]}/dists/$DI_DIST/${COMPS[$x]}/installer-$ARCH/current/images/$image"
+        if [ -f "$path" ]; then
+            cp "$path" $image;
+            return
+        fi
+        let x=$x+1
+    done
+}
+
 BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinuz cdrom/debian-cd_info.tar.gz"
 # Only include disk images on full CDs, not on smaller images.
 #if [ "$ARCH" = i386 ] && [ "$INSTALLER_CD" != 1 ] && [ "$INSTALLER_CD" != 2 ]; then
@@ -80,8 +95,9 @@
        if [ ! -e "$image" ]; then
                dir=$(dirname $image)
                mkdir -p $dir
-               if [ -n "$LOCAL"  -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
-                       cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
+               copy_from_extra "installer-$ARCH/current/images" $image
+               if [ -f $image ]; then
+                 #Do nothing
                elif [ ! "$DI_WWW_HOME" ];then
                        if [ ! "$DI_DIR" ];then
                                DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
@@ -99,8 +115,9 @@
        if [ ! -e "$image" ]; then
                dir=$(dirname $image)
                mkdir -p $dir
-               if [ -n "$LOCAL"  -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
-                       cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
+               copy_from_extra $image
+               if [ -f $image ]; then
+                 # Do nothing
                elif [ ! "$DI_WWW_HOME" ];then
                        if [ ! "$DI_DIR" ];then
                                DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/boot/sid/boot-s390 debian-cd/tools/boot/sid/boot-s390
--- debian-cd-3.1.3/tools/boot/sid/boot-s390    2009-10-11 13:12:06.000000000 -0500
+++ debian-cd/tools/boot/sid/boot-s390  2010-04-01 12:07:44.000000000 -0500
@@ -2,7 +2,7 @@
 #
 # boot-s390 version 0.2
 #
-# (C) 2001 Jochen Röhrig <jr@debian.org>
+# (C) 2001 Jochen R�hrig <jr@debian.org>
 #     2005 Frans Pop <fjp@debian.org>
 #
 # Released under the GNU general Public License.
@@ -53,6 +53,20 @@

 images_S390="generic/parmfile.debian generic/initrd.debian generic/kernel.debian tape/kernel.debian tape/kernel.debian-nolabel"

+copy_from_extra() {
+    "$EXTRA" || return;
+    image=$1
+    x=0;
+    while [ $x -le ${#COMPS[*]} ]; do
+        path = "${PATHS[$x]}/dists/$DI_DIST/${COMPS[$x]}/installer-$ARCH/current/images/$image"
+        if [ -f "$path" ]; then
+            cp "$path" $image;
+            return
+        fi
+        let x=$x+1
+    done
+}
+
 for image in $images_S390; do
        case $image in
                generic/parmfile.debian)
@@ -68,8 +82,9 @@
        esac
        imagedest="$imagedir/$imagedest"

-       if [ -n "$LOCAL"  -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
-               cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$imagedest"
+        copy_from_extra $image
+        if [ -f $image ]; then
+            # Do nothing
        elif [ ! "$DI_WWW_HOME" ];then
                if [ ! "$DI_DIR" ];then
                        DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/boot/sid/boot-x86 debian-cd/tools/boot/sid/boot-x86
--- debian-cd-3.1.3/tools/boot/sid/boot-x86     2009-08-18 10:01:25.000000000 -0500
+++ debian-cd/tools/boot/sid/boot-x86   2010-04-01 12:07:44.000000000 -0500
@@ -1,3 +1,4 @@
+#!/bin/sh
 # This script gets sourced from boot-i386 and boot-amd64.
 #
 # Do install stuff for x86, including making bootable CDs
@@ -68,6 +69,20 @@
        INSTALLDIR="$INSTALLDIR_amd64"
 fi

+copy_from_extra() {
+    "$EXTRA" || return;
+    image=$1
+    x=0;
+    while [ $x -le ${#COMPS[*]} ]; do
+        path = "${PATHS[$x]}/dists/$DI_DIST/${COMPS[$x]}/installer-$ARCH/current/images/$image"
+        if [ -f "$path" ]; then
+            cp "$path" $image;
+            return
+        fi
+        let x=$x+1
+    done
+}
+
 BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinuz cdrom/debian-cd_info.tar.gz"
 # Only include disk images on full CDs, not on smaller images.
 #if [ "$ARCH" = i386 ] && [ "$INSTALLER_CD" != 1 ] && [ "$INSTALLER_CD" != 2 ]; then
@@ -80,8 +95,9 @@
        if [ ! -e "$image" ]; then
                dir=$(dirname $image)
                mkdir -p $dir
-               if [ -n "$LOCAL"  -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
-                       cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
+               copy_from_extra $image
+               if [ -f $image ]; then
+                 # Do nothing
                elif [ ! "$DI_WWW_HOME" ];then
                        if [ ! "$DI_DIR" ];then
                                DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
@@ -99,8 +115,9 @@
        if [ ! -e "$image" ]; then
                dir=$(dirname $image)
                mkdir -p $dir
-               if [ -n "$LOCAL"  -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
-                       cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
+               copy_from_extra $image
+               if [ -f $image ]; then
+                 # Do nothing
                elif [ ! "$DI_WWW_HOME" ];then
                        if [ ! "$DI_DIR" ];then
                                DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/boot/squeeze/boot-s390 debian-cd/tools/boot/squeeze/boot-s390
--- debian-cd-3.1.3/tools/boot/squeeze/boot-s390        2009-10-11 13:12:06.000000000 -0500
+++ debian-cd/tools/boot/squeeze/boot-s390      2010-04-01 12:07:44.000000000 -0500
@@ -2,7 +2,7 @@
 #
 # boot-s390 version 0.2
 #
-# (C) 2001 Jochen Röhrig <jr@debian.org>
+# (C) 2001 Jochen R�hrig <jr@debian.org>
 #     2005 Frans Pop <fjp@debian.org>
 #
 # Released under the GNU general Public License.
@@ -53,6 +53,20 @@

 images_S390="generic/parmfile.debian generic/initrd.debian generic/kernel.debian tape/kernel.debian tape/kernel.debian-nolabel"

+copy_from_extra() {
+    "$EXTRA" || return;
+    image=$1
+    x=0;
+    while [ $x -le ${#COMPS[*]} ]; do
+        path = "${PATHS[$x]}/dists/$DI_DIST/${COMPS[$x]}/installer-$ARCH/current/images/$image"
+        if [ -f "$path" ]; then
+            cp "$path" $image;
+            return
+        fi
+        let x=$x+1
+    done
+}
+
 for image in $images_S390; do
        case $image in
                generic/parmfile.debian)
@@ -68,8 +82,9 @@
        esac
        imagedest="$imagedir/$imagedest"

-       if [ -n "$LOCAL"  -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
-               cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$imagedest"
+        copy_from_extra $image
+        if [ -f $image ]; then
+            # Do nothing
        elif [ ! "$DI_WWW_HOME" ];then
                if [ ! "$DI_DIR" ];then
                        DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/boot/squeeze/boot-x86 debian-cd/tools/boot/squeeze/boot-x86
--- debian-cd-3.1.3/tools/boot/squeeze/boot-x86 2009-08-18 10:01:25.000000000 -0500
+++ debian-cd/tools/boot/squeeze/boot-x86       2010-04-01 12:07:44.000000000 -0500
@@ -1,3 +1,4 @@
+#!/bin/sh
 # This script gets sourced from boot-i386 and boot-amd64.
 #
 # Do install stuff for x86, including making bootable CDs
@@ -68,6 +69,20 @@
        INSTALLDIR="$INSTALLDIR_amd64"
 fi

+copy_from_extra() {
+    "$EXTRA" || return;
+    image=$1
+    x=0;
+    while [ $x -le ${#COMPS[*]} ]; do
+        path = "${PATHS[$x]}/dists/$DI_DIST/${COMPS[$x]}/installer-$ARCH/current/images/$image"
+        if [ -f "$path" ]; then
+            cp "$path" $image;
+            return
+        fi
+        let x=$x+1
+    done
+}
+
 BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinuz cdrom/debian-cd_info.tar.gz"
 # Only include disk images on full CDs, not on smaller images.
 #if [ "$ARCH" = i386 ] && [ "$INSTALLER_CD" != 1 ] && [ "$INSTALLER_CD" != 2 ]; then
@@ -80,8 +95,9 @@
        if [ ! -e "$image" ]; then
                dir=$(dirname $image)
                mkdir -p $dir
-               if [ -n "$LOCAL"  -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
-                       cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
+               copy_from_extra $image
+               if [ -f $image ]; then
+                 # Do nothing
                elif [ ! "$DI_WWW_HOME" ];then
                        if [ ! "$DI_DIR" ];then
                                DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
@@ -99,8 +115,9 @@
        if [ ! -e "$image" ]; then
                dir=$(dirname $image)
                mkdir -p $dir
-               if [ -n "$LOCAL"  -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
-                       cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
+               copy_from_extra $image
+               if [ -f $image ]; then
+                 # Do nothing
                elif [ ! "$DI_WWW_HOME" ];then
                        if [ ! "$DI_DIR" ];then
                                DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/common.pl debian-cd/tools/common.pl
--- debian-cd-3.1.3/tools/common.pl     1969-12-31 18:00:00.000000000 -0600
+++ debian-cd/tools/common.pl   2010-04-01 12:07:44.000000000 -0500
@@ -0,0 +1,24 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+sub components {
+    my ( $mirror, $codename ) = @_;
+    $mirror ||= $ENV{MIRROR};
+    $codename ||= $ENV{CODENAME};
+    my $path = "$mirror/dists/$codename";
+    my @comp = [ 'main', $path ];
+    push @comp, [ 'contrib', $path ] if $ENV{CONTRIB};
+    push @comp, [ 'non-free', $path ] if $ENV{NONFREE};
+    if ( $ENV{EXTRA} ) {
+        my @extra = split /\s+/, $ENV{EXTRA};
+        while ( @extra ) {
+            my $comp = shift @extra;
+            $path = shift @extra if $extra[0] and $extra[0] =~ m#/#;
+            push @comp, [ $comp, $path ];
+        }
+    }
+    return @comp;
+}
+
+1;
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/generate_di_list debian-cd/tools/generate_di_list
--- debian-cd-3.1.3/tools/generate_di_list      2009-08-09 09:32:55.000000000 -0500
+++ debian-cd/tools/generate_di_list    2010-04-01 12:07:44.000000000 -0500
@@ -1,4 +1,9 @@
 #!/usr/bin/perl -w
+
+use lib "/usr/share/debian-cd/tools";
+use strict;
+require 'common.pl';
+
 # Generate a list of packages required for debian-installer
 # This script makes use of the following variables that need to be preset:
 # MIRROR, DI_CODENAME, BASEDIR
@@ -18,7 +23,7 @@
 }
 @ARCHES = qw{i386 amd64} unless @ARCHES;

-@VARIANTS = split(" ", $ENV{VARIANTS});
+my @VARIANTS = split(" ", $ENV{VARIANTS});

 my $DATE=`date`;
 chomp $DATE;
@@ -36,29 +41,24 @@
 EOF

 my @common_excludes = read_exclude("exclude-udebs");
-my $mirror_path = "$ENV{MIRROR}/dists/$ENV{DI_CODENAME}";
-my @components = qw(main);
-push @components, 'contrib' if $ENV{CONTRIB};
-push @components, 'non-free' if $ENV{NONFREE};
-push @components, 'local' if $ENV{LOCAL};
+my @components = components($ENV{MIRROR},$ENV{DI_CODENAME});

 foreach my $arch (@ARCHES) {
-       (my $cpparch = $arch) =~ s/-/_/g;
+    (my $cpparch = $arch) =~ s/-/_/g;
     my $output = '';
-    for my $component ( @components ) {
+
+    my @exclude = @common_excludes;
+    push @exclude, read_exclude("exclude-udebs-$arch")
+        if -e exclude_path("exclude-udebs-$arch");
+
+    for my $comp ( @components ) {
+        my ( $component, $mirror_path ) = @$comp;
         my $packagefile="$mirror_path/$component/debian-installer/binary-$arch/Packages.gz";
-        if ( $component eq 'local' and $ENV{LOCALDEBS} ) {
-            $packagefile="$ENV{LOCALDEBS}/dists/$ENV{DI_CODENAME}/local/debian-installer/binary-$arch/Packages.gz";
-        }
         if (! -f $packagefile) {
             print "Missing package file for $arch/$component.\n";
             next;
         }

-        my @exclude = @common_excludes;
-        push @exclude, read_exclude("exclude-udebs-$arch")
-            if -e exclude_path("exclude-udebs-$arch");
-
         foreach my $udeb (map { chomp; $_ } `zcat $packagefile | awk '/^Package:/ {print \$2}'`) {
             $output .= "$udeb\n" unless grep { $udeb =~ /^${_}$/ } @exclude;
         }
@@ -68,7 +68,7 @@
     print OUT $output;
     print OUT "#endif /* ARCH_$cpparch */\n";
 }
-
+
 sub read_exclude {
        my $file=exclude_path(shift);
     unless ( open (IN, "<$file") ) {
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/make_disc_trees.pl debian-cd/tools/make_disc_trees.pl
--- debian-cd-3.1.3/tools/make_disc_trees.pl    2010-02-21 16:38:03.000000000 -0600
+++ debian-cd/tools/make_disc_trees.pl  2010-04-01 12:07:44.000000000 -0500
@@ -3,12 +3,13 @@
 # make_disc_trees
 #
 # From the list of packages we have, lay out the CD trees
-
+use lib "/usr/share/debian-cd/tools";
 use strict;
 use Digest::MD5;
 use File::stat;
 use File::Find;
 use Compress::Zlib;
+require 'common.pl';

 my %pkginfo;
 my ($basedir, $mirror, $tdir, $codename, $archlist, $mkisofs, $maxcds,
@@ -31,13 +32,13 @@
 $mkisofs = shift;

 my $security = $ENV{'SECURITY'} || $mirror;
-my $localdebs = $ENV{'LOCALDEBS'} || $mirror;
 my $iso_blksize = 2048;
 my $log_opened = 0;
 my $old_split = $/;
 my $symlink_farm = $ENV{'SYMLINK'} || 0;
 my $link_verbose = $ENV{'VERBOSE'} || 0;
 my $link_copy = $ENV{'COPYLINK'} || 0;
+my @components = components( $mirror, $codename );

 require "$basedir/tools/link.pl";

@@ -390,32 +391,28 @@
        my $cddir = shift;
        my $ok = 0;
        my (%on_disc, %exclude);
-       my $packages_file = "$cddir/dists/$codename/main/binary-$arch/Packages";
-       my $p;
        my $db_error = 0;
        my $error_string = "";

-       open (PLIST, $packages_file)
-               || die "Can't open Packages file $packages_file : $!\n";
-       while (defined($p = <PLIST>)) {
-               chomp $p;
-               $p =~ m/^Package: (\S+)/ and $on_disc{$1} = $1;
-       }
-       close PLIST;
-
-       $packages_file = "$cddir/dists/$codename/local/binary-$arch/Packages";
-       if (open (PLIST, $packages_file)) {
-               while (defined($p = <PLIST>)) {
-                       chomp $p;
-                       $p =~ m/^Package: (\S+)/ and $on_disc{$1} = $1;
+        my @package_files;
+       opendir my $DIR, "$cddir/dists/$codename";
+       while ( my $file = readdir $DIR ) {
+               next unless -d "$cddir/dists/$codename/$file";
+               my $packages_file = "$cddir/dists/$codename/$file/binary-$arch/Packages";
+               next unless -e $packages_file;
+               open my $PLIST, $packages_file
+                       or die "Can't open Packages file $packages_file : $!\n";
+               while (defined(my $p = <$PLIST>)) {
+                       $p =~ m/^Package: (\S+)/ and $on_disc{$1} = 1;
                }
-               close PLIST;
+               close $PLIST;
        }
+       close $DIR;

        if (defined($ENV{'BASE_EXCLUDE'})) {
                open (ELIST, $ENV{'BASE_EXCLUDE'})
                        || die "Can't open base_exclude file $ENV{'BASE_EXCLUDE'} : $!\n";
-               while (defined($p = <ELIST>)) {
+               while (defined(my $p = <ELIST>)) {
                        chomp $p;
                        $exclude{$p} = $p;
                }
@@ -424,7 +421,7 @@

        open (DLIST, "debootstrap --arch $arch --print-debs $codename $tdir/debootstrap_tmp file:$mirror $debootstrap_script 2>/dev/null | tr ' ' '\n' |")
                 || die "Can't fork debootstrap : $!\n";
-       while (defined($p = <DLIST>)) {
+       while (defined(my $p = <DLIST>)) {
         if ($p =~ m/^E:/) {
             $db_error = 1;
         }
@@ -453,24 +450,6 @@
        return $ok;
 }

-# If missing, create an empty local Packages file for an architecture.
-# Only create an uncompressed Packages file; the call to recompress will
-# create the compressed version.
-sub add_missing_Packages {
-       my ($filename);
-
-       $filename = $File::Find::name;
-
-       if ((-d "$_") && ($filename =~ m/\/main\/binary-[^\/]*$/)) {
-               if ((-f "$_/Packages") && (! -d "../local/$_/")) {
-                       mkdir "../local/$_/" || die "Error creating directory local/$_: $!\n";
-                       open(LPFILE, ">../local/$_/Packages") or die "Error creating local/$_/Packages: $!\n";
-                       close LPFILE;
-                       print "  Created empty Packages file for local/$_\n";
-               }
-       }
-}
-
 sub md5_file {
        my $filename = shift;
        my ($md5, $st);
@@ -667,13 +646,22 @@

        chdir $cddir;

-       # If we have a local packages directory, ensure we have a Packages file
+       # If we have any custom components, ensure we have a Packages file
        # for all included architectures as otherwise the Release file will be
        # invalid. This can happen if we do have local udebs but no local
        # regular packages, or multiple architectures with not all of them
        # having local packages.
-       if (-d "./dists/$codename/local") {
-               find (\&add_missing_Packages, "./dists/$codename/main/");
+       for ( @components ) {
+               my $comp = $_->[0];
+               next unless -d "./dists/$codename/$comp";
+               for ( @arches ) {
+                       my $dir = "./dists/$codename/$comp/binary-$_";
+                       -d $dir or mkdir $dir or die "Error creating directory $comp/binary-$_: $!\n";
+                        next if -e "$dir/Packages";
+                        open my $p, "> $dir/Packages";
+                        close $p;
+                        print "  Created empty Packages file for $comp/binary-$_\n";
+                }
        }

        print "  Finishing off the Release file\n";
@@ -731,27 +719,35 @@
 # From a package name and section, work out the directory where its
 # corresponding Packages file should live
 sub Packages_dir {
-    my $dir = shift;
-    my $file = shift;
+    my $dir = shift; # Target directory
+    my $file = shift; # Source file
     my $section = shift;

-    my ($pdir, $dist);
+    my $component;

-    if ($file =~ /\/main\//) {
-        $dist = "main";
-    } elsif ($file =~ /\/contrib\//) {
-        $dist = "contrib";
-    } elsif ($file =~ /\/non-free\//) {
-        $dist = "non-free";
-    } else {
-        $dist = "local";
-    }
-
-    $pdir = "$dir/dists/$codename/$dist";
-    if ($section and $section eq "debian-installer") {
-        $pdir = "$dir/dists/$codename/$dist/debian-installer";
+    for my $c ( @components ) {
+        my ( $comp, $path ) = @$c;
+        if ( $file =~ m#^$path/$comp# ) {
+            $component = $comp;
+            last;
+        }
+        if ( $file =~ m#/((?:lib)?[a-z])/# ) {
+            if ( $file =~ m#/$comp/$1/$1.+# ) {
+                $component = $comp;
+                last;
+            }
+        }
+        # Last-ditch effort, least reliable, but should be good enough
+        if ( $file =~ m#/$comp/# ) {
+            $component = $comp;
+            last;
+        }
     }
-    return $pdir;
+    die "Unable to determine component for '$file'\n" unless $component;
+
+    return "$dir/dists/$codename/$component/debian-installer"
+        if $section and $section eq "debian-installer";
+    return "$dir/dists/$codename/$component";
 }

 # Dump the apt-cached data into a Packages file; make the parent dir
@@ -995,7 +991,7 @@
     if ($option =~ /--rollback/) {
         $rollback = 1;
         $dir = shift;
-    } else {
+    } else {
         $dir = $option;
     }

@@ -1037,11 +1033,7 @@
             # Count how big the file is we're removing, for checking if the disc is full
             if (! -e "$source/$file") {
                 msg_ap(0, "Can't find $file in the main archive, trying local\n");
-                if (-e "$localdebs/$file") {
-                    $source = $localdebs;
-                } else {
-                    die "$file not found under either $source or $localdebs\n";
-                }
+                $source = find_file( $source, $file );
             }
             $realfile = real_file ("$source/$file");
             $total_blocks -= get_file_blocks($realfile);
@@ -1059,11 +1051,7 @@
             # And put the file in the CD tree (with a (hard) link)
             if (! -e "$source/$file") {
                 msg_ap(0, "Can't find $file in the main archive, trying local\n");
-                if (-e "$localdebs/$file") {
-                    $source = $localdebs;
-                } else {
-                    die "$file not found under either $source or $localdebs\n";
-                }
+                $source = find_file( $source, $file );
             }
             $realfile = real_file ("$source/$file");

@@ -1085,3 +1073,16 @@
     $/ = $old_split; # Return to line-orientation
     return $total_blocks;
 }
+
+sub find_file {
+    my ( $source, $file ) = @_;
+
+    return $source if -e "$source/$file";
+    return unless $ENV{EXTRA};
+    for my $c ( @components ) {
+        my ( $comp, $path ) = @$c;
+        next if $c eq 'main' or $c eq 'contrib' or $c eq 'non-free';
+        return "$path/$comp" if -e "$path/$comp/$file";
+    }
+    die "'$file' not found anywhere\n";
+}
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/Packages-gen debian-cd/tools/Packages-gen
--- debian-cd-3.1.3/tools/Packages-gen  2009-01-12 09:10:55.000000000 -0600
+++ debian-cd/tools/Packages-gen        2010-04-01 12:07:44.000000000 -0500
@@ -1,36 +1,52 @@
 #! /bin/sh
 set -e

-dir=${LOCALDEBS:-$MIRROR}
-
-if [ ! -d "$dir" ]; then
-       echo "error: directory '$dir' does not exist"
-       echo "Check that the MIRROR or LOCALDEBS variable is set correctly."
-       exit 1
-fi
-cd $dir
-
 DI=
 if [ "$1" = "-i" ]; then
-       DI=1
-       shift
+    DI=1
+    shift
 fi

 distr=$1
 arch=$2
 if [ -z "$distr" ] || [ -z "$arch" ]; then
-       echo "Usage: $(basename $0) [-i] <codename> <arch>"
-       exit 1
-elif [ ! -d dists/$distr/local/ ]; then
-       echo "No local repository matching '$distr' was found"
-       exit 1
+    echo "Usage: $(basename $0) [-i] <codename> <arch>"
+    exit 1
 fi

-if [ -z "$DI" ]; then
-       repo="dists/$distr/local/binary-$arch"
-else
-       repo="dists/$distr/local/debian-installer/binary-$arch"
+suffix="binary-$arch";
+if [ -n "$DI" ]; then
+    suffix="debian-installer/$suffix";
 fi
-[ -d $repo ] || mkdir -p $repo
-echo Creating Packages file for $repo...
-apt-ftparchive packages $repo | gzip >$repo/Packages.gz
+
+COMPSA=($COMPS)
+PATHSA=($PATHS)
+
+if [ "$EXTRA" ]; then
+    x=0;
+    while [ $x -lt ${#COMPSA[*]} ]; do
+        packages_file ${COMPSA[$x]} ${PATHSA[$x]}
+        let x=$x+1
+    done
+fi
+
+packages_file() {
+    comp=$1
+    dir=$2
+    if [ ! -d $dir ]; then
+       echo "error: directory '$dir' does not exist"
+       echo "Check that the MIRROR or EXTRA variable is set correctly."
+       exit 1
+    fi
+    origdir=$(pwd)
+    cd $dir
+    elif [ ! -d dists/$distr/$comp/ ]; then
+        echo "No local repository matching '$distr/$comp' was found"
+        exit 1
+    fi
+    repo=dists/$distr/$comp/$suffix
+    [ -d $repo ] || mkdir -p $repo
+    echo Creating Packages file for $repo...
+    apt-ftparchive packages $repo | gzip >$repo/Packages.gz
+    cd $origdir
+}
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/sort_deps debian-cd/tools/sort_deps
--- debian-cd-3.1.3/tools/sort_deps     2009-12-28 19:27:25.000000000 -0600
+++ debian-cd/tools/sort_deps   2010-04-01 12:07:44.000000000 -0500
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 #
-# Copyright 1999 Raphaël Hertzog <hertzog@debian.org>
+# Copyright 1999 Rapha�l Hertzog <hertzog@debian.org>
 # See the README file for the license
 #
 # This script takes 1 argument on input :
@@ -18,7 +18,6 @@

 my $nonfree = $ENV{'NONFREE'} || 0;
 my $extranonfree = $ENV{'EXTRANONFREE'} || 0;
-my $local = $ENV{'LOCAL'} || 0;
 my $complete = $ENV{'COMPLETE'} || 0;
 my $norecommends = $ENV{'NORECOMMENDS'} || 0;
 my $nosuggests = $ENV{'NOSUGGESTS'} || 1;
@@ -134,7 +133,7 @@
        $ENV{'LC_ALL'} = 'C'; # Required since apt is now translated
        open (APT, "$apt cache depends @pkg |") || die "Can't fork : $!\n";
        my (@res) = (<APT>);
-       close APT or die "« apt-cache depends » failed ... \n" .
+       close APT or die "� apt-cache depends � failed ... \n" .
                         "you must have apt >= 0.3.11.1 !\n";
        # Getting rid of conflicts/replaces/provides
        my $i = 0;
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/start_new_disc debian-cd/tools/start_new_disc
--- debian-cd-3.1.3/tools/start_new_disc        2009-12-28 19:27:25.000000000 -0600
+++ debian-cd/tools/start_new_disc      2010-04-01 12:07:44.000000000 -0500
@@ -72,9 +72,12 @@
 fi

 # Commodity link for tools which want local in dists/local/local ...
-if [ -n "$LOCAL" ]
-then
-    ln -sf $CODENAME $CDDIR/dists/local
+if [ -n "$EXTRA" ]; then
+    for comp in $COMPS; do
+        if [ "$comp" = "local" ]; then
+            ln -s $CODENAME $CDDIR/dists/$comp
+        fi
+    done
 fi

 if [ ! -d $CDDIR/.disk ] ; then
@@ -118,8 +121,10 @@

        echo "  Adding .disk/base_components"
        echo "main" > $CDDIR/.disk/base_components
-       if [ -n "$LOCAL" ] ; then
-               echo "local" >> $CDDIR/.disk/base_components
+       if [ -n "$EXTRA" ]; then
+               for comp in $COMPS; do
+                       echo $comp >> $CDDIR/.disk/base_components
+               done
        fi

        echo "  Adding .disk/cd_type"
@@ -311,8 +316,10 @@
        SECTIONS="${SECTIONS} contrib"
 fi

-if [ -n "$LOCAL" ] ; then
-       SECTIONS="$SECTIONS local"
+if [ -n "$EXTRA" ]; then
+    for comp in $COMPS; do
+        SECTIONS="$SECTIONS $comp"
+    done
 fi

 # these two lines can be inserted below the "Architectures" line below,
@@ -341,6 +348,21 @@
        exit 1
 fi

+# Takes arch, section, and path as arguments
+copy_release() {
+       arch=$1
+       sect=$2
+       path=$3
+       if [ -z "$path" ]; then
+               $path=$MIRROR
+        fi
+       if [ -e $path/dists/$CODENAME/$sect/binary-$arch/Release ] ; then
+               mkdir -p dists/$CODENAME/$sect/binary-$arch
+               cp $path/dists/$CODENAME/$sect/binary-$arch/Release \
+                       dists/$CODENAME/$sect/binary-$arch/
+       fi
+}
+
 # Copying individual release files
 for ARCH in $ARCHES
 do
@@ -365,12 +387,14 @@
                fi
     done

-       if [ -n "$LOCALDEBS" -a -n "$LOCAL" ] ; then
-               if [ -e $LOCALDEBS/dists/$CODENAME/local/binary-$ARCH/Release ] ; then
-                       mkdir -p dists/$CODENAME/local/binary-$ARCH
-                       cp $LOCALDEBS/dists/$CODENAME/local/binary-$ARCH/Release \
-                               dists/$CODENAME/local/binary-$ARCH/
-               fi
+       if [ -n "$EXTRA" ]; then
+               count=0;
+               COMPSA=($COMPS)
+               PATHSA=($PATHS)
+               while [ $count -lt ${#COMPSA[*]} ]; do
+                       copy_release $ARCH $COMPSA[$count] $PATHSA[$count]
+                       let count=$count+1
+               done
        fi

        if [ -e "$MIRROR/dists/$DI_CODENAME/main/debian-installer/binary-$ARCH/Release" ] ; then
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/update_tasks debian-cd/tools/update_tasks
--- debian-cd-3.1.3/tools/update_tasks  2009-02-12 08:16:45.000000000 -0600
+++ debian-cd/tools/update_tasks        2010-04-01 12:07:44.000000000 -0500
@@ -156,12 +156,16 @@
 # We need to gunzip a copy of the appropriate Packages.gz file(s)
 TMP_PKG=$TDIR/Packages
 zcat $MIRROR/dists/$CODENAME/main/binary-$arch/Packages.gz > $TMP_PKG
-if [ -n "$LOCAL" ] ; then
-    if [ -n "$LOCALDEBS" ] ; then
-        zcat $LOCALDEBS/dists/$CODENAME/local/binary-$arch/Packages.gz >> $TMP_PKG
-    else
-        zcat $MIRROR/dists/$CODENAME/local/binary-$arch/Packages.gz >> $TMP_PKG
-    fi
+
+COMPSA=($COMPS)
+PATHSA=($PATHS)
+
+if [ -n "$EXTRA" ]; then
+    x=0;
+    while [ $x -lt ${#COMPSA[*]} ]; do
+        zcat ${PATHSA[$x]}/dists/$CODENAME/${COMPSA[$x]}/binary-$arch/Packages.gz >> $TMP_PKG
+        let x=$x+1
+    done
 fi

 # Now grab the appropriate tasksel package
diff --exclude .svn --exclude changelog -ruN debian-cd-3.1.3/tools/which_deb debian-cd/tools/which_deb
--- debian-cd-3.1.3/tools/which_deb     2009-02-11 18:22:17.000000000 -0600
+++ debian-cd/tools/which_deb   2010-04-01 12:07:44.000000000 -0500
@@ -5,8 +5,13 @@
 # Simple helper tool to find the appropriate version of a package in
 # the archive to meet a requirement in the debian-cd build

+use lib "/usr/share/debian-cd/tools";
 use strict;
 use List::Util qw{first};
+require 'common.pl';
+
+my $VERBOSE = $ENV{VERBOSE};
+
 # Give prefernce to i386 and amd64, if specified, or if building a
 # source-only CD.
 my @ARCHES;
@@ -17,25 +22,52 @@
 }
 @ARCHES = qw{i386 amd64} unless @ARCHES;

-my ($mirror, $codename, $pkg, $pth, $output);
+my ($mirror, $codename, $pkg, $output) = @ARGV;

-$mirror = shift;
-$codename = shift;
-$pkg = shift;
-$output = shift;
-$pth = "$mirror/dists/$codename";
-
-my @components = qw(main);
-push @components, 'contrib' if $ENV{CONTRIB};
-push @components, 'non-free' if $ENV{NONFREE};
-push @components, 'local' if $ENV{LOCAL};
+my @components = components($mirror,$codename);

 if (!defined ($output)) {
     $output = "binary";
 }

+my $bin_deb = "";
+my $pkgdata = "";
+my $srcname = "";
+
+if ($pkg eq "silo") {
+    $pkgdata = grab_bin_info("sparc", $pkg);
+} elsif ($pkg eq "syslinux") {
+    first { $pkgdata = grab_bin_info($_, "syslinux-common") } @ARCHES;
+    if (length($pkgdata) < 3) {
+        first { $pkgdata = grab_bin_info($_, "syslinux") } @ARCHES;
+    }
+} elsif ($pkg eq "yaboot") {
+    $pkgdata = grab_bin_info("powerpc", $pkg);
+} else { # Fallthrough for all other packages
+    first { $pkgdata = grab_bin_info($_, $pkg) } @ARCHES;
+}
+
+die "Unable to find package '$pkg'!\n" unless length($pkgdata) > 2;
+
+if ($output eq "binary") {
+    $pkgdata =~ m/^Filename: (\S+)/m and $bin_deb = $1;
+    print "$bin_deb\n";
+}
+elsif ($output eq "source") {
+    $srcname = $pkg;
+    $pkgdata =~ m/^Source: (\S+)/m and $srcname = $1;
+    $pkgdata = grab_src_info($srcname);
+    if (length($pkgdata) > 2) {
+        my $dir;
+        $pkgdata =~ m/^Directory: (\S+)/m and $dir = $1;
+        $pkgdata =~ m/^ (\S+) (\S+) ((\S+).*dsc)/m and print "$dir/$3\n";
+        $pkgdata =~ m/^ (\S+) (\S+) ((\S+).*diff.gz)/m and print "$dir/$3\n";
+        $pkgdata =~ m/^ (\S+) (\S+) ((\S+).*tar.gz)/m and print "$dir/$3\n";
+    }
+}
+
 sub grab_bin_info {
-    my $pth = shift;
+    warn "grab_bin_info(): ".join(',',@_)."\n" if $VERBOSE;
     my $arch = shift;
     my $pkgname = shift;
     my $old_split = $/;
@@ -44,12 +76,12 @@

     $/ = ''; # Browse by paragraph

-    for my $component ( @components ) {
+    for my $comp ( @components ) {
+        my ( $component, $pth ) = @$comp;
+        warn "component='$component', path='$pth'\n" if $VERBOSE;
         my $pgz = "$pth/$component/binary-$arch/Packages.gz";
-        if ( $component eq 'local' and $ENV{LOCALDEBS} ) {
-            $pgz = "$ENV{LOCALDEBS}/dists/$codename/local/binary-$arch/Packages.gz";
-        }
         if (-e $pgz) {
+            warn "Found Packages file '$pgz'\n" if $VERBOSE;
             open(PFILE, "zcat $pgz |") or
                 die "Failed to read Packages file $pgz";

@@ -68,7 +100,6 @@
 }

 sub grab_src_info {
-    my $pth = shift;
     my $pkgname = shift;
     my $old_split = $/;
     my $match;
@@ -76,7 +107,8 @@

     $/ = ''; # Browse by paragraph

-    for my $component ( @components ) {
+    for my $comp ( @components ) {
+        my ( $component, $pth ) = @$comp;
         my $pgz = "$pth/$component/source/Sources.gz";

         if (-e $pgz) {
@@ -96,41 +128,3 @@
     }
     return "";
 }
-
-my $bin_deb = "";
-my $pkgdata = "";
-my $srcname = "";
-
-if ($pkg eq "silo") {
-    $pkgdata = grab_bin_info($pth, "sparc", $pkg);
-
-} elsif ($pkg eq "syslinux") {
-    first { $pkgdata = grab_bin_info($pth, $_, "syslinux-common") } @ARCHES;
-    if (length($pkgdata) < 3) {
-        first { $pkgdata = grab_bin_info($pth, $_, "syslinux") } @ARCHES;
-    }
-} elsif ($pkg eq "yaboot") {
-    $pkgdata = grab_bin_info($pth, "powerpc", $pkg);
-} else { # Fallthrough for all other packages
-    first { $pkgdata = grab_bin_info($pth, $_, $pkg) } @ARCHES;
-}
-
-if (length($pkgdata) > 2) {
-    if ($output eq "binary") {
-        $pkgdata =~ m/^Filename: (\S+)/m and $bin_deb = $1;
-        print "$bin_deb\n";
-    }
-    elsif ($output eq "source") {
-        $srcname = $pkg;
-        $pkgdata =~ m/^Source: (\S+)/m and $srcname = $1;
-        $pkgdata = grab_src_info($pth, $srcname);
-        if (length($pkgdata) > 2) {
-            my $dir;
-            $pkgdata =~ m/^Directory: (\S+)/m and $dir = $1;
-            $pkgdata =~ m/^ (\S+) (\S+) ((\S+).*dsc)/m and print "$dir/$3\n";
-            $pkgdata =~ m/^ (\S+) (\S+) ((\S+).*diff.gz)/m and print "$dir/$3\n";
-            $pkgdata =~ m/^ (\S+) (\S+) ((\S+).*tar.gz)/m and print "$dir/$3\n";
-        }
-    }
-}
-

Reply to: