* Split out the code that copies debs into the temporary trees and

creates Packages files from the Makefile into tools/add_debs
* Split out the code that copies sources into the temporary trees and
  creates Sources files from the Makefile into tools/add_source_packages
This commit is contained in:
Steve McIntyre 2005-12-11 00:39:10 +00:00
parent 1a4ac2ddc6
commit c275d5187d
4 changed files with 193 additions and 122 deletions

128
Makefile
View File

@ -1,6 +1,6 @@
#!/usr/bin/make -f
# Main Makefile for YACS
# Main Makefile for debian-cd
#
# Copyright 1999 Raphaël Hertzog <hertzog@debian.org>
# See the README file for the license
@ -112,6 +112,8 @@ jigdo_cleanup=$(BASEDIR)/tools/jigdo_cleanup
grab_md5=$(BASEDIR)/tools/grab_md5
dedicated-src=$(BASEDIR)/tools/dedicated_source
make_image=$(BASEDIR)/tools/make_image
add_debs=$(BASEDIR)/tools/add_debs
add_source_packages=$(BASEDIR)/tools/add_source_packages
BDIR=$(TDIR)/$(CODENAME)-$(ARCH)
ADIR=$(APTTMP)/$(CODENAME)-$(ARCH)
@ -496,130 +498,12 @@ $(SDIR)/CD1/.disk/info:
# Adding the deb files to the images
packages: bin-infos bin-list $(BDIR)/packages-stamp
$(BDIR)/packages-stamp:
@echo "Current disk usage on the binary CDs (before the debs are added) :"
@cd $(BDIR) && du -sm CD[0123456789]*
@echo "Adding the selected packages to each CD :"
@# Check that all packages required by debootstrap are included
@# and create .disk/base_installable if yes
@# Also create .disk/base_components
mkdir -p $(TDIR)
$(Q)for DISK in $(FIRSTDISKS); do \
DISK=$${DISK##CD}; \
ok=yes; \
for p in `debootstrap --arch $(ARCH) --print-debs $(CODENAME) $(TDIR)/debootstrap.tmp file:$(MIRROR)`; do \
if ! grep -q ^$$p$$ $(BDIR)/$$DISK.packages; then \
if [ -n "$(BASE_EXCLUDE)" ] && grep -q ^$$p$$ $(BASE_EXCLUDE); then \
echo "Missing debootstrap-required $$p but included in $(BASE_EXCLUDE)"; \
continue; \
fi; \
ok=no; \
echo "Missing debootstrap-required $$p"; \
fi; \
done; \
rm -rf $(TDIR)/debootstrap.tmp; \
if [ "$$ok" = "yes" ]; then \
echo "CD$$DISK contains all packages needed by debootstrap"; \
touch $(BDIR)/CD$$DISK/.disk/base_installable; \
else \
echo "CD$$DISK missing some packages needed by debootstrap"; \
fi; \
echo 'main' > $(BDIR)/CD$$DISK/.disk/base_components; \
if [ -n "$(LOCAL)" ]; then \
echo 'local' >> $(BDIR)/CD$$DISK/.disk/base_components; \
fi; \
if [ -n "$(UDEB_INCLUDE)" ] ; then \
if [ -r "$(UDEB_INCLUDE)" ] ; then \
cp -af "$(UDEB_INCLUDE)" \
"$(BDIR)/CD$$DISK/.disk/udeb_include"; \
else \
echo "ERROR: Unable to read UDEB_INCLUDE file $(UDEB_INCLUDE)"; \
fi; \
fi; \
if [ -n "$(UDEB_EXCLUDE)" ] ; then \
if [ -r "$(UDEB_EXCLUDE)" ] ; then \
cp -af "$(UDEB_EXCLUDE)" \
"$(BDIR)/CD$$DISK/.disk/udeb_exclude"; \
else \
echo "ERROR: Unable to read UDEB_EXCLUDE file $(UDEB_EXCLUDE)"; \
fi; \
fi; \
if [ -n "$(BASE_INCLUDE)" ] ; then \
if [ -r "$(BASE_INCLUDE)" ] ; then \
cp -af "$(BASE_INCLUDE)" \
"$(BDIR)/CD$$DISK/.disk/base_include"; \
else \
echo "ERROR: Unable to read BASE_INCLUDE file $(BASE_INCLUDE)"; \
fi; \
fi; \
if [ -n "$(BASE_EXCLUDE)" ] ; then \
if [ -r "$(BASE_EXCLUDE)" ] ; then \
cp -af $(BASE_EXCLUDE) \
$(BDIR)/CD$$DISK/.disk/base_exclude; \
else \
echo "ERROR: Unable to read BASE_EXCLUDE file $(BASE_EXCLUDE)"; \
fi; \
fi; \
done
$(Q)set -e; \
for i in $(BDIR)/*.packages; do \
dir=$${i%%.packages}; \
n=$${dir##$(BDIR)/}; \
dir=$(BDIR)/CD$$n; \
echo "$$n ... "; \
cat $$i | xargs -n 200 -r $(add_packages) $$dir; \
if [ -x "$(HOOK)" ]; then \
cd $(BDIR) && $(HOOK) $$n before-scanpackages; \
fi; \
$(scanpackages) scan $$dir; \
echo "done."; \
done
@#Now install the Packages and Packages.cd files
$(Q)set -e; \
for i in $(BDIR)/*.packages; do \
dir=$${i%%.packages}; \
dir=$${dir##$(BDIR)/}; \
dir=$(BDIR)/CD$$dir; \
$(scanpackages) install $$dir; \
done
$(Q)$(add_debs) "$(BDIR)" "$(TDIR)" "$(FIRSTDISKS)" "$(ARCH)" "$(BASE_INCLUDE)" "$(BASE_EXCLUDE)" "$(UDEB_INCLUDE)" "$(UDEB_EXCLUDE)" "$(add_packages)" "$(scanpackages)"
$(Q)touch $(BDIR)/packages-stamp
sources: src-infos src-list $(SDIR)/sources-stamp
$(SDIR)/sources-stamp:
@echo "Adding the selected sources to each CD."
$(Q)set -e; \
for i in $(SDIR)/*.sources; do \
dir=$${i%%.sources}; \
n=$${dir##$(SDIR)/}; \
dir=$(SDIR)/CD$$n; \
echo -n "$$n ... "; \
echo -n "main ... "; \
grep -vE "(non-US/|/local/)" $$i > $$i.main || true ; \
if [ -s $$i.main ] ; then \
cat $$i.main | xargs $(add_files) $$dir $(MIRROR); \
fi ; \
if [ -n "$(LOCAL)" ]; then \
echo -n "local ... "; \
grep "/local/" $$i > $$i.local || true ; \
if [ -s $$i.local ] ; then \
if [ -n "$(LOCALDEBS)" ] ; then \
cat $$i.local | xargs $(add_files) \
$$dir $(LOCALDEBS); \
else \
cat $$i.local | xargs $(add_files) \
$$dir $(MIRROR); \
fi; \
fi; \
fi; \
if [ -n "$(NONUS)" ]; then \
echo -n "non-US ... "; \
grep "non-US/" $$i > $$i.nonus || true ; \
if [ -s $$i.nonus ] ; then \
cat $$i.nonus | xargs $(add_files) $$dir $(NONUS); \
fi; \
fi; \
$(scansources) $$dir; \
echo "done."; \
done
$(Q)$(add_source_packages) "$(SDIR)" "$(add_files)" "$(MIRROR)" "$(LOCAL)" "$(LOCALDEBS)" "$(scansources)"
$(Q)touch $(SDIR)/sources-stamp
## BOOT & DOC & INSTALL ##
@ -878,7 +762,7 @@ bin-images: ok bin-md5list $(OUT)
$(make_image) "$(BDIR)" "$(ARCH)" "$(OUT)" "$(DOJIGDO)" "$(DEBVERSION)" "$(MIRROR)" "$(MKISOFS)" "$(MKISOFS_OPTS)" "$(JIGDO_OPTS)" "$(jigdo_cleanup)"
src-images: ok src-md5list $(OUT)
$(make_image) "$(SDIR)" source "$(OUT)" "$(DOJIGDO)" "$(DEBVERSION)" "$(MIRROR)" "$(MKISOFS)" "$(MKISOFS_OPTS)" "$(JIGDO_OPTS)" "$(jigdo_cleanup)"
$(make_image) "$(SDIR)" "source" "$(OUT)" "$(DOJIGDO)" "$(DEBVERSION)" "$(MIRROR)" "$(MKISOFS)" "$(MKISOFS_OPTS)" "$(JIGDO_OPTS)" "$(jigdo_cleanup)"
check-number-given:
@test -n "$(CD)" || (echo "Give me a CD=<num> parameter !" && false)

6
debian/changelog vendored
View File

@ -86,6 +86,12 @@ debian-cd (2.2.24) UNRELEASED; urgency=low
[ Joey Hess ]
* Explicitly list ppp and pppoeconf in generate_d-i+k_list, since they are
not installed by debootstrap and we do want them on netinst CDs.
[ Steve McIntyre ]
* Split out the code that copies debs into the temporary trees and
creates Packages files from the Makefile into tools/add_debs
* Split out the code that copies sources into the temporary trees and
creates Sources files from the Makefile into tools/add_source_packages
-- Joey Hess <joeyh@debian.org> Thu, 8 Dec 2005 22:53:16 +0000

124
tools/add_debs Executable file
View File

@ -0,0 +1,124 @@
#!/bin/sh
#
# add_debs
#
# Simple helper script for debian-cd
#
# Split out of the top-level Makefile by SAM 2005/12/10
#
# 1. Check that the lists of packages look valid (e.g. installer
# packages are on CD#1
#
# 2. Add deb files into each CD root
#
# 3. Create Packages files within each CD root
set -e
BDIR=$1
TDIR=$2
FIRSTDISKS=$3
ARCH=$4
BASE_INCLUDE=$5
BASE_EXCLUDE=$6
UDEB_INCLUDE=$7
UDEB_EXCLUDE=$8
ADDPACKAGES=$9
shift
SCANPACKAGES=$9
echo "Current disk usage on the binary CDs (before the debs are added):"
cd $BDIR && du -sm CD[0123456789]*
echo "Adding the selected packages to each CD:"
# Check that all packages required by debootstrap are included
# and create .disk/base_installable if yes
# Also create .disk/base_components
mkdir -p $TDIR
for DISK in $FIRSTDISKS
do
DISK=${DISK##CD}
ok=yes
for p in `debootstrap --arch $ARCH --print-debs $CODENAME $TDIR/debootstrap.tmp file:$MIRROR`
do
if ! grep -q ^$p$ $BDIR/$DISK.packages ; then
if [ -n "$BASE_EXCLUDE" ] && grep -q ^$p$ $BASE_EXCLUDE ; then
echo "Missing debootstrap-required $p but included in $BASE_EXCLUDE"
continue
fi
ok=no
echo "Missing debootstrap-required $p"
fi
done
rm -rf $TDIR/debootstrap.tmp
if [ "$ok" = "yes" ] ; then
echo "CD$DISK contains all packages needed by debootstrap"
touch $BDIR/CD$DISK/.disk/base_installable
else
echo "CD$DISK missing some packages needed by debootstrap"
fi
echo 'main' > $BDIR/CD$DISK/.disk/base_components
if [ -n "$LOCAL" ] ; then
echo 'local' >> $BDIR/CD$DISK/.disk/base_components
fi
# Sort out the udeb include and exclude files
if [ -n "$UDEB_INCLUDE" ] ; then
if [ -r "$UDEB_INCLUDE" ] ; then
cp -af "$UDEB_INCLUDE" "$BDIR/CD$DISK/.disk/udeb_include"
else
echo "ERROR: Unable to read UDEB_INCLUDE file $UDEB_INCLUDE"
fi
fi
if [ -n "$UDEB_EXCLUDE" ] ; then
if [ -r "$UDEB_EXCLUDE" ] ; then
cp -af "$UDEB_EXCLUDE" "$BDIR/CD$DISK/.disk/udeb_exclude"
else
echo "ERROR: Unable to read UDEB_EXCLUDE file $UDEB_EXCLUDE"
fi
fi
# Ditto the base include and exclude
if [ -n "$BASE_INCLUDE" ] ; then
if [ -r "$BASE_INCLUDE" ] ; then
cp -af "$BASE_INCLUDE" "$BDIR/CD$DISK/.disk/base_include"
else
echo "ERROR: Unable to read BASE_INCLUDE file $BASE_INCLUDE"
fi
fi
if [ -n "$BASE_EXCLUDE" ] ; then
if [ -r "$BASE_EXCLUDE" ] ; then
cp -af $BASE_EXCLUDE $BDIR/CD$DISK/.disk/base_exclude
else
echo "ERROR: Unable to read BASE_EXCLUDE file $BASE_EXCLUDE"
fi
fi
done
# Generate the Packages files
for i in $BDIR/*.packages
do
dir=${i%%.packages}
n=${dir##$BDIR/}
dir=$BDIR/CD$n
echo "$n ... "
cat $i | xargs -n 200 -r $ADDPACKAGES $dir
if [ -x "$HOOK" ] ; then
cd $BDIR && $HOOK $n before-scanpackages
fi
$SCANPACKAGES scan $dir
echo "done."
done
# Now install the Packages and Packages.cd files
for i in $BDIR/*.packages
do
dir=${i%%.packages}
dir=${dir##$BDIR/}
dir=$BDIR/CD$dir
$SCANPACKAGES install $dir
done

57
tools/add_source_packages Executable file
View File

@ -0,0 +1,57 @@
#!/bin/sh
#
# add_source_packages
#
# Simple helper script for debian-cd
#
# Split out of the top-level Makefile by SAM 2005/12/10
#
# 1. Add source files into each CD root
#
# 2. Create Sources files within each CD root
set -e
SDIR=$1
ADD_FILES=$2
MIRROR=$3
LOCAL=$4
LOCALDEBS=$5
SCANSOURCES=$6
echo "Adding the selected sources to each CD."
for i in $SDIR/*.sources
do
dir=${i%%.sources}
n=${dir##$SDIR/}
dir=$SDIR/CD$n
echo -n "$n ... "
echo -n "main ... "
grep -vE "(non-US/|/local/)" $i > $i.main || true
if [ -s $i.main ] ; then
cat $i.main | xargs $ADD_FILES $dir $MIRROR
fi
if [ -n "$LOCAL" ] ; then
echo -n "local ... "
grep "/local/" $i > $i.local || true
if [ -s $i.local ] ; then
if [ -n "$LOCALDEBS" ] ; then
cat $i.local | xargs $ADD_FILES $dir $LOCALDEBS
else
cat $i.local | xargs $ADD_FILES $dir $MIRROR
fi
fi
fi
if [ -n "$NONUS" ] ; then
echo -n "non-US ... "
grep "non-US/" $i > $i.nonus || true
if [ -s $i.nonus ] ; then
cat $i.nonus | xargs $ADD_FILES $dir $NONUS
fi
fi
$SCANSOURCES $dir
echo "done."
done