[Cdd-commits] r451 - in cdd/trunk/cdd: . debian devtools examples/common examples/config examples/debian mans_old templates

CDD Subversion Commit noreply at alioth.debian.org
Mon Aug 27 17:48:49 UTC 2007


Author: tille
Date: Mon Aug 27 17:48:49 2007
New Revision: 451

Added:
   cdd/trunk/cdd/devtools/
   cdd/trunk/cdd/devtools/Makefile   (contents, props changed)
   cdd/trunk/cdd/devtools/cdd-gen-control   (contents, props changed)
   cdd/trunk/cdd/devtools/cdd-get-names   (contents, props changed)
   cdd/trunk/cdd/devtools/cdd-install-helper   (contents, props changed)
   cdd/trunk/cdd/devtools/rules   (contents, props changed)
   cdd/trunk/cdd/examples/config/
      - copied from r450, cdd/trunk/cdd/examples/common/
   cdd/trunk/cdd/mans_old/
   cdd/trunk/cdd/mans_old/cdd-gen-control.1
   cdd/trunk/cdd/mans_old/cdd-install-helper.1
   cdd/trunk/cdd/templates/config.config   (contents, props changed)
   cdd/trunk/cdd/templates/config.install
   cdd/trunk/cdd/templates/config.links
   cdd/trunk/cdd/templates/config.postinst   (contents, props changed)
   cdd/trunk/cdd/templates/config.templates
Removed:
   cdd/trunk/cdd/cdd-clean-helper
   cdd/trunk/cdd/cdd-clean-helper.1
   cdd/trunk/cdd/cdd-gen-control
   cdd/trunk/cdd/cdd-gen-control.1
   cdd/trunk/cdd/cdd-install-helper
   cdd/trunk/cdd/cdd-install-helper.1
   cdd/trunk/cdd/examples/common/
   cdd/trunk/cdd/templates/common.config
   cdd/trunk/cdd/templates/common.install
   cdd/trunk/cdd/templates/common.links
   cdd/trunk/cdd/templates/common.postinst
   cdd/trunk/cdd/templates/common.templates
Modified:
   cdd/trunk/cdd/Changelog
   cdd/trunk/cdd/VERSION
   cdd/trunk/cdd/debian/cdd-dev.install
   cdd/trunk/cdd/debian/changelog
   cdd/trunk/cdd/debian/control
   cdd/trunk/cdd/examples/debian/compat
   cdd/trunk/cdd/examples/debian/control.stub
   cdd/trunk/cdd/examples/debian/rules
Log:
New version 0.4 with several changes (see ChangeLog)


Modified: cdd/trunk/cdd/Changelog
==============================================================================
--- cdd/trunk/cdd/Changelog	(original)
+++ cdd/trunk/cdd/Changelog	Mon Aug 27 17:48:49 2007
@@ -1,3 +1,35 @@
+cdd 0.4
+-------
+
+2007-08-23 Andreas Tille <tille at debian.org>
+  - cdd-gen-control is nearly identical to debian-ed/gen-control
+    (which was patched to replace edu/education by variables)
+  - devtools/
+       rules: General rules file to build meta packages
+       Makefile: make debian/control for a CDD
+       cdd-get-names: Read releavant CDD names from
+       debian/control.stub
+  - now build CDD-config package which was formerly named
+    CDD-common; several renamings in the templates, examples
+    and code from common to config were necessary
+  - moved cdd-gen-control to /usr/share/cdd-dev because
+    there is no reason to call it directly any more but
+    rather via make
+  - moved cdd-install-helper to /usr/share/cdd-dev because
+    its only use is to be called from rules file and there
+    is no sense to bloat /usr/bin with this stuff
+  - dropped cdd-clean-helper - the code was moved to
+    the rules file
+  - do not install the man pages for cdd-gen-control,
+    cdd-install-helper (and obviousely not for the removed
+    cdd-clean-helper any more because
+  - /usr/share/cdd-dev/cdd-get-names obtains certain
+    CDD specific names
+
+
+cdd 0.3.11 and earlier
+----------------------
+
 Changes to gen-control
   - Use /etc/cdd/sources.list as default sources.list
     If "-s <dist>" is specified /etc/cdd/sources.list.<dist>

Modified: cdd/trunk/cdd/VERSION
==============================================================================
--- cdd/trunk/cdd/VERSION	(original)
+++ cdd/trunk/cdd/VERSION	Mon Aug 27 17:48:49 2007
@@ -1 +1 @@
-0.3.11.1
+0.4

Modified: cdd/trunk/cdd/debian/cdd-dev.install
==============================================================================
--- cdd/trunk/cdd/debian/cdd-dev.install	(original)
+++ cdd/trunk/cdd/debian/cdd-dev.install	Mon Aug 27 17:48:49 2007
@@ -1,5 +1,3 @@
-cdd-gen-control     usr/bin
-cdd-install-helper  usr/bin
-cdd-clean-helper    usr/bin
 sources.list*       etc/cdd
 templates           usr/share/cdd
+devtools/*          usr/share/cdd-dev

Modified: cdd/trunk/cdd/debian/changelog
==============================================================================
--- cdd/trunk/cdd/debian/changelog	(original)
+++ cdd/trunk/cdd/debian/changelog	Mon Aug 27 17:48:49 2007
@@ -1,3 +1,12 @@
+cdd (0.4) unstable; urgency=low
+
+  * New upstream version that cdd-gen-control in favour of a newly
+    adopted gen-control from Debian-Edu 0.821.
+    (Please see the upstream changelog for all changes)
+    Closes: #436831
+
+ -- Andreas Tille <tille at debian.org>  Tue, 21 Aug 2007 20:56:39 +0200
+
 cdd (0.3.11.1) unstable; urgency=low
 
   * Remove Bashism (source --> .)

Modified: cdd/trunk/cdd/debian/control
==============================================================================
--- cdd/trunk/cdd/debian/control	(original)
+++ cdd/trunk/cdd/debian/control	Mon Aug 27 17:48:49 2007
@@ -9,7 +9,7 @@
 Package: cdd-dev
 Architecture: all
 Section: devel
-Depends: debconf (>= 0.5) | debconf-2.0
+Depends: debconf (>= 0.5) | debconf-2.0, make | build-essential
 Suggests: cdd-doc
 Description: Custom Debian Distributions common files for developing meta packages
  This package makes life easier when packaging meta packages.  Perhaps

Added: cdd/trunk/cdd/devtools/Makefile
==============================================================================
--- (empty file)
+++ cdd/trunk/cdd/devtools/Makefile	Mon Aug 27 17:48:49 2007
@@ -0,0 +1,49 @@
+#!/usr/bin/make -f
+
+# This Makefile is used to build a debian/control file
+# for a Custom Debian Distribution.
+#
+# Copyright (C) Andreas Tille <tille at debian.org>
+# License: GPL
+
+# TARGET_DIST is one of stable, sarge, etch, unstable, or any other available
+# sources.list file available
+TARGET_DIST := $(shell head -1 debian/changelog |awk '{print $$3}'|tr -d ';')
+CDD := $(shell /usr/share/cdd-dev/cdd-get-names cddname)
+GENCONTROL := /usr/share/cdd-dev/cdd-gen-control
+
+# Verify whether config/control exists, if yes, add it to the depends of debian/control
+CONFIGCONTROL := $(shell if [ -d config -a -e config/control ] ; then echo config/control; fi)
+
+all: $(CDD)-tasks.desc debian/control
+
+debian/control: debian/control.stub debian/changelog tasks/* $(CONFIGCONTROL)
+	(cat debian/control.stub; \
+	 test -f config/control && cat config/control; \
+	$(GENCONTROL) -s $(TARGET_DIST) -D -c -m -i -A) > $@.new && mv $@.new $@
+
+tasksel: $(CDD)-tasks.desc
+$(CDD)-tasks.desc: tasks/* debian/changelog
+	$(GENCONTROL) -s $(TARGET_DIST) -t -A > $(CDD)-tasks.desc.new && mv $(CDD)-tasks.desc.new $(CDD)-tasks.desc
+
+packages.txt: tasks/*
+	$(GENCONTROL) -s $(TARGET_DIST) -a > packages.txt.$$$$ && mv packages.txt.$$$$ packages.txt
+
+avoidpackages.txt: tasks/* sources.list.$(TARGET_DIST)
+	$(GENCONTROL) -s $(TARGET_DIST) -e > avoidpackages.txt.$$$$ && mv avoidpackages.txt.$$$$ avoidpackages.txt
+
+by_vote:
+	rm -f by_vote
+	wget http://developer.skolelinux.no/popcon/by_vote
+
+packages-sorted.txt: packages.txt by_vote
+	for pkg in `cat packages.txt` ; do \
+		grep " $$pkg " by_vote ; \
+	done | LANG=C sort -r -n -k 4 -k 3 > packages-sorted.txt
+usage: packages-sorted.txt
+
+clean: 
+	rm -rf tmp
+	rm -f tasks/*~a
+	rm -rf tasksel
+	rm -f packages.txt by_vote packages-sorted.txt

Added: cdd/trunk/cdd/devtools/cdd-gen-control
==============================================================================
--- (empty file)
+++ cdd/trunk/cdd/devtools/cdd-gen-control	Mon Aug 27 17:48:49 2007
@@ -0,0 +1,631 @@
+#!/usr/bin/perl
+#
+# Authors:
+#       Petter Reinholdtsen <pere at hungry.com>
+#       Andreas Tille <tille at debian.org>
+# Date:   2001-08-23
+#
+# # $Id: cdd-gen-control 448 2007-08-11 08:02:48Z tille $
+#
+# Generate the control file used by the CDD task package.
+
+use warnings;
+use strict;
+
+use Getopt::Std;
+use File::Path;
+
+use vars qw(%opts %available %excluded %included @wanted %missing
+            @tasks $debug);
+my @arch = qw(alpha arm i386 ia64 m68k mips mipsel powerpc s390 sparc hppa);
+
+my $debug = 0;
+my $nodepends = 0;
+my $ignoreapterrors = 0;
+
+my %taskinfo = ();
+my $tasksdir = "tasks" ;
+my $taskcontrolfile = "tasks.ctl" ;
+
+my $aptsourcesdefaultlocation = "/etc/cdd";
+my $aptsources = $aptsourcesdefaultlocation . "/sources.list";
+
+my %commondepends ;
+$commondepends{"adduser"}    = "0" ;
+$commondepends{"debconf"}    = "1.2" ;
+$commondepends{"menu"}       = "2.1.14" ;
+# the VERSION variable is replaced in the dist target of debian/rules
+$commondepends{"cdd-common"} = "0.3.10" ;
+
+my $CommonPackage = "" ;
+my $prefix        = "test-" ;
+my $cddname       = "" ;
+my $cddshortname  = "" ;
+my $tasksname     = "" ;
+my $hasconfig     = 0 ;
+
+sub usage() {
+    print STDERR << "EOF";
+gen-control help screen
+usage: $0 [options]
+
+   -a               : print wanted packages
+   -A               : ignore APT errors
+   -c               : create new debian/control file
+   -d               : print debug information
+   -D               : lover all Depends: to Recommends:
+   -e               : print excluded packages
+   -h               : print this help screen and exit
+   -i               :
+   -m               : print missing packages
+   -s <sourcefile>  : specify which sources.list file to use
+   -t               : print task descriptions and package list for task
+
+example: $0 -s sources.list.etch -D -c -m -i
+EOF
+}
+
+getopts("cdaemis:tDhA", \%opts);
+
+usage() and exit if $opts{'h'};
+
+my $aptsourcesinput = $opts{'s'} if ($opts{'s'});
+$aptsources = $aptsourcesinput ;
+if ( $aptsources !~ m%^/% && $aptsources !~ /^sources\.list\./ ) { 
+    my $cwd ;
+    chomp($cwd = `pwd`) ;
+    $aptsources = $cwd . "/sources.list." . $aptsources ;
+}
+if ( ! -e $aptsources ) {
+    $aptsources = $aptsourcesdefaultlocation . "/sources.list." . $aptsourcesinput;
+    if ( ! -e $aptsources ) {
+	die "Apt sources.list $aptsources not found.\n" ;
+    }
+}
+
+$debug = 1 if ($opts{'d'});
+$nodepends = 1 if ($opts{'D'});
+$ignoreapterrors = 1 if ($opts{'A'});
+
+cdd_init();
+
+# print "$prefix ; $cddshortname ; $cddname ; $tasksname \n";
+
+load_available_packages();
+
+load_tasks();
+
+# An ordered list of CDD tasks, in priority order of which are
+# most needed on the CD. Only leaf tasks need be listed.
+my @priorityorder = get_priorities("priority-high", 1);
+my @medpriorder   = get_priorities("priority-med", 0);
+
+# print "high: @priorityorder\nmed: @medpriorder\n" ;
+
+if ($opts{'c'}) {
+    gen_control();
+} elsif ($opts{'e'}) {
+    print_excluded_packages();
+} elsif ($opts{'a'}) {
+    print_all_packages();
+} elsif ($opts{'t'}) {
+    print_task_desc();
+} else {
+    print_available_packages();
+}
+print_missing_packages() if ($opts{'m'});
+
+sub apt {
+    my $op = shift;
+
+    my $aptdir  = "../tmp/apt";
+    my @aptopts = ("Dir::Etc::sourcelist=$aptsources",
+                   "Dir::State=$aptdir/state",
+                   "Dir::Cache=$aptdir/cache",
+                   "Dir::State::Status=/dev/null",
+                   "Debug::NoLocking=true");
+
+    # Stupid apt-get and apt-cache do not understand the same arguments!
+    # I have to map them to different formats to get both working.
+
+    if ("update" eq $op) {
+        mkpath "$aptdir/state/lists/partial";
+        mkpath "$aptdir/cache/archives/partial";
+
+        my $aptget   = "apt-get --assume-yes -o " . join(" -o ", @aptopts);
+
+        print STDERR "aptget: $aptget\n" if $debug;
+        if (system("$aptget update 1>&2")) {
+            print STDERR "error: updating apt package lists failed\n";
+            exit 1 unless $ignoreapterrors;
+        }
+    } elsif ("apt-cache" eq "$op") {
+        my $aptcache = "apt-cache -o=" . join(" -o=", @aptopts);
+        print STDERR "aptcache: $aptcache\n" if $debug;
+        return $aptcache;
+    }
+}
+
+sub sort_uniq {
+    my $seen = shift;
+    my @list;
+    for my $entry (sort @_) {
+        push @list,$entry unless $seen->{$entry};
+        $seen->{$entry} = 1;
+    }
+    return @list;
+}
+
+sub uniq {
+    my $seen = shift;
+    my @list;
+    for my $entry (@_) {
+        push @list,$entry unless $seen->{$entry};
+        $seen->{$entry} = 1;
+    }
+    return @list;
+}
+
+sub gen_control {
+    my $task;
+    for $task (sort keys %taskinfo) {
+        print "Package: $task\n";
+
+        my $header;
+        for $header (qw(Section Architecture Priority)) {
+            print "$header: $taskinfo{$task}{$header}\n"
+                if (defined $taskinfo{$task}{$header});
+        }
+        my %seenlist;
+        if ($nodepends) {
+                # degrade dependencies to recommends
+	        if ( $tasksname ) {
+		    print "Depends: $tasksname";
+		    if ( $tasksname =~ /-tasks$/ ) {
+			print ' (= ${binary:Version})';
+		    }
+		    if ( $hasconfig ) {
+			print ', ' . $prefix . 'config (= ${binary:Version})';
+		    }
+		    print "\n" ;
+	        }
+                # Use common %seenlist, as it is no use listing
+                # packages both in recommends and suggest
+                my @list;
+                for $header (qw(Depends Recommends)) {
+                    push (@list, @{$taskinfo{$task}{$header}})
+                        if defined $taskinfo{$task}{$header};
+                }
+                my ($pkglist, $missinglist) = process_pkglist(join(",", at list));
+                my (@recommends, @suggests);
+                push @recommends, @{$pkglist};
+                push @suggests, @{$missinglist};
+#               push(@recommends, )
+#                    if defined $taskinfo{$task}{Depends};
+#               push(@recommends, )
+#                   if defined $taskinfo{$task}{Recommends};
+                push(@suggests, @{$taskinfo{$task}{Suggests}})
+                    if defined $taskinfo{$task}{Suggests};
+                print("Recommends: ",
+                      join(", ", sort_uniq(\%seenlist, @recommends)),"\n")
+                        if defined $taskinfo{$task}{Depends};
+                print("Suggests: ",
+                      join(", ", sort_uniq(\%seenlist, @suggests)),"\n")
+                    if @suggests;
+        }
+        else {
+                for $header (qw(Depends Recommends Suggests)) {
+                    print "$header: ", join(", ", sort_uniq(\%seenlist, @{$taskinfo{$task}{$header}})),"\n"
+                        if defined $taskinfo{$task}{$header};
+                }
+        }
+
+        # Description Description-long
+        print "Description: $taskinfo{$task}{Description}\n";
+        print "$taskinfo{$task}{'Description-long'}"; # Already contain newline
+
+        print "\n";
+    }
+}
+
+# List all depends, recommends and suggests packages as task packages.
+# Optionally, list depends as key packages, and the rest as task
+# packages.
+# Enable to list all dependencies as key packages
+my $task_depends_are_keys = 0;
+sub print_task_desc {
+        foreach my $task (sort keys %taskinfo) {
+                next if (exists $taskinfo{$task}{'Leaf'} &&
+                        $taskinfo{$task}{'Leaf'} eq 'false');
+
+                print "Task: $task\n";
+                print "Section: $cddname\n";
+                print "Description: $taskinfo{$task}{Description}\n";
+                print "$taskinfo{$task}{'Description-long'}"; # Already contain newline
+                print "Relevance: 10\n";
+                print "Key: \n";
+                print " $task\n";
+                my %seen;
+                $seen{$task} = 1;
+                if ($task_depends_are_keys) {
+                    foreach my $package (task_packages($task, "Depends")) {
+                        print " $package\n" unless $seen{$package};
+                        $seen{$package} = 1;
+                    }
+                }
+                print "Packages: list\n";
+                for my $header (qw(Depends Recommends)) {
+                    foreach my $package (task_packages($task, $header, 1)) {
+                        print " $package\n" unless $seen{$package};
+                        $seen{$package} = 1;
+                    }
+                }
+
+                print "\n";
+        }
+}
+
+sub select_alternative {
+    my $pkglist = shift;
+    return $pkglist;
+}
+
+sub task_packages {
+        my ($task, $header, $includealldeps) = @_;
+        my @packages = $task;
+        foreach my $package (@{$taskinfo{$task}{$header}}) {
+                if ($package=~/\|/) {
+                        # Tasksel doesn't allow boolean or-ing of
+                        # dependencies. Just take the first one that is
+                        # available.
+                        my $ok=0;
+                        foreach my $alternative (split(' | ', $package)) {
+                                if (! exists $taskinfo{$alternative} &&
+                                    ! exists $available{$alternative}) {
+                                        if (! exists $missing{$alternative}) {
+                                                $missing{$alternative} = 1;
+                                        }
+                                }
+                                else {
+                                        print STDERR "task_packages: choosing $alternative from $package\n" if $debug;
+                                        $package=$alternative;
+                                        $ok=1;
+                                        last;
+                                }
+                        }
+                        if (! $ok) {
+                                next;
+                        }
+                }
+                if (exists $taskinfo{$package}) {
+                        # Add packages from task recursively, since
+                        # tasksel does not support dependent tasks of
+                        # the type used by CDD
+                        if (defined $includealldeps && $includealldeps) {
+                                for my $h (qw(Depends Recommends)) {
+
+                                        push(@packages, $package,
+                                             task_packages($package, $h, 1));
+                            }
+                        } else {
+                                push(@packages, $package,
+                                     task_packages($package, $header));
+                        }
+                }
+                else {
+                        push @packages, $package;
+                }
+        }
+        return @packages;
+}
+
+#
+# Check the APT cache, and find the packages currently available.
+#
+sub load_available_packages
+{
+    apt("update");
+    my $aptcache = apt("apt-cache");
+    open(APT, "$aptcache dump |") || die "Unable to start apt-cache";
+    my $pkg;
+    while (<APT>) {
+        chomp;
+        if (/^Package: (.+)$/) {
+            $pkg = $1;
+            print STDERR "Found pkg '$pkg'\n" if $debug;
+        }
+        if (/^\s+Version:\s+(.+)/) {
+            print STDERR " pkg $pkg = ver $1\n" if $debug;
+#           print "C: $pkg $available{$pkg} lt $1\n" if ( exists $available{$pkg});
+            $available{$pkg} = $1 if ( ! exists $available{$pkg} ||
+                                       $available{$pkg} lt $1 );
+        }
+    }
+}
+
+#
+# Load all tasks
+#
+sub load_tasks {
+    my $taskfile;
+
+    # First document their existence, so they can depend on each other.
+    for $taskfile (<tasks/*>) {
+        next if (($taskfile eq "tasks/CVS") || ($taskfile eq "tasks/.svn"));
+        next if ($taskfile =~ m/~$/);
+
+        my $curpkg = $taskfile;
+        $curpkg =~ s%tasks/%$prefix%;
+        $available{$curpkg} = "n/a";
+
+        push(@tasks, "$taskfile:$curpkg");
+    }
+
+    # Next, load their content.
+    my $foo;
+    for $foo (@tasks) {
+        my ($taskfile, $curpkg) = $foo =~ m/^(.+):(.+)$/;
+        next if ("tasks/CVS" eq $taskfile);
+
+        load_task($taskfile, $curpkg);
+    }
+}
+
+sub process_pkglist {
+    my $pkgstring = shift;
+    my @pkglist = ();
+    my @missinglist = ();
+    my $packages;
+    for $packages (split(/\s*,\s*/, $pkgstring)) {
+        print "E: double comma?: $_\n" if ($packages =~ /^\s*$/ && $debug);
+        my $package;
+        my @alternates=split(/\s*\|\s*/, $packages);
+        my $alternatecount=0;
+        for $package (@alternates) {
+            print STDERR "Loading pkg '$package'\n" if $debug;
+            if ($package =~ /^-(.+)$/) {
+                $excluded{$1} = 1;
+            } elsif ( !exists $available{$package} ) {
+                if ( !exists $missing{$package}) {
+                    $missing{$package} = 1;
+                }
+                push(@missinglist, $package);
+            } else {
+                if ($alternatecount == 0) {
+                    #push(@pkglist, $package) if (! exists $pkglist[$package]);
+                    push(@pkglist, $package);
+                }
+                else {
+                    $pkglist[-1].=" | $package";
+                }
+                $alternatecount++;
+
+                if ( ! $included{$package} ) {
+                    push(@wanted, $package);
+                    $included{$package} = 1;
+                }
+            }
+        }
+    }
+    return (\@pkglist, \@missinglist);
+}
+
+sub load_task {
+    my ($taskfile, $curpkg) = @_;
+    open(TASKFILE, "<$taskfile") || die "Unable to open $taskfile";
+    my $line;
+
+    $taskinfo{$curpkg} = ();
+
+    print STDERR "Loading task $curpkg\n" if $debug;
+
+    while (<TASKFILE>) {
+        chomp;
+        next if (m/^\#/); # Skip comments
+        $line = $_;
+
+        # Append multi-line
+        while ($line =~ /\\$/) {
+            $line =~ s/\s*\\//;
+            $_ = <TASKFILE>;
+            chomp;
+            $line .= $_;
+        }
+        # Remove trailing space
+        $line =~ s/\s+$//;
+
+        $_ = $line;
+        $taskinfo{$curpkg}{'Section'}      = $1 if (m/^Section:\s+(.+)$/);
+        $taskinfo{$curpkg}{'Architecture'} = $1 if (m/^Architecture:\s+(.+)$/);
+
+        $taskinfo{$curpkg}{'Priority'}     = $1 if (m/^Priority:\s+(.+)$/);
+
+        $taskinfo{$curpkg}{'Leaf'}         = $1 if (m/^Leaf:\s+(.+)$/);
+
+        if (m/^Description:\s+(.+)$/) {
+            $taskinfo{$curpkg}{'Description'} = $1;
+            $taskinfo{$curpkg}{'Description-long'} = "";
+            while (<TASKFILE>) {
+                # End of description, pass next line to pattern matching
+                last if (m/^\S+/ || m/^\s*$/);
+
+                $taskinfo{$curpkg}{'Description-long'} .= $_;
+            }
+        }
+
+        next unless defined $_;
+
+        my $header;
+        for $header (qw(Depends Recommends Suggests)) {
+            if (m/^$header:\s+(.+)$/ && $1 !~ /^\s*$/) {
+                $taskinfo{$curpkg}{$header} = ()
+                    if (! exists $taskinfo{$curpkg}{$header});
+                my ($pkglist, $missinglist) = process_pkglist($1);
+                push(@{$taskinfo{$curpkg}{$header}}, @{$pkglist});
+
+                # Avoid missing packages in Depends lists, allow them
+                # in the two others.  Insert missing depends in
+                # suggests list.
+                if (@{$missinglist}) {
+                    if ("Depends" eq $header) {
+                        push(@{$taskinfo{$curpkg}{'Suggests'}}, @{$missinglist});
+                    } else {
+                        push(@{$taskinfo{$curpkg}{$header}}, @{$missinglist});
+                    }
+                }
+            }
+        }
+
+        if (/^Avoid:\s+(.+)$/) {
+            my @pkgs = split(/\s*,\s*/, $1);
+            my $packages;
+            for $packages (@pkgs) {
+                my $package;
+                for $package (split(/\s*\|\s*/, $packages)) {
+                    $excluded{$package} = 1;
+                }
+            }
+        }
+
+        if (/^Ignore:\s+(.+)$/) {
+            my @pkgs = split(/\s*,\s*/, $1);
+            my $packages;
+            for $packages (@pkgs) {
+                my $package;
+                for $package (split(/\s*\|\s*/, $packages)) {
+                    # Remove explanations, ie the paranteses at the end.
+                    $package =~ s/\s*\([^\)]*\)\s*$//;
+                    $missing{$package} = 1;
+                }
+            }
+        }
+    }
+    close(TASKFILE);
+    unless ( $taskinfo{$curpkg}{'Architecture'} ) { $taskinfo{$curpkg}{'Architecture'} = "all" ; }
+}
+
+sub print_excluded_packages {
+    print join("\n", sort keys %excluded),"\n";
+}
+
+sub print_available_packages {
+    print join("\n", @wanted),"\n";
+}
+
+sub print_all_pkgs_tasks {
+    my ($seenref, $headerlistref, @tasks) = @_;
+
+    my @headers;
+    if ( $headerlistref ) {
+      @headers = @{$headerlistref};
+    } else {
+      @headers = qw(Depends Recommends Suggests)
+    }
+
+    for my $header (@headers) {
+        print STDERR "  Processing $header\n" if $debug;
+        my %seentask;
+        for my $task (@tasks) {
+            next if $seentask{$task};
+            $seentask{$task} = 1;
+
+            print "# printing $header in $task\n";
+            print STDERR "   Printing $task\n" if $debug;
+
+            # Pick the first available if there are alternatives
+            my @pkgs = uniq($seenref, task_packages($task, $header), $task);
+            print join("\n", @pkgs), "\n" if @pkgs;
+        }
+    }
+}
+
+sub print_all_packages {
+    print STDERR "Printing all packages\n" if $debug;
+#    print join("\n", @wanted, keys %missing),"\n";
+
+    print "# First process the high priority tasks\n";
+    my %seenlist;
+    print_all_pkgs_tasks(\%seenlist, [qw(Depends Recommends)], @priorityorder );
+
+    print "# Next, medium priority tasks tasks\n";
+    print_all_pkgs_tasks(\%seenlist, [qw(Depends Recommends)], @medpriorder );
+
+    print "# Next process all the others, in alphabetic order\n";
+    print_all_pkgs_tasks(\%seenlist, undef, sort keys %taskinfo);
+
+    print "# And last, the alternatives we dropped above\n";
+    print join("\n", uniq(\%seenlist, @wanted, sort keys %missing)),"\n";
+}
+
+sub print_missing_packages {
+    if (%missing) {
+        print STDERR "Missing or avoided packages:\n";
+        my $package;
+        for $package (sort keys %missing) {
+            if (exists $available{$package}) {
+                print STDERR "  $package (v$available{$package} available)\n";
+            } else {
+                print STDERR "  $package\n";
+            }
+        }
+        exit 1 unless $opts{'i'};
+    }
+}
+
+## Additions by Andreas Tille
+
+sub get_priorities {
+    my ($prio, $default) = @_;
+    my @list = () ;
+
+    # if there is no taskcontrolfile every task has the same priority
+    if ( ! stat($taskcontrolfile) ) {
+	if ( ! $default ) { return (); }
+        print STDERR "No task control file found - setting all tasks priority high.\n" if $debug;
+	opendir(DIR, $tasksdir) || die("No tasks directory found.");
+        @list = grep { !/^\./ } readdir(DIR);
+        closedir DIR;
+	return @list;
+    }
+    # read taskcontrolfile and find priorities
+    print STDERR "Reading task control file.\n" if $debug;
+    open(PRIO,$taskcontrolfile) || die("Unable to read task control file.");
+    while (<PRIO>) {
+        chomp ;
+	if ( $_=~/^$prio\s*:\s*([-\w]+)/) {	
+	    push @list,$1;
+        }
+    }
+    close PRIO;
+
+    return @list;
+}
+
+sub cdd_init {
+    # initialise cdd name and other basic stuff
+    unless  ( -d "debian" ) {
+	mkdir("debian") || die "mkdir debian: $!";
+    }
+
+    unless ( open(STUB, "debian/control.stub" ) ) {
+        print STDERR "No template debian/control.stub.  Use test prefix.\n" ;
+    } else {
+        while ( <STUB> ) {
+            if ( /^Package: (\w+)/) {
+                $prefix  = $1."-";
+		$cddname = "debian-".$cddshortname ;
+		if ( /^Package:\s.*-tasks$/) {
+		    $tasksname = $prefix . "tasks";
+		}
+		last ;
+            }
+            if ( /^Source:\s+debian-(.+)$/) {
+		$cddshortname = $1 ;
+            }
+        }
+	close(STUB) ;
+    }
+    if  ( -d "config" && -e "config/control" ) {
+	$hasconfig = 1;
+    }
+}

Added: cdd/trunk/cdd/devtools/cdd-get-names
==============================================================================
--- (empty file)
+++ cdd/trunk/cdd/devtools/cdd-get-names	Mon Aug 27 17:48:49 2007
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# Read CDD specific names from debian/control.stub
+#
+# Copyright (C) Andreas Tille <tille at debian.org>
+# License: GPL
+
+# Return codes according to
+# http://epydoc.sourceforge.net/stdlib/posix-module.html
+
+CONTROLFILE=debian/control.stub
+
+if [ ! -e "$CONTROLFILE" ] ; then
+	echo "Missing control file $CONTROLFILE"
+	exit 72   # EX_OSFILE
+fi
+
+if [ "$#" -ne 1 ] ; then
+	echo "Missing argument"
+	echo "Usage: $0 cddname|cddshortname|metapackageprefix"
+	exit 64   #  EX_USAGE
+fi
+
+case "$1" in
+    cddname)
+        grep '^Source:[[:space:]]*debian-' "$CONTROLFILE" | \
+	    sed 's/^Source:[[:space:]]*//'
+	exit 0
+	;;
+    cddshortname)
+        grep '^Source:[[:space:]]*debian-' "$CONTROLFILE" | \
+	    sed 's/^Source:[[:space:]]*debian-//'
+	exit 0
+	;;
+    metapackageprefix)
+	grep '^Package:[[:space:]]*' "$CONTROLFILE" | \
+	    sed 's/^Package:[[:space:]]*\([[:alnum:]]\+\)-*.*/\1/'
+	exit 0
+	;;
+    *)
+	echo "Unknown argument $1"
+	echo "Usage: $0 cddname|cddshortname|metapackageprefix"
+	exit 64   #  EX_USAGE
+	;;
+esac

Added: cdd/trunk/cdd/devtools/cdd-install-helper
==============================================================================
--- (empty file)
+++ cdd/trunk/cdd/devtools/cdd-install-helper	Mon Aug 27 17:48:49 2007
@@ -0,0 +1,119 @@
+#!/bin/sh
+
+cdd=`/usr/share/cdd-dev/cdd-get-names metapackageprefix`
+menudir=usr/share/cdd/"$cdd"/menu
+
+SubstCDDName () {
+    sed -e "s/#CDD#/${cdd}/g" \
+        -e "s?\([/ ]\)\(config.templates:*\)?\1${cdd}-\2?" \
+        -e "s/#CDDNAME#/${CDDNAME}/g" /usr/share/cdd/templates/$1 >> \
+	debian/$2
+}
+
+# Make dependency from menu containing packages to the right #CDD#-config version
+version="(>= `dpkg-parsechangelog | grep "^Version:" | sed -e "s/^Version:[[:space:]]\+\([\.0-9]*\)[[:space:]]*/\1/"`)"
+
+# General Task registry, menu registration and post{inst,rm} preparation
+for pkg in `ls tasks | grep -v "^[a-z]*:$*" | grep -v "^$" | sort | uniq` ; do
+    # registration
+    if ! grep -q -w "^Task:" tasks/$pkg ; then
+	echo "Control file template tasks/$pkg does not contain 'Task:' field."
+	exit -1
+    fi
+    task=`grep -w "^Task:" tasks/"$pkg" | sed "s/^Task:[[:space:]]*\([^[:space:]]*\)/\1/"`
+    mkdir -p debian/"$cdd"-"$pkg"/usr/share/cdd/tasks/"$cdd"/
+    echo "$task" > debian/"$cdd"-"$pkg"/usr/share/cdd/tasks/"$cdd"/"$pkg"
+
+    # if we provide an extra menu which overrides some menus provided by
+    # the maintainers of the dependand packages move them now to the right
+    # directory
+    [ -d menu ] && [ -d menu/"$pkg" ] && \
+	    if [ `find menu/"$pkg" -maxdepth 1 -name \*.menu | wc -l` -gt 0 ] ; then
+	mkdir -p debian/"$cdd"-"$pkg"/"$menudir"
+	for dep in `find menu/"$pkg" -maxdepth 1 -name \*.menu` ; do
+		cp -a "$dep" debian/"$cdd"-"$pkg"/"$menudir"/`basename "$dep" .menu`
+        done
+    fi
+
+    # Provide a README.Debian in any case
+    mkdir -p debian/"$cdd"-"$pkg"/usr/share/doc/"$cdd"-"$pkg"
+    [ ! -s docs/"$pkg"/README.Debian ] && cp -a /usr/share/cdd/templates/README.Debian debian/"$cdd"-"$pkg"/usr/share/doc/"$cdd"-"$pkg"
+    # Check for documentation of packages (*.txt or *.html) which should be viewed in
+    # case of missing GUI
+    [ -d menu ] && [ -d menu/"$pkg" ] && \
+	    if [ `find menu/"$pkg" -maxdepth 1 -name \*.txt -o -name \*.html | wc -l` -gt 0 ] ; then
+	for dep in `find menu/"$pkg" -maxdepth 1 -name \*.txt -o -name \*.html` ; do
+            # Formerly here was checked, whether this package is really listed in the
+	    # dependencies, with more clever menu handling it is enough to verify
+	    # whether it is mentioned at all in the package relations and the menu
+	    # system cares about whether a sugested package is installed or not
+	    depmenu=`basename ${dep} .txt`
+	    if [ "$depmenu" = `basename ${dep}` ] ; then depmenu=`basename ${dep} .html` ; fi
+	    if ! grep -A 5 "Package: $cdd-$pkg" debian/control | grep -q -w "$depmenu" ; then
+		## echo "Package ${depmenu} seems not to be in dependencies"
+		continue
+	    fi
+	    cp -a "$dep" debian/"$cdd"-"$pkg"/usr/share/doc/"$cdd"-"$pkg"
+	done
+    fi
+
+    # post{inst/rm} template are appended if some extra scripts are provided or just created
+    # an extra postinst has to be saved (*.stub) and restored by the clean target in
+    # debian/rules
+    [ -s debian/"$cdd"-"$pkg".postinst.stub ] && cp debian/"$cdd"-"$pkg".postinst.stub debian/"$cdd"-"$pkg".postinst
+    sed -e "s/#CDD#/${cdd}/g" \
+        -e "s/#PKG#/${cdd}-${pkg}/g" \
+       /usr/share/cdd/templates/postinst >> debian/"$cdd"-"$pkg".postinst
+    sed -e "s/#CDD#/${cdd}/g" \
+        -e "s/#PKG#/${cdd}-${pkg}/g" \
+       /usr/share/cdd/templates/postrm >> debian/"$cdd"-"$pkg".postrm
+done
+
+# if config/common exists use this as general helper script
+if [ -s config/common ] ; then
+  mkdir -p debian/"$cdd"-config/usr/bin
+  mkdir -p debian/"$cdd"-config/usr/share/man/man1
+  cp -a config/common   debian/"$cdd"-config/usr/bin/"$cdd"-common
+  cp -a config/common.1 debian/"$cdd"-config/usr/share/man/man1/"$cdd"-common.1
+
+  # install link to package helper script
+  for pkg in `ls tasks` ; do
+    mkdir -p debian/"$cdd"-"$pkg"/usr/bin
+    mkdir -p debian/"$cdd"-"$pkg"/usr/share/man/man1
+    ln -s "$cdd"-common debian/"$cdd"-"$pkg"/usr/bin/"$cdd"-"$pkg"
+    ln -s "$cdd"-common.1.gz debian/"$cdd"-"$pkg"/usr/share/man/man1/"$cdd"-"$pkg".1.gz
+  done
+fi
+
+# common/conf should really exist for the CDD registry in /etc/cdd
+# currently there is no error message issued if it is missing but
+# this might be reasonable
+if [ -s config/conf ] ; then
+  # Get name of Custom Debian Distribution
+  . config/conf
+  # Config file should set CDDNAME, but if not try to build a useful one
+  if [ _"$CDDNAME" = _"" ] ; then
+    CDDNAME=Debian-`echo ${cdd} | perl -ne 'print "\u\L$_";'`
+  fi
+  # Move templates for user configuration script
+  for comm in `ls /usr/share/cdd/templates/{config.*,apt.conf}` ; do
+    commname=`basename $comm`
+    SubstCDDName ${commname} ${cdd}-${commname}
+  done
+  # rename apt.conf.d file 
+  [ -s debian/${cdd}-apt.conf ] && mv debian/${cdd}-apt.conf debian/90${cdd}-config
+  if [ -d debian/po.stub ] ; then
+      cp -a debian/po.stub debian/po
+  else
+      mkdir -p debian/po
+  fi
+  for po in `ls /usr/share/cdd/templates/po/*` ; do
+    poname=`basename $po`
+    SubstCDDName po/${poname} po/${poname}
+  done
+  [ -d debian/po ] && debconf-updatepo
+
+  # Add common config file for ${cdd}
+  mkdir -p debian/"$cdd"-config/etc/cdd/"$cdd"
+  cp -a config/conf debian/"$cdd"-config/etc/cdd/"$cdd"/"$cdd".conf
+fi

Added: cdd/trunk/cdd/devtools/rules
==============================================================================
--- (empty file)
+++ cdd/trunk/cdd/devtools/rules	Mon Aug 27 17:48:49 2007
@@ -0,0 +1,84 @@
+#!/usr/bin/make -f
+
+# This is a debian/rules file which builds meta packages
+# for a Custom Debian Distribution.
+#
+# Copyright (C) Andreas Tille <tille at debian.org>
+# License: GPL
+
+CDDNAME   := $(shell /usr/share/cdd-dev/cdd-get-names cddname)
+PREFIX    := $(shell /usr/share/cdd-dev/cdd-get-names metapackageprefix)
+CDDMKFILE := /usr/share/cdd-dev/Makefile
+CDD_INSTALL_HELPER := /usr/share/cdd-dev/cdd-install-helper
+
+all:
+	echo $(PREFIX), $(CDDNAME)
+
+INSTALLREADME := $(shell if test -e README ; then echo "-A README"; fi)
+
+debian/control: 
+	$(MAKE) -f $(CDDMKFILE) debian/control
+
+build: 
+	$(MAKE) -f $(CDDMKFILE) all
+	dh_testdir
+
+clean: debian/control
+	dh_testdir
+	dh_testroot
+	$(MAKE) -f $(CDDMKFILE) clean
+
+	# Clear apt-get cache
+	rm -rf tmp
+	# Remove backup files from source tarball
+	rm -f tasks/*~
+	# Remove auto generated post{inst,rm} scripts
+	rm -f debian/$(PREFIX)-*.post{inst,rm}
+	# remove tasksel directory
+	## [ -d tasksel ] && rm -f tasksel/$(PREFIX)-* && rmdir tasksel
+	# remove auto generated files for config package
+	rm -f debian/$(PREFIX)-config.{templates,config,install,links} debian/90$(PREFIX)-config
+	# remove auto generated debconf template translations
+	rm -rf debian/po
+	# Remove auto generated tasksel descriptions:
+	rm -f $(CDDNAME)-tasks.desc
+
+	dh_clean build-stamp
+
+install: debian/control build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+	dh_install $(CDDNAME)-tasks.desc usr/share/tasksel
+
+# Build architecture-dependent files here.
+binary-arch: build install
+# We have nothing to do by default.
+
+# Build architecture-independent files here.
+binary-indep: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs $(INSTALLREADME)
+	dh_installexamples
+	dh_installmenu
+	dh_installcron
+	dh_installman
+	dh_installinfo
+	$(CDD_INSTALL_HELPER)
+	dh_install
+	dh_installdebconf
+	dh_installchangelogs 
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure debian/control

Modified: cdd/trunk/cdd/examples/debian/compat
==============================================================================
--- cdd/trunk/cdd/examples/debian/compat	(original)
+++ cdd/trunk/cdd/examples/debian/compat	Mon Aug 27 17:48:49 2007
@@ -1 +1 @@
-4
+5

Modified: cdd/trunk/cdd/examples/debian/control.stub
==============================================================================
--- cdd/trunk/cdd/examples/debian/control.stub	(original)
+++ cdd/trunk/cdd/examples/debian/control.stub	Mon Aug 27 17:48:49 2007
@@ -3,8 +3,8 @@
 Priority: extra
 Maintainer: _MAINTAINER_ <_maintainer_ at debian.org>
 Uploaders: _OPTIONAL-FURTHER-MAINTAINER_ <_optional-further-maintainer_ at debian.org>
-Build-Depends-Indep: debhelper (>= 4), cdd-dev
-Standards-Version: 3.6.1
+Build-Depends-Indep: debhelper (>= 5), cdd-dev
+Standards-Version: 3.7.2
 
 Package: _CDD_
 Architecture: all

Modified: cdd/trunk/cdd/examples/debian/rules
==============================================================================
--- cdd/trunk/cdd/examples/debian/rules	(original)
+++ cdd/trunk/cdd/examples/debian/rules	Mon Aug 27 17:48:49 2007
@@ -1,79 +1,3 @@
 #!/usr/bin/make -f
-# debian/rules for Debian-_CDD_.
-# GNU copyright 2004 _CDD_Maintainer, GPL.
 
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-cdd=_CDD_
-pkgsrc=debian-$(cdd)
-
-build: build-stamp
-build-stamp:
-	dh_testdir
-
-	cdd-gen-control -s local -c -m -i -t
-	#/usr/bin/docbook-to-man debian/meta-$(cdd).sgml > meta-$(cdd).1
-
-	touch build-stamp
-
-clean: debian/control tasks/* debian/control.stub
-	dh_testdir
-	dh_testroot
-	rm -f build-stamp
-
-	cdd-clean-helper
-
-install: build
-	dh_testdir
-	dh_testroot
-	dh_clean -k
-	dh_installdirs
-
-# Build architecture-dependent files here.
-binary-arch: build install
-# We have nothing to do by default.
-
-# Build architecture-independent files here.
-binary-indep: build install
-	dh_testdir
-	dh_testroot
-	dh_installdocs
-	dh_installexamples
-	dh_installmenu
-#	dh_installlogrotate
-#	dh_installemacsen
-#	dh_installpam
-#	dh_installmime
-#	dh_installinit
-	dh_installcron
-	dh_installman
-	cdd-install-helper
-	dh_install
-	dh_installdebconf
-#	dh_installinfo
-	dh_installchangelogs 
-	dh_link
-	dh_strip
-	dh_compress
-	dh_fixperms
-#	dh_makeshlibs
-	dh_installdeb
-#	dh_perl
-	dh_shlibdeps
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-dist:
-	distdir=$(pkgsrc)-`cat VERSION` ; \
-	rm -rf $${distdir} ; \
-	mkdir $${distdir} ; \
-	chmod 777 $${distdir} ; \
-	rsync -a --exclude $${distdir} --exclude CVS --exclude .svn * $${distdir} ; \
-	ln -s control.stub $${distdir}/debian/control ; \
-	GZIP=-9 tar -czf ../$(pkgsrc)_`cat VERSION`.tar.gz $${distdir} ; \
-	rm -rf $${distdir}
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+include /usr/share/cdd-dev/rules

Added: cdd/trunk/cdd/mans_old/cdd-gen-control.1
==============================================================================
--- (empty file)
+++ cdd/trunk/cdd/mans_old/cdd-gen-control.1	Mon Aug 27 17:48:49 2007
@@ -0,0 +1,61 @@
+.TH cdd-gen-control 1 "2004/03/23" "" "Debian Internal Projects"
+.SH NAME
+.B cdd-gen-control
+\- generate debian/control file from tasks directory
+
+.SH SYNOPSIS
+.B cdd-gen-control
+[
+.B options
+]
+[
+.B project
+]
+
+.SH DESCRIPTION
+The script
+.B cdd-gen-control
+parses the
+.I tasks
+directory for text files which have a similar syntax to
+.I debian/control
+files.  Each text file is used as template for a
+.I <cdd>-<textfile_name>
+meta package and has to define the dependencies. In addition
+there is a further tag named
+.B Task
+which is mandatory and is used later as registry of all tasks in
+.I /usr/share/cdd/tasks/<cdd> .
+
+.SH OPTIONS
+.TP
+.B -c
+Create debian/control file using template debian/control.stub.
+.TP
+.B -d
+Turn on debugging mode.
+.TP
+.B -a
+Print all available packages.
+.TP
+.B -e
+Print excluded packages.
+.TP
+.B -m
+Print missing packages.
+.TP
+.B -s <dist>
+Without the
+.B -s
+option /etc/cdd/sources.list is used to verify which packages are available.
+You can specify one of
+.I stable
+,
+.I testing
+or
+.I unstable
+as argument or a complete path to a valid sources.list file.
+
+.SH AUTHORS
+Petter Reinholdtsen <pere at hungry.com>
+Andreas Tille <tille at debian.org>

Added: cdd/trunk/cdd/mans_old/cdd-install-helper.1
==============================================================================
--- (empty file)
+++ cdd/trunk/cdd/mans_old/cdd-install-helper.1	Mon Aug 27 17:48:49 2007
@@ -0,0 +1,108 @@
+.TH "cdd-install-helper" "1" "March 23, 2004" "CDD - Development" ""
+.SH "NAME"
+.B cdd\-install\-helper
+\- install menu and link to helper bin and according manpage
+
+.SH "SYNOPSIS"
+.B cdd\-install\-helper
+
+.SH "DESCRIPTION"
+This script can be used in debian/rules file to install the user menu
+files to /etc/cdd/\fI<cdd>\fR/menu/\fI<package>\fR,  a link for the
+helper script of every \fI<cdd>\fR\-* package and the link to the manpage
+for this script.
+.TP 
+.I menu
+If a directory
+.I menu
+exists in the building directory it checks subdirectories
+.I menu/<task>
+(named like meta package without the "cdd\-" name
+prefix).  This subdirectory might contain three types of files:
+.IP
+.I <dep>.menu
+These files should be valid menu files as they are provided for Debian
+packages in debian/menu.   They will be copied to
+.I usr/share/cdd/<cdd>/menu/<dep>
+and can be used to override the menu items which are provided by the
+maintainer of the package
+.I <dep>
+in case the meta package author likes to change the normal menu item
+for the user menus.
+.IP
+.I <dep>.html
+These files might contain documentation of the dependency in HTML
+format if it makes no sense to provide a menu entry to actually call a
+program in the package.
+.IP
+.I <dep>.txt
+These files might contain documentation of the dependency in text
+format if it makes no sense to provide a menu entry to actually call a
+program in the package.
+
+The rationale of the latter both types is to enable a menu entry in
+the user menus for
+.B every
+call a certain program via the menu.  These files should provide
+reasonable information how to use this program in text form.  This is
+better than having no menu entry at all because the target user might
+use the menu as the first interface of information of his system.
+.TP 
+.I config
+If there exists a file
+.I config/control
+and has a size greater than 0 a <cdd>\-config package is builded.  The
+file
+.I config/control
+was just used to build the appropriate
+.I debian/control
+file using the
+.B  cdd\-gen\-control(1)
+tool.
+.TP 
+.I conf
+If there exists a file
+.I config/conf
+and has a size greater than 0 this is used as special configuration file
+.I /etc/cdd/<cdd>/<cdd>.conf
+which can override variables from the general configuration file
+.I /etc/cdd/cdd.conf
+or add further variables. Because it is sourced from shell it has to
+follow shell syntax.
+.TP 
+.I install
+Here the extra files which might be needed in a meta package (like scripts,
+manpages, etc.) should be copied in a directory named
+.I install/<pkg_without_cdd\-prefix>/
+and the files should be moved into place by using
+.I debian/<pkg>.install
+or
+.I debian/<pkg>.manpages
+etc.
+
+Moreover it is possible to provide extra
+.I debian/<pkg>.config
+and
+.I debian/<pkg>.templates
+files for each meta package if additional
+.I debconf
+configuration is needed.  For the translations of the
+.I debconf
+questions some extra caution is required.  Because 
+.B cdd\-install\-helper
+uses general templates to provide translations for some general questions
+the directory
+.I debian/po
+is overriden in the package building process.  To enable translations
+of the extra templates these should be stored in a directory named
+.I debian/po.stub
+and the contents of the files in this directory is appended to the
+apropriate files.
+
+.SH "EXAMPLES"
+For the usage of this tool just have a look at the 
+.B debian\-med
+source package.
+
+.SH "AUTHOR"
+Andreas Tille <tille at debian.org>.

Added: cdd/trunk/cdd/templates/config.config
==============================================================================
--- (empty file)
+++ cdd/trunk/cdd/templates/config.config	Mon Aug 27 17:48:49 2007
@@ -0,0 +1,39 @@
+#!/bin/sh -e
+
+# Initialize debconf if not yet done
+if [ _"$DEBCONF_REDIR" = _"" ]; then
+    . /usr/share/debconf/confmodule
+    db_version 2.0
+    db_capb backup
+fi
+
+db_input "medium" "shared/#CDD#-config/usermenus" || true
+db_go
+
+# if cdd-config package is not yet installed we have to stop here
+if [ ! -f /etc/cdd/cdd.conf ] ; then
+   db_stop
+   exit 0
+fi
+
+[ -s /etc/cdd/cdd.conf ]         && . /etc/cdd/cdd.conf
+[ -s /etc/cdd/#CDD#/#CDD#.conf ] && . /etc/cdd/#CDD#/#CDD#.conf
+
+# Add at least one default role for each CDD
+addRole #CDD# #CDD#
+
+# Login names of all users of the system as comma separated list 
+USERS=`getAllUsers 0 ,`
+
+# "login (Real Name)" of users registered to the CDD #CDD#
+CDDUSERS=`getUsersInRole #CDD# #CDD# 0 ,`
+
+db_set #CDD#-config/group "$CDDUSERS"
+db_subst #CDD#-config/group users "$USERS"
+db_get #CDD#-config/group
+
+db_input high #CDD#-config/group || true
+db_go
+
+db_stop
+exit 0

Added: cdd/trunk/cdd/templates/config.install
==============================================================================
--- (empty file)
+++ cdd/trunk/cdd/templates/config.install	Mon Aug 27 17:48:49 2007
@@ -0,0 +1 @@
+debian/90#CDD#-config   etc/apt/apt.conf.d

Added: cdd/trunk/cdd/templates/config.links
==============================================================================
--- (empty file)
+++ cdd/trunk/cdd/templates/config.links	Mon Aug 27 17:48:49 2007
@@ -0,0 +1 @@
+usr/share/cdd/cdd-task-lister usr/lib/tasksel/#CDD#-task-files

Added: cdd/trunk/cdd/templates/config.postinst
==============================================================================
--- (empty file)
+++ cdd/trunk/cdd/templates/config.postinst	Mon Aug 27 17:48:49 2007
@@ -0,0 +1,36 @@
+#!/bin/sh -e
+
+# if cdd-common package is not yet installed we have to stop here
+if [ ! -f /etc/cdd/cdd.conf ] ; then
+   echo "Custom Debian Distribution configuration file /etc/cdd/cdd.conf is missing."
+   exit -1
+fi
+. /etc/cdd/cdd.conf
+
+if [ ! -f /etc/cdd/#CDD#/#CDD#.conf ] ; then
+   echo "#CDDNAME# configuration file /etc/cdd/#CDD#/#CDD#.conf is missing."
+   exit -1
+fi
+. /etc/cdd/#CDD#/#CDD#.conf
+
+# Source debconf library.
+. /usr/share/debconf/confmodule
+db_version 2.0
+
+db_get #CDD#-config/group 
+
+CURRENTCDDUSERS=`getUsersInRole #CDD# #CDD# 1`
+# Add those users which were selected but are not yet in the group
+for user in `echo "$RET" | sed "s/([^)]*)//g" | sed "s/ //g" |  tr ',' '\n'` ; do
+   if [ `echo "${CURRENTCDDUSERS}" | grep -c -w "$user"` -eq 0 ] ; then
+      /usr/sbin/cdd-user add #CDD# $user
+   fi
+done
+# Del those users which were obviousely removed from list of CDD users
+for user in `getAllUsers 1` ; do
+   if [ `echo "$RET" | grep -c -w "$user"` -eq 0 ] && [ `getent group #CDD# | grep -c -w $user` -gt 0 ] ; then
+      /usr/sbin/cdd-user del #CDD# $user
+   fi
+done
+
+#DEBHELPER#

Added: cdd/trunk/cdd/templates/config.templates
==============================================================================
--- (empty file)
+++ cdd/trunk/cdd/templates/config.templates	Mon Aug 27 17:48:49 2007
@@ -0,0 +1,25 @@
+Template: #CDD#-config/group
+Type: multiselect
+Choices: ${users}
+_Description: #CDDNAME# users:
+ Please select, among the whole system user list, users who should get
+ a #CDDNAME# user menu.
+
+Template: shared/#CDD#-config/usermenus
+Type: select
+_Choices: Each package installation, End of installation, Never
+Default: never
+_Description: Build user menus at:
+ The meta packages of the #CDDNAME# Custom Debian Distribution
+ contain extra role based menus for users. These will be built when
+ a user who is registered to a given role uses the "update-menus"
+ utility.  This can be done automatically for all users who are registered
+ for #CDDNAME# after installation of each single meta package,
+ at the end of the whole installation process to save time in case
+ of installing more than one meta package or just leave the call of
+ "update-menus" to the users themselves.
+  * Each package installation : Call "update-menus" after each meta package
+                               (time consuming);
+  * End of installation       : Call "update-menus" only once at the end of
+                                the whole installation/upgrading process;
+  * Never                     : Do not call "update-menus" at all.



More information about the Cdd-commits mailing list