2018-07-31 02:33:33 +00:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
#
|
|
|
|
# generate_debian-edu_task
|
|
|
|
#
|
|
|
|
# Work out which education packages we need
|
|
|
|
#
|
|
|
|
# Copyright Steve McIntyre <93sam@debian.org> 2018
|
|
|
|
#
|
|
|
|
# GPL 2
|
|
|
|
#
|
2018-07-30 08:17:09 +00:00
|
|
|
|
2018-07-31 02:33:33 +00:00
|
|
|
my ($mirror, $codename, $archlist, $outfile, $localdebs);
|
|
|
|
my $date;
|
|
|
|
my $pkgfiles = "";
|
|
|
|
my ($pkg, $filename, $arch);
|
|
|
|
my %seen;
|
2018-07-30 08:17:09 +00:00
|
|
|
|
2018-07-31 02:33:33 +00:00
|
|
|
$codename = $ENV{'CODENAME'};
|
|
|
|
$mirror = $ENV{'MIRROR'};
|
|
|
|
$localdebs = $ENV{'LOCALDEBS'};
|
|
|
|
$archlist = shift;
|
|
|
|
$outfile = shift;
|
2018-07-30 08:17:09 +00:00
|
|
|
|
2018-07-31 02:33:33 +00:00
|
|
|
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
|
|
|
|
|
2018-08-01 10:01:33 +00:00
|
|
|
# Ignore a few tasks that we don't want, e.g. education-development,
|
|
|
|
# it's too big and pulls in all sorts of things that end users won't
|
|
|
|
# want/need
|
|
|
|
my @ignore_list = ('education-development',
|
2018-08-08 22:22:09 +00:00
|
|
|
'education-video');
|
2018-08-01 10:01:33 +00:00
|
|
|
|
2018-07-31 02:33:33 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2018-08-01 10:01:33 +00:00
|
|
|
# Except things on the ignore list
|
|
|
|
if (grep {$_ eq $pkg} @ignore_list) {
|
|
|
|
next;
|
|
|
|
}
|
2018-07-31 02:33:33 +00:00
|
|
|
|
|
|
|
print OUT "$pkg\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
close INPKG;
|
|
|
|
close OUT;
|