Replace generate_debian-edu_task with a perl script parsing Packages

Apt setup hasn't happened yet, so we can't use the apt
wrapper. Instead, use simple perl code derived from
generate_firmware_task.
This commit is contained in:
Steve McIntyre 2018-07-31 03:33:33 +01:00
parent adb7d349b8
commit 60f1e082d8
2 changed files with 72 additions and 6 deletions

View File

@ -171,7 +171,7 @@ ifeq ($(FORCE_FIRMWARE),1)
endif
ifeq ($(DEBIAN_EDU),1)
# Generate Debian Edu task file containing (almost) all of Debian Edu's packages
$(Q)$(BASEDIR)/tools/generate_debian-edu_task $(TASKDIR)/debian-edu-full
$(Q)$(BASEDIR)/tools/generate_debian-edu_task "$(ARCHES)" $(TASKDIR)/debian-edu-full
endif
endif
$(BDIR)/DATE:

View File

@ -1,8 +1,74 @@
#!/bin/sh
#!/usr/bin/perl -w
#
# generate_debian-edu_task
#
# Work out which education packages we need
#
# Copyright Steve McIntyre <93sam@debian.org> 2018
#
# GPL 2
#
set -e
my ($mirror, $codename, $archlist, $outfile, $localdebs);
my $date;
my $pkgfiles = "";
my ($pkg, $filename, $arch);
my %seen;
APT=$BASEDIR/tools/apt-selection
$codename = $ENV{'CODENAME'};
$mirror = $ENV{'MIRROR'};
$localdebs = $ENV{'LOCALDEBS'};
$archlist = shift;
$outfile = shift;
# include all the education packages except education-development
$APT list 'education-*' 2>/dev/null | cut -d '/' -f1 | grep -v education-development > $1
if (!defined($codename) || !defined($mirror) ||
!defined($archlist) || !defined($outfile)) {
die "Error in arguments\n";
}
foreach $arch (split(' ', $archlist)) {
$pkgfiles = "$pkgfiles $mirror/dists/$codename/*/binary-$arch/Packages.gz";
$pkgfiles = "$pkgfiles $mirror/dists/$codename/*/binary-$arch/Packages.xz";
}
if (defined($localdebs)) {
foreach $arch (split(' ', $archlist)) {
$pkgfiles = "$pkgfiles $localdebs/dists/$codename/*/binary-$arch/Packages.gz";
$pkgfiles = "$pkgfiles $localdebs/dists/$codename/*/binary-$arch/Packages.xz";
}
}
open (OUT, "> $outfile") or die "Can't open outfile for writing: $!\n";
$date = `date -u`;
chomp $date;
print OUT "/*\n";
print OUT " * 'debian-edu-full' task file; generated automatically by generate_debian-edu_task\n";
print OUT " * for \"$archlist\" on $date\n";
print OUT " * Do not edit - changes will not be preserved\n";
print OUT " */\n";
open (INPKG, "\$BASEDIR/tools/catz $pkgfiles |") or die "Can't read input package files: $!\n";
$/ = ''; # Browse by paragraph
while (defined($_ = <INPKG>)) {
m/^Package: (\S+)/m and $pkg = $1;
m/^Filename: (\S+)/m and $filename = $1;
# We want all packages matching "^education-"
if (! ($pkg =~ /^education-/)) {
next;
}
# *Except* education-development, it's too big and pulls in all
# sorts of things that end users won't want/need
if ($pkg =~ /^education-development/) {
next;
}
print OUT "$pkg\n";
}
close INPKG;
close OUT;