diff --git a/Makefile b/Makefile index 78b07bcf..7ddbf48f 100755 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/tools/generate_debian-edu_task b/tools/generate_debian-edu_task index 17959b16..c8098484 100755 --- a/tools/generate_debian-edu_task +++ b/tools/generate_debian-edu_task @@ -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($_ = )) { + 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;