Merge ~mwhudson/debian-cd/+git/ubuntu:deb822-sources into ~ubuntu-cdimage/debian-cd/+git/ubuntu:main

Proposed by Michael Hudson-Doyle
Status: Superseded
Proposed branch: ~mwhudson/debian-cd/+git/ubuntu:deb822-sources
Merge into: ~ubuntu-cdimage/debian-cd/+git/ubuntu:main
Prerequisite: ~mwhudson/debian-cd/+git/ubuntu:ubuntu-cdimage-apt-sources-base
Diff against target: 392 lines (+51/-168)
10 files modified
CONF.sh (+1/-6)
Makefile (+2/-25)
README (+0/-5)
build_all.sh (+1/-5)
tools/apt-selection (+7/-121)
tools/guess-mirror (+36/-0)
tools/list2cds (+0/-1)
tools/list2src (+0/-5)
tools/scanpackages (+2/-0)
tools/scansources (+2/-0)
Reviewer Review Type Date Requested Status
Ubuntu CD Image Team Pending
Review via email: mp+457015@code.launchpad.net

This proposal has been superseded by a proposal from 2024-02-12.

Description of the change

This is the partner to https://code.launchpad.net/~mwhudson/ubuntu-cdimage/+git/ubuntu-cdimage-1/+merge/457014, it uses the chdist-list apt setup from that branch to fetch packages from the pool rather than one locally created by debian-cd.

It has a branch set as a prerequisite that is a merge-up of my other outstanding (and somewhat more mundane) preparatory branches.

To post a comment you must log in.

Unmerged commits

3d62c36... by Michael Hudson-Doyle

remove remaining uses of $MIRROR

d9442e7... by Michael Hudson-Doyle

remove references to ADIR and APTTMP

cc12bb7... by Michael Hudson-Doyle

use ubuntu-cdimage provided apt configuration for all apt work

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/CONF.sh b/CONF.sh
2index 1b63e19..6cb382d 100644
3--- a/CONF.sh
4+++ b/CONF.sh
5@@ -131,13 +131,12 @@ export ARCH=`dpkg --print-architecture`
6
7 export FULLARCH=$ARCH${SUBARCH:++$SUBARCH}
8
9-# IMPORTANT : The 4 following paths must be on the same partition/device.
10+# IMPORTANT : The 2 following paths must be on the same partition/device.
11 # If they aren't then you must set COPYLINK below to 1. This
12 # takes a lot of extra room to create the sandbox for the ISO
13 # images, however. Also, if you are using an NFS partition for
14 # some part of this, you must use this option.
15 # Paths to the mirrors
16-export MIRROR=${MIRROR:-$CDIMAGE_ROOT/ftp}
17
18 # Path of the temporary directory
19 export TDIR=$CDIMAGE_ROOT/scratch/$PROJECT/$DIST/$IMAGE_TYPE/tmp
20@@ -145,10 +144,6 @@ export TDIR=$CDIMAGE_ROOT/scratch/$PROJECT/$DIST/$IMAGE_TYPE/tmp
21 # Path where the images will be written
22 export OUT=$CDIMAGE_ROOT/scratch/$PROJECT/$DIST/$IMAGE_TYPE/debian-cd
23
24-# Where we keep the temporary apt stuff.
25-# This cannot reside on an NFS mount.
26-export APTTMP=$CDIMAGE_ROOT/scratch/$PROJECT/$DIST/$IMAGE_TYPE/apt
27-
28 # Where extracted debootstrap scripts live
29 export DEBOOTSTRAP=$CDIMAGE_ROOT/scratch/$PROJECT/$DIST/$IMAGE_TYPE/debootstrap
30
31diff --git a/Makefile b/Makefile
32index bfc52ff..35ce7d8 100644
33--- a/Makefile
34+++ b/Makefile
35@@ -113,7 +113,6 @@ make_raw_img=$(BASEDIR)/tools/make-raw-img
36 hardlink=$(BASEDIR)/tools/hardlink
37
38 BDIR=$(TDIR)/$(CODENAME)-$(FULLARCH)
39-ADIR=$(APTTMP)/$(CODENAME)-$(FULLARCH)
40 SDIR=$(TDIR)/$(CODENAME)-src
41
42 FIRSTDISKS=CD1
43@@ -215,9 +214,6 @@ endif
44 ifndef BASEDIR
45 @echo BASEDIR undefined -- set up CONF.sh; false
46 endif
47-ifndef MIRROR
48- @echo MIRROR undefined -- set up CONF.sh; false
49-endif
50 ifndef ARCH
51 @echo ARCH undefined -- set up CONF.sh; false
52 endif
53@@ -236,7 +232,7 @@ endif
54 ## INITIALIZATION ##
55
56 # Creation of the directories needed
57-init: ok $(OUT) $(TDIR) $(BDIR) $(SDIR) $(ADIR)
58+init: ok $(OUT) $(TDIR) $(BDIR) $(SDIR)
59 $(OUT):
60 $(Q)mkdir -p $(OUT)
61 $(TDIR):
62@@ -245,10 +241,6 @@ $(BDIR):
63 $(Q)mkdir -p $(BDIR)
64 $(SDIR):
65 $(Q)mkdir -p $(SDIR)
66-$(ADIR):
67- $(Q)mkdir -p $(ADIR)
68- $(Q)mkdir -p $(ADIR)/apt-ftparchive-db
69- $(Q)mkdir -p $(ADIR)/apt/preferences.d
70
71 ## CLEANINGS ##
72
73@@ -269,28 +261,13 @@ distclean: ok bin-distclean src-distclean
74 bin-distclean:
75 $(Q)echo "Cleaning the binary build directory"
76 $(Q)rm -rf $(BDIR)
77- $(Q)rm -rf $(ADIR)
78 src-distclean:
79 $(Q)echo "Cleaning the source build directory"
80 $(Q)rm -rf $(SDIR)
81
82 ## APT ##
83
84-# Configure apt stuff
85-apt-setup: init $(ADIR)/apt-setup
86-$(ADIR)/apt-setup:
87- @echo "Setting up archive keyring from host keyring"
88- $(Q)mkdir -p $(ADIR)/apt/trusted.gpg.d
89- $(Q)for file in /etc/apt/trusted.gpg.d/*; do \
90- if [ -e $$file ]; then \
91- ln -s $$file $(ADIR)/apt/trusted.gpg.d/$$(basename $$file); \
92- fi; \
93- done
94- # Create the apt state directory and update the database
95- $(Q)$(apt) update
96- touch $(ADIR)/apt-setup
97-
98-apt-update: apt-setup
99+apt-update:
100 @echo "Apt-get is updating its files ..."
101 $(Q)$(apt) update
102
103diff --git a/README b/README
104index a447282..c75eebd 100644
105--- a/README
106+++ b/README
107@@ -44,7 +44,6 @@ Edit the CONF.sh and change the PATHs for the mirror and so on.
108 $ sensible-editor CONF.sh
109 $ . CONF.sh
110 $ make distclean
111-$ make apt-setup
112 $ make list COMPLETE=1 SIZELIMIT1=625000000 SRCSIZELIMIT=665000000
113 $ make official_images
114 [ alternatively, if you only want binary images:
115@@ -91,10 +90,6 @@ The process of building a CD is composed of the following steps:
116
117 $ make mirrorcheck
118
119-- then we initialize the temporary directory used for the build:
120-
121- $ make apt-setup
122-
123 - now you can decide what you want on your CDs
124
125 $ make list TASK=tasks/debian-2.2 COMPLETE=1
126diff --git a/build_all.sh b/build_all.sh
127index 7e4b4ca..522a86a 100755
128--- a/build_all.sh
129+++ b/build_all.sh
130@@ -24,13 +24,9 @@ do
131 CDREV=`git rev-parse HEAD`
132 echo "Using revision $CDREV of debian-cd"
133
134- if type find-mirror >/dev/null 2>&1; then
135- # TODO: nasty upcall to cdimage wrapper scripts
136- export MIRROR="$(find-mirror "$ARCH")"
137- fi
138 echo " ... cleaning"
139 make distclean
140- make apt-setup
141+ make init
142
143 echo " ... selecting packages to include"
144 SIZE_ARGS=''
145diff --git a/tools/apt-selection b/tools/apt-selection
146index effb9bf..723db82 100755
147--- a/tools/apt-selection
148+++ b/tools/apt-selection
149@@ -1,133 +1,19 @@
150 #!/bin/sh
151
152-# This is a little shell script that will launch apt-get in dry-run mode
153-# to find all the dependencies of a specific package
154+set -e
155
156-# There's not set -e here because this script may fail !
157-# Apt doesn't always work ...
158-# set -e
159-
160-# Get the configuration information if necessary
161-if [ -z "$CODENAME" -o -z "$ARCH" -o -z "$APTTMP" ]; then
162- if [ -e CONF.sh ]; then
163- source CONF.sh
164- else
165- echo "Please set the good environment variables before "
166- echo "launching this program ..."
167- echo "Current values are :"
168- echo "CODENAME=$CODENAME"
169- echo "ARCH=$ARCH"
170- echo "APTTMP=$APTTMP"
171- fi
172-fi
173-if [ -z "$FULLARCH" ]; then
174- FULLARCH="$ARCH"
175-fi
176-
177-options=" -q -o Dir=$APTTMP/$CODENAME-$FULLARCH/ \
178- -o Dir::State=$APTTMP/$CODENAME-$FULLARCH/apt-state/ \
179- -o Dir::Cache=$APTTMP/$CODENAME-$FULLARCH/apt-cache/ \
180- -o Dir::Etc=$APTTMP/$CODENAME-$FULLARCH/apt/ \
181- -o APT::Cache::AllVersions=0 \
182- -o APT::Architecture=$ARCH "
183-
184-if [ -f "$BASEDIR/data/$CODENAME/multiarch/$ARCH" ]; then
185- SECONDARY_ARCH="$(cat $BASEDIR/data/$CODENAME/multiarch/$ARCH)"
186- options="$options -o APT::Architectures=$SECONDARY_ARCH "
187-fi
188-
189-sections=main
190-if [ "${NONFREE:-0}" != "0" -o "${EXTRANONFREE:-0}" != "0" ]; then
191- sections="$sections non-free"
192-fi
193-if [ "${CONTRIB:-0}" != "0" ]; then
194- sections="$sections contrib"
195-fi
196-if [ "${RESTRICTED:-0}" != "0" ]; then
197- sections="$sections restricted"
198-fi
199-if [ "${UNIVERSE:-0}" != "0" ]; then
200- sections="$sections universe"
201-fi
202-if [ "${MULTIVERSE:-0}" != "0" ]; then
203- sections="$sections multiverse"
204-fi
205-
206-# Check for the necessary dirs and files ...
207-if [ ! -d "$APTTMP/$CODENAME-$FULLARCH/apt-state/lists/partial" ]; then
208- mkdir -p "$APTTMP/$CODENAME-$FULLARCH/apt-state/lists/partial"
209-fi
210-if [ ! -d "$APTTMP/$CODENAME-$FULLARCH/apt-cache/archives/partial" ]; then
211- mkdir -p "$APTTMP/$CODENAME-$FULLARCH/apt-cache/archives/partial"
212-fi
213-if [ ! -d "$APTTMP/$CODENAME-$FULLARCH/apt" ]; then
214- mkdir -p "$APTTMP/$CODENAME-$FULLARCH/apt"
215-fi
216-
217-case $MIRROR in
218- *:*)
219- SCHEMA=
220- ;;
221- *)
222- SCHEMA=file:
223- ;;
224-esac
225-
226-if [ ! -e "$APTTMP/$CODENAME-$FULLARCH/apt/sources.list" ]; then
227- # Generating a correct sources.list file
228- echo "deb $SCHEMA$MIRROR $CODENAME $sections" \
229- > $APTTMP/$CODENAME-$FULLARCH/apt/sources.list
230- echo "deb-src $SCHEMA$MIRROR $CODENAME $sections" \
231- >> $APTTMP/$CODENAME-$FULLARCH/apt/sources.list
232- # Post-release updates
233- if [ "${UPDATES:-0}" != "0" ]; then
234- echo "deb $SCHEMA$MIRROR $CODENAME-updates $sections" \
235- >> $APTTMP/$CODENAME-$FULLARCH/apt/sources.list
236- echo "deb-src $SCHEMA$MIRROR $CODENAME-updates $sections" \
237- >> $APTTMP/$CODENAME-$FULLARCH/apt/sources.list
238- fi
239- if [ "${PROPOSED:-0}" != "0" ]; then
240- echo "deb $SCHEMA$MIRROR $CODENAME-proposed $sections" \
241- >> $APTTMP/$CODENAME-$FULLARCH/apt/sources.list
242- echo "deb-src $SCHEMA$MIRROR $CODENAME-proposed $sections" \
243- >> $APTTMP/$CODENAME-$FULLARCH/apt/sources.list
244- fi
245-fi
246-
247-temp=$APTTMP/$CODENAME-$FULLARCH/temp.apt-selection
248+export APT_CONFIG=$(eval "echo \$APT_CONFIG_${ARCH}")
249
250 # Launch the command
251 if [ "$1" = "update" -o "$1" = "check" -o "$1" = "download" ]; then
252- apt-get $options $@
253- exit $?
254-elif [ "$1" = "cache" ]; then
255- shift
256- apt-cache $options $@
257- exit $?
258+ apt-get $@
259 elif [ "$1" = "config" ]; then
260 shift
261- apt-config $options $@
262- exit $?
263-elif [ "$1" = "deselected" ]; then
264- shift
265- apt-get $options -s $@ > $temp
266- num=$?
267- #if [ $num -ne 0 ]; then
268- #echo ": Param: apt-selection deselected $@" >&2;
269- #exit $num;
270- #fi
271- perl -ne 'print "$1\n" if /^Remv (\S+).*/' $temp | sort
272-elif [ "$1" = "selected" ]; then
273+ apt-config $@
274+elif [ "$1" = "cache" ]; then
275 shift
276- apt-get $options -s $@ > $temp
277- num=$?
278- #if [ $num -ne 0 ]; then
279- # echo "ERROR: Param: apt-selection selected $@" >&2;
280- # exit $num;
281- #fi
282- perl -ne 'print "$1\n" if /^Inst (\S+).*/' $temp | sort
283+ apt-cache -o APT::Cache::AllVersions=0 $@
284 else
285- apt-get $options -s $@
286- exit $?
287+ apt-get -s $@
288 fi
289
290diff --git a/tools/guess-mirror b/tools/guess-mirror
291new file mode 100755
292index 0000000..527d3c5
293--- /dev/null
294+++ b/tools/guess-mirror
295@@ -0,0 +1,36 @@
296+#!/usr/bin/python3
297+
298+# This script tries to work out the "main" mirror for where we are
299+# pulling packages from the pool from -- by looking for the first
300+# .sources file and taking the first URI from that.
301+#
302+# This is used by scanpackages and scansources to find the overrides
303+# files when building the pool, so it's a little bit important that
304+# this works for production builds but not very important if it
305+# returns something bogus when doing something peculiar like building
306+# an image out of the rebuild archive.
307+
308+import glob
309+import os
310+import subprocess
311+import sys
312+
313+from debian import deb822
314+
315+
316+def getconfig(v):
317+ env = dict(os.environ, APT_CONFIG=os.environ["APT_CONFIG_" + os.environ["ARCH"]])
318+ cmd = ["sh", "-c", "eval $(apt-config shell X {}); echo $X".format(v)]
319+ cp = subprocess.run(cmd, env=env, encoding='utf-8', capture_output=True)
320+ return cp.stdout.strip()
321+
322+
323+sources_list_d = getconfig("Dir::Etc::sourceparts/d")
324+
325+first_sources_path = glob.glob(os.path.join(sources_list_d, '*.sources'))[0]
326+
327+with open(first_sources_path) as sources:
328+ for para in deb822.Deb822.iter_paragraphs(sources):
329+ if 'URIs' in para:
330+ print(para['URIs'].split()[0])
331+ sys.exit()
332diff --git a/tools/list2cds b/tools/list2cds
333index 1100519..e7884ee 100755
334--- a/tools/list2cds
335+++ b/tools/list2cds
336@@ -25,7 +25,6 @@ my $maxcds = 1;
337 my $overflowbincds = $ENV{'OVERFLOWBINCDS'} || 1;
338
339 my $apt = "$ENV{'BASEDIR'}/tools/apt-selection";
340-my $adir = "$ENV{'APTTMP'}/$ENV{'CODENAME'}-$ENV{'FULLARCH'}";
341 my $dir = "$ENV{'TDIR'}/$ENV{'CODENAME'}-$ENV{'FULLARCH'}";
342 my $verbose = $ENV{'VERBOSE'} || 0;
343
344diff --git a/tools/list2src b/tools/list2src
345index 098a527..2741a55 100755
346--- a/tools/list2src
347+++ b/tools/list2src
348@@ -32,7 +32,6 @@ my $apt = "$ENV{'BASEDIR'}/tools/apt-selection";
349
350 my $apt_lists_cmd = `$apt config shell LISTS Dir::State::lists/d`;
351 my $apt_lists = `eval $apt_lists_cmd; echo \$LISTS`;
352-my $mirror = $ENV{'MIRROR'};
353 my $codename = $ENV{'CODENAME'};
354
355 $| = 1;
356@@ -72,10 +71,6 @@ foreach my $dist ( @distributions ) {
357 }
358 }
359
360-if ($nonfree or $extranonfree) {
361- push @SOURCES, "$mirror/dists/$codename/non-free/source/Sources.gz";
362-}
363-
364 foreach (@SOURCES) {
365 die "File `$_' cannot be found ..." if not -f;
366 }
367diff --git a/tools/scanpackages b/tools/scanpackages
368index 5712559..2841fee 100755
369--- a/tools/scanpackages
370+++ b/tools/scanpackages
371@@ -135,6 +135,8 @@ Tree "dists/$CODENAME" {
372 }
373 EOF
374
375+MIRROR=$($BASEDIR/tools/guess-mirror)
376+
377 # Creating the indices directory
378 if [ ! -d "$BDIR/indices" ]; then
379 mkdir $BDIR/indices
380diff --git a/tools/scansources b/tools/scansources
381index f0fc703..b1057c9 100755
382--- a/tools/scansources
383+++ b/tools/scansources
384@@ -97,6 +97,8 @@ Tree "dists/$CODENAME" {
385 }
386 EOF
387
388+MIRROR=$($BASEDIR/tools/guess-mirror)
389+
390 # Creating the indices directory
391 if [ ! -d "$SDIR/indices" ]; then
392 mkdir $SDIR/indices

Subscribers

People subscribed via source and target branches