2012-06-05 17:04:04 +00:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
my $arch;
|
|
|
|
my $old_split = $/;
|
|
|
|
my (@desktop_tasks, @user_tasks, @l10n_tasks, @server_tasks, @special_tasks);
|
|
|
|
my ($section, $taskname);
|
|
|
|
|
|
|
|
my $codename = $ENV{'CODENAME'};
|
|
|
|
if (! defined($codename)) {
|
|
|
|
die "update_tasks: codename not specified\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
my $mirror = $ENV{'MIRROR'};
|
|
|
|
if (! defined($mirror)) {
|
|
|
|
die "update_tasks: mirror not specified\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
my $bdir = $ENV{'BDIR'};
|
|
|
|
if (! defined($bdir)) {
|
|
|
|
die "update_tasks: temp dir not specified\n";
|
2008-12-05 13:12:10 -01:00
|
|
|
}
|
2008-10-12 23:08:57 +00:00
|
|
|
|
2012-06-05 17:04:04 +00:00
|
|
|
my $basedir = $ENV{'BASEDIR'};
|
|
|
|
if (! defined($basedir)) {
|
|
|
|
die "update_tasks: basedir not specified\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
my $tdir = "$bdir/update_tasks";
|
|
|
|
system("mkdir -p $tdir");
|
|
|
|
|
2014-09-26 21:41:39 +00:00
|
|
|
# Default to using tasksel and tasks data from the same release we're
|
|
|
|
# using, but allow it to be overridden. For testing purposes - set up
|
|
|
|
# FORCE_SID_TASKSEL to force us to use sid's tasksel data even if
|
|
|
|
# we're using stable/testing.
|
|
|
|
my $tasks_codename = $codename;
|
|
|
|
if (defined($ENV{'FORCE_SID_TASKSEL'}) and $ENV{'FORCE_SID_TASKSEL'} eq '1') {
|
|
|
|
print "update_tasks: forcing use of sid tasksel data\n";
|
|
|
|
$tasks_codename = "sid";
|
|
|
|
}
|
|
|
|
|
2012-06-05 17:04:04 +00:00
|
|
|
# Look for the coreutils package (which should exist in all archs, and
|
|
|
|
# is a non -all package) to determine a valid arch for the rest of
|
|
|
|
# this script
|
|
|
|
my $coreutils_deb = `$basedir/tools/which_deb $mirror $codename coreutils binary`;
|
|
|
|
if ($coreutils_deb =~ m/_([[:alnum:]]+)\.deb/) {
|
|
|
|
$arch = $1;
|
|
|
|
} else {
|
|
|
|
die "update_tasks: Can't determine arch!\n";
|
|
|
|
}
|
|
|
|
|
2013-11-05 00:29:40 -01:00
|
|
|
# used in a few places to decide what happens when doing "generic"
|
|
|
|
# discs.
|
|
|
|
my $default_desktop;
|
|
|
|
|
|
|
|
# Find the dependency information of the task-desktop deb to see what
|
|
|
|
# the default desktop should be
|
2014-09-26 21:41:39 +00:00
|
|
|
my $task_desktop_deb = `$basedir/tools/which_deb $mirror $tasks_codename task-desktop binary`;
|
2013-11-05 00:29:40 -01:00
|
|
|
open (TASKS, "dpkg --info $mirror/$task_desktop_deb |") or
|
|
|
|
die "update_tasks: Can't run dpkg --info $mirror/$task_desktop_deb; $!\n";
|
|
|
|
while (<TASKS>) {
|
|
|
|
chomp;
|
|
|
|
/Recommends: task-(\S+)*-desktop/ and $default_desktop = $1;
|
|
|
|
}
|
|
|
|
print "update_tasks: Using \"$default_desktop\" as the default desktop, as specified by $task_desktop_deb\n";
|
|
|
|
|
2012-06-05 17:04:04 +00:00
|
|
|
# Extract the tasksel-data deb for our suite; we need to parse the
|
|
|
|
# data in it
|
2014-09-26 21:41:39 +00:00
|
|
|
my $tasksel_deb = `$basedir/tools/which_deb $mirror $tasks_codename tasksel-data binary`;
|
2012-06-05 17:04:04 +00:00
|
|
|
$tasksel_deb = "$mirror/$tasksel_deb";
|
|
|
|
chomp $tasksel_deb;
|
|
|
|
|
|
|
|
# Several types of task package we care about:
|
|
|
|
#
|
|
|
|
# task-$DESKTOP-desktop - core package set for desktop $DESKTOP
|
|
|
|
# task-$LANGUAGE - core package set for language $LANGUAGE
|
|
|
|
# task-$LANGUAGE-desktop - general desktop i18n packages for $LANGUAGE
|
|
|
|
# task-$LANGUAGE-$DESKTOP-desktop - i18n packages for $DESKTOP, $LANGUAGE
|
|
|
|
# task-$FOO - package set for $FOO (mail-server, laptop, etc.)
|
|
|
|
#
|
|
|
|
# VERY much complicated by the freeform style of the names here:
|
|
|
|
# * languages can be 1, 2 or 3 words (eg. english, brazilian-portuguese, south-african-english)
|
|
|
|
# * non-desktop tasks can be 1 or 2 words (e.g. laptop, file-server)
|
|
|
|
#
|
|
|
|
# Need to parse debian-tasks.desc to work out what each type is
|
|
|
|
|
|
|
|
system("dpkg -x $tasksel_deb $tdir/tasksel");
|
|
|
|
|
|
|
|
my $descfile = "usr/share/tasksel/descs/debian-tasks.desc";
|
|
|
|
|
|
|
|
open (TASKS, "$tdir/tasksel/$descfile")
|
|
|
|
or die "can't open $tdir/tasksel/$descfile: $!\n";
|
|
|
|
|
|
|
|
while (defined (my $task = <TASKS>)) {
|
|
|
|
chomp $task;
|
|
|
|
if ($task =~ m/^Task: (\S+)/) {
|
|
|
|
$taskname = $1;
|
2008-06-07 00:02:36 +00:00
|
|
|
}
|
2012-06-05 17:04:04 +00:00
|
|
|
if ($task =~ m/^Section: (\S+)/) {
|
|
|
|
$section = $1;
|
|
|
|
if ($section eq "l10n") {
|
|
|
|
push (@l10n_tasks, $taskname);
|
|
|
|
} elsif ($section eq "server") {
|
|
|
|
push (@server_tasks, $taskname);
|
|
|
|
} elsif ($section eq "user") {
|
|
|
|
if ($taskname =~ m/^[[:alnum:]]+-desktop/) {
|
|
|
|
push (@desktop_tasks, $taskname);
|
|
|
|
} else {
|
|
|
|
push (@user_tasks, $taskname);
|
|
|
|
}
|
|
|
|
} elsif ($section eq "special") {
|
|
|
|
push (@special_tasks, $taskname);
|
|
|
|
} else {
|
|
|
|
die "update_tasks: task $taskname has unknown section $section!\n";
|
2008-06-07 00:02:36 +00:00
|
|
|
}
|
2012-06-05 17:04:04 +00:00
|
|
|
|
2008-06-07 00:02:36 +00:00
|
|
|
}
|
2012-06-05 17:04:04 +00:00
|
|
|
}
|
|
|
|
close TASKS;
|
|
|
|
|
|
|
|
#print "l10n: @l10n_tasks\n";
|
|
|
|
#print "desktop: @desktop_tasks\n";
|
|
|
|
#print "user: @user_tasks\n";
|
|
|
|
#print "server: @server_tasks\n";
|
|
|
|
#print "special: @special_tasks\n";
|
|
|
|
|
2012-06-05 17:28:41 +00:00
|
|
|
# Reduce special-casing and duplicate code. Add "light-desktop",
|
|
|
|
# "generic-desktop" and "all-desktop" tasks that we can use here.
|
|
|
|
push (@desktop_tasks, "light-desktop");
|
2012-06-05 17:04:04 +00:00
|
|
|
push (@desktop_tasks, "generic-desktop");
|
|
|
|
push (@desktop_tasks, "all-desktop");
|
|
|
|
|
|
|
|
# Write out all the groupings
|
|
|
|
foreach my $desktop (@desktop_tasks) {
|
|
|
|
my $filename;
|
|
|
|
my $desktop_name = $desktop;
|
|
|
|
$desktop_name =~ s/-desktop//g;
|
|
|
|
|
|
|
|
# Essential; $DESKTOP
|
|
|
|
$filename = "task-essential-$desktop_name";
|
|
|
|
open (DESKOUT, "> $filename") or die "can't open file $filename for writing, $!\n";
|
|
|
|
|
|
|
|
# in all-desktop, add all the desktop tasks
|
|
|
|
if ($desktop_name eq "all") {
|
|
|
|
foreach my $taskname (@desktop_tasks) {
|
|
|
|
print DESKOUT "task-$taskname\n";
|
2008-06-07 00:02:36 +00:00
|
|
|
}
|
2012-06-05 17:04:04 +00:00
|
|
|
} elsif ($desktop_name eq "generic") {
|
2013-11-05 00:29:40 -01:00
|
|
|
print DESKOUT "task-$default_desktop-desktop\n";
|
2012-06-05 17:28:41 +00:00
|
|
|
} elsif ($desktop_name eq "light") {
|
|
|
|
print DESKOUT "task-lxde-desktop\n";
|
|
|
|
print DESKOUT "task-xfce-desktop\n";
|
2012-06-05 17:04:04 +00:00
|
|
|
} else {
|
|
|
|
print DESKOUT "task-$desktop\n";
|
2008-06-07 00:02:36 +00:00
|
|
|
}
|
2006-12-29 05:05:30 -01:00
|
|
|
|
2012-06-05 17:04:04 +00:00
|
|
|
# generic-desktop and all-desktop want all the server and user
|
|
|
|
# tasks included too
|
|
|
|
if ($desktop_name eq "all" or $desktop_name eq "generic") {
|
|
|
|
foreach my $taskname (@user_tasks) {
|
|
|
|
print DESKOUT "task-$taskname\n";
|
|
|
|
}
|
|
|
|
foreach my $taskname (@server_tasks) {
|
|
|
|
print DESKOUT "task-$taskname\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close DESKOUT;
|
2011-08-06 16:17:24 +00:00
|
|
|
|
2012-06-05 17:04:04 +00:00
|
|
|
# Full; $DESKTOP
|
|
|
|
$filename = "task-full-$desktop_name";
|
|
|
|
open (DESKOUT, "> $filename") or die "can't open file $filename for writing, $!\n";
|
2008-06-07 17:03:44 +00:00
|
|
|
|
2012-06-05 17:04:04 +00:00
|
|
|
# in all-desktop, add all the desktop tasks now
|
|
|
|
if ($desktop_name eq "all") {
|
|
|
|
foreach my $taskname (@desktop_tasks) {
|
|
|
|
print DESKOUT "task-$taskname\n";
|
2008-06-07 17:03:44 +00:00
|
|
|
}
|
2012-06-05 17:04:04 +00:00
|
|
|
} elsif ($desktop_name eq "generic") {
|
2013-11-05 00:29:40 -01:00
|
|
|
print DESKOUT "task-$default_desktop-desktop\n";
|
2012-06-05 17:28:41 +00:00
|
|
|
} elsif ($desktop_name eq "light") {
|
|
|
|
print DESKOUT "task-lxde-desktop\n";
|
|
|
|
print DESKOUT "task-xfce-desktop\n";
|
2012-06-05 17:04:04 +00:00
|
|
|
} else {
|
|
|
|
print DESKOUT "task-$desktop\n";
|
2008-06-07 17:03:44 +00:00
|
|
|
}
|
2012-06-05 17:04:04 +00:00
|
|
|
|
|
|
|
# generic-desktop and all-desktop want all the server and user
|
|
|
|
# tasks included too
|
|
|
|
if ($desktop_name eq "all" or $desktop_name eq "generic") {
|
|
|
|
foreach my $taskname (@user_tasks) {
|
|
|
|
print DESKOUT "task-$taskname\n";
|
2008-06-07 17:03:44 +00:00
|
|
|
}
|
2012-06-05 17:04:04 +00:00
|
|
|
foreach my $taskname (@server_tasks) {
|
|
|
|
print DESKOUT "task-$taskname\n";
|
2008-06-07 17:03:44 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-05 17:04:04 +00:00
|
|
|
|
|
|
|
# task-$LANGUAGE, same for all flavours
|
|
|
|
foreach my $taskname (@l10n_tasks) {
|
|
|
|
if ($taskname !~ m/desktop/) {
|
|
|
|
print DESKOUT "task-$taskname\n";
|
2008-06-07 17:03:44 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-05 17:04:04 +00:00
|
|
|
|
|
|
|
# task-$LANGUAGE-desktop, same for all flavours
|
|
|
|
foreach my $taskname (@l10n_tasks) {
|
|
|
|
if ($taskname =~ m/desktop/) {
|
|
|
|
my $include = 1;
|
|
|
|
foreach my $dsk (@desktop_tasks) {
|
|
|
|
if ($taskname =~ m/$dsk/) {
|
|
|
|
$include = 0;
|
|
|
|
last;
|
2008-06-07 17:03:44 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-05 17:04:04 +00:00
|
|
|
if ($include) {
|
|
|
|
print DESKOUT "task-$taskname\n";
|
|
|
|
}
|
2008-06-07 17:03:44 +00:00
|
|
|
}
|
2012-06-05 17:04:04 +00:00
|
|
|
}
|
2006-12-29 05:05:30 -01:00
|
|
|
|
2012-06-05 17:04:04 +00:00
|
|
|
# in all-desktop, add all the desktop l10n tasks
|
|
|
|
if ($desktop_name eq "all") {
|
|
|
|
# task-$LANGUAGE-$DESKTOP-desktop
|
|
|
|
foreach my $taskname (@l10n_tasks) {
|
|
|
|
foreach my $dsk (@desktop_tasks) {
|
|
|
|
if ($taskname =~ m/$dsk/) {
|
|
|
|
print DESKOUT "task-$taskname\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-06-07 00:02:36 +00:00
|
|
|
|
2012-06-05 17:04:04 +00:00
|
|
|
} elsif ($desktop_name eq "generic") {
|
|
|
|
# in generic-desktop, add the desktop l10n tasks as though for
|
2013-11-05 00:29:40 -01:00
|
|
|
# $default_desktop *first*. Others will come later
|
2012-06-05 17:04:04 +00:00
|
|
|
|
|
|
|
# task-$LANGUAGE-$DESKTOP-desktop
|
|
|
|
foreach my $taskname (@l10n_tasks) {
|
2013-11-05 00:29:40 -01:00
|
|
|
if ($taskname =~ m/$default_desktop/) {
|
2012-06-05 17:04:04 +00:00
|
|
|
print DESKOUT "task-$taskname\n";
|
|
|
|
}
|
|
|
|
}
|
2013-11-05 00:29:40 -01:00
|
|
|
# task-!$default_desktop-desktop
|
2012-06-05 17:04:04 +00:00
|
|
|
foreach my $taskname (@desktop_tasks) {
|
2013-11-05 00:29:40 -01:00
|
|
|
if ($taskname !~ m/$default_desktop/) {
|
2012-06-05 17:04:04 +00:00
|
|
|
print DESKOUT "task-$taskname\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-05 00:29:40 -01:00
|
|
|
# task-$LANGUAGE-!$default_desktop-desktop
|
2012-06-05 17:04:04 +00:00
|
|
|
foreach my $taskname (@l10n_tasks) {
|
|
|
|
if ($taskname =~ m/desktop$/) {
|
|
|
|
my $include = 0;
|
|
|
|
foreach my $dsk (@desktop_tasks) {
|
2013-11-05 00:29:40 -01:00
|
|
|
if ($dsk !~ m/$default_desktop/ and $taskname =~ m/$dsk/) {
|
2012-06-05 17:04:04 +00:00
|
|
|
$include = 1;
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($include) {
|
|
|
|
print DESKOUT "task-$taskname\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-06-05 17:28:41 +00:00
|
|
|
} elsif ($desktop_name eq "light") {
|
|
|
|
# task-$LANGUAGE-$DESKTOP-desktop
|
|
|
|
foreach my $taskname (@l10n_tasks) {
|
|
|
|
if ($taskname =~ m/lxde/ or $taskname =~ m/xfce/) {
|
|
|
|
print DESKOUT "task-$taskname\n";
|
|
|
|
}
|
|
|
|
}
|
2012-06-05 17:04:04 +00:00
|
|
|
} else {
|
|
|
|
# a specific desktop, just add the desktop l10n tasks for this
|
|
|
|
# desktop
|
|
|
|
|
|
|
|
# task-$LANGUAGE-$DESKTOP-desktop
|
|
|
|
foreach my $taskname (@l10n_tasks) {
|
|
|
|
if ($taskname =~ m/$desktop_name/) {
|
|
|
|
print DESKOUT "task-$taskname\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close DESKOUT;
|
|
|
|
}
|