]> git.donarmstrong.com Git - debhelper.git/commitdiff
r1655: * Added udeb support, as pioneered by di-packages-build. Understands version_4.2.0
authorjoey <joey>
Mon, 9 Feb 2004 05:24:40 +0000 (05:24 +0000)
committerjoey <joey>
Mon, 9 Feb 2004 05:24:40 +0000 (05:24 +0000)
     "XC-Package-Type: udeb" in debian/control. See debhelper(1) for
     details.
   * Dh_Lib: add and export is_udeb and udeb_filename
   * dh_builddeb: name udebs with proper extension
   * dh_gencontrol: pass -n and filename to dpkg-gencontrol
   * dh_installdocs, dh_makeshlibs, dh_md5sums, dh_installchangelogs,
     dh_installexamples, dh_installman, dh_installmanpages: skip udebs
   * dh_shlibdeps: skip udebs. This may be temporary.
   * dh_installdeb: do not process conffiles, shlibs, preinsts, postrms,
     or prerms for udebs. Do not substiture #DEBHELPER# tokens in
     postinst scripts for udebs.
   * dh_installdebconf: skip config script for udebs, still do templates

18 files changed:
Debian/Debhelper/Dh_Getopt.pm
Debian/Debhelper/Dh_Lib.pm
debhelper.pod
debian/changelog
dh_builddeb
dh_gencontrol
dh_installchangelogs
dh_installdeb
dh_installdebconf
dh_installdocs
dh_installexamples
dh_installman
dh_installmanpages
dh_makeshlibs
dh_md5sums
dh_python
dh_shlibdeps
doc/PROGRAMMING

index c610963b78ce4547ae70ac512956b65c6dcc5ce9..1da5afd2727a8ba8252150cfe8edb89334fa41d0 100644 (file)
@@ -29,18 +29,18 @@ sub showhelp {
 # order.
 sub AddPackage { my($option,$value)=@_;
        if ($option eq 'i' or $option eq 'indep') {
-               push @{$options{DOPACKAGES}}, GetPackages('indep');
+               push @{$options{DOPACKAGES}}, getpackages('indep');
                $options{DOINDEP}=1;
        }
        elsif ($option eq 'a' or $option eq 'arch') {
-               push @{$options{DOPACKAGES}}, GetPackages('arch');
+               push @{$options{DOPACKAGES}}, getpackages('arch');
                $options{DOARCH}=1;
        }
        elsif ($option eq 'p' or $option eq 'package') {
                push @{$options{DOPACKAGES}}, $value;
        }
        elsif ($option eq 's' or $option eq 'same-arch') {
-               push @{$options{DOPACKAGES}}, GetPackages('same');
+               push @{$options{DOPACKAGES}}, getpackages('same');
                $options{DOSAME}=1;
        }
        else {
@@ -184,7 +184,7 @@ sub parseopts {
                        # built, and there are none of that type.
                        error("I have no package to build");
                }
-               push @{$options{DOPACKAGES}},GetPackages();
+               push @{$options{DOPACKAGES}},getpackages();
        }
 
        # Remove excluded packages from the list of packages to act on.
index 0eea0180f40f9195ffcbb04e452e94105f2f1585..f42f8bd2820c172a473d9bcb570152adec60d725 100644 (file)
@@ -12,8 +12,9 @@ use vars qw(@ISA @EXPORT %dh);
 @ISA=qw(Exporter);
 @EXPORT=qw(&init &doit &complex_doit &verbose_print &error &warning &tmpdir
            &pkgfile &pkgext &pkgfilename &isnative &autoscript &filearray
-           &filedoublearray &GetPackages &basename &dirname &xargs %dh
-           &compat &addsubstvar &delsubstvar &excludefile);
+           &filedoublearray &getpackages &basename &dirname &xargs %dh
+           &compat &addsubstvar &delsubstvar &excludefile &is_udeb
+           &udeb_filename);
 
 my $max_compat=4;
 
@@ -72,7 +73,7 @@ sub init {
                $dh{NO_ACT}=1;
        }
 
-       my @allpackages=GetPackages();
+       my @allpackages=getpackages();
        # Get the name of the main binary package (first one listed in
        # debian/control). Only if the main package was not set on the
        # command line.
@@ -533,8 +534,14 @@ sub excludefile {
 # Must pass "arch" or "indep" or "same" to specify arch-dependant or
 # -independant or same arch packages. If nothing is specified, returns all
 # packages.
-sub GetPackages {
+# As a side effect, populates %package_arches and %package_types with the
+# types of all packages (not only those returned).
+my (%package_types, %package_arches);
+sub getpackages {
        my $type=shift;
+
+       %package_types=();
+       %package_arches=();
        
        $type="" if ! defined $type;
        
@@ -546,6 +553,7 @@ sub GetPackages {
 
        my $package="";
        my $arch="";
+       my $package_type;
        my @list=();
        my %seen;
        open (CONTROL, 'debian/control') ||
@@ -562,12 +570,20 @@ sub GetPackages {
                        else {
                                error("debian/control has a duplicate entry for $package");
                        }
+                       $package_type="deb";
                }
                if (/^Architecture:\s*(.*)/) {
                        $arch=$1;
                }
+               if (/^X[BC]*-Package-Type:\s*(.*)/) {
+                       $package_type=$1;
+               }
                
                if (!$_ or eof) { # end of stanza.
+                       if ($package) {
+                               $package_types{$package}=$package_type;
+                               $package_arches{$package}=$arch;
+                       }
                        if ($package &&
                            (($type eq 'indep' && $arch eq 'all') ||
                             ($type eq 'arch' && $arch ne 'all') ||
@@ -584,4 +600,18 @@ sub GetPackages {
        return @list;
 }
 
+sub is_udeb {
+       my $package=shift;
+       
+       return $package_types{$package} eq 'udeb';
+}
+
+sub udeb_filename {
+       my $package=shift;
+       
+       my $filearch=$package_arches{$package} eq 'all' ? "all" : buildarch();
+       isnative($package); # side effect
+       return "${package}_$dh{VERSION}_$filearch.udeb";
+}
+
 1
index 8b26ca610198d9f01971b23b72210edec1181d43..83e67830c1db77472c42601d22b5cebd39e7b928 100644 (file)
@@ -325,6 +325,15 @@ files into the package, and use dh_link to set up the symlink (or do it by
 hand), and debhelper should do the right thing: notice it is a dangling
 symlink and not try to install a copyright file or changelog.
 
+=head2 udebs
+
+Debhelper includes support for udebs. To create a udeb with debhelper,
+add "XC-Package-Type: udeb" to the package's stanza in debian/control, and
+build-depend on debhelper (>= 4.2). Debhelper will try to create udebs that
+comply with debian-installer policy, by making the generated package files
+end in ".udeb", not installing any documentation into a udeb, skipping over
+preinst, postrm, prerm, and config scripts, etc.
+
 =head2 Other notes
 
 In general, if any debhelper program needs a directory to exist under
index 9e780a3de8bad11ecb0cf50fa5e42b74bc95b87c..5f01e1776e44d330e0083ac0c396d12ca949af7b 100644 (file)
@@ -1,3 +1,21 @@
+debhelper (4.2.0) unstable; urgency=low
+
+  * Added udeb support, as pioneered by di-packages-build. Understands
+    "XC-Package-Type: udeb" in debian/control. See debhelper(1) for
+    details.
+  * Dh_Lib: add and export is_udeb and udeb_filename
+  * dh_builddeb: name udebs with proper extension
+  * dh_gencontrol: pass -n and filename to dpkg-gencontrol
+  * dh_installdocs, dh_makeshlibs, dh_md5sums, dh_installchangelogs,
+    dh_installexamples, dh_installman, dh_installmanpages: skip udebs
+  * dh_shlibdeps: skip udebs. This may be temporary.
+  * dh_installdeb: do not process conffiles, shlibs, preinsts, postrms,
+    or prerms for udebs. Do not substiture #DEBHELPER# tokens in
+    postinst scripts for udebs.
+  * dh_installdebconf: skip config script for udebs, still do templates
+
+ -- Joey Hess <joeyh@debian.org>  Sun,  8 Feb 2004 22:51:57 -0500
+
 debhelper (4.1.90) unstable; urgency=low
 
   * dh_strip: Add note to man page that the detached debugging symbols options
index 3d9f9d86e88130aef220002e4edb421eb3f6b252..31bcdc67d2b9aeb015ab4b4e2066427ec85590a8 100755 (executable)
@@ -63,7 +63,16 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                complex_doit("find $tmp -name $_ | xargs rm -rf")
                        foreach split(":", $ENV{DH_ALWAYS_EXCLUDE});
        }
-       doit("dpkg-deb", @{$dh{U_PARAMS}}, "--build", $tmp, $dh{DESTDIR}.$dh{FILENAME});
+       if (! is_udeb($package)) {
+               doit("dpkg-deb", @{$dh{U_PARAMS}}, "--build", $tmp, $dh{DESTDIR}.$dh{FILENAME});
+       }
+       else {
+               my $filename=$dh{FILENAME};
+               if (! $filename) {
+                       $filename="/".udeb_filename($package);
+               }
+               doit("dpkg-deb", @{$dh{U_PARAMS}}, "--build", $tmp, $dh{DESTDIR}.$filename);
+       }
 }
 
 =head1 SEE ALSO
index b9aaefb490d59873823e1fe703268d7872af7ff5..7614fa696d2ca6fbcc93c5e8ad3f5f2d0096e946 100755 (executable)
@@ -54,9 +54,12 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 
        # Generate and install control file.
        my @command="dpkg-gencontrol";
-       if (GetPackages() > 1) {
+       if (getpackages() > 1) {
                push @command, "-p$package";
        }
+       if (is_udeb($package)) {
+               push @command, "-n".udeb_filename($package);
+       }
        doit(@command, "-l$changelog", "-isp", "-Tdebian/${ext}substvars", 
                "-P$tmp",@{$dh{U_PARAMS}});
 
index 7de170aae6b615cd9a4693f3ad843cb64f8e14c3..7bb235cb8cd896afbecfc3ed05b3eb79700b7b16 100755 (executable)
@@ -68,6 +68,8 @@ if (isnative($dh{MAINPACKAGE}) && ! defined $upstream) {
 my $news_name="NEWS.Debian";
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
+       next if is_udeb($package);
+       
        my $tmp=tmpdir($package);
        my $changelog=pkgfile($package,"changelog");
        my $news=pkgfile($package,"NEWS");
index e25e17530fa89696d539bdb83073727db8351680..9832d1020fd30d5a21d3e76283a5bd6676b58b37 100755 (executable)
@@ -52,6 +52,16 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
        }
 
+       if (is_udeb($package)) {
+               # For udebs, only do the postinst, and no #DEBHELPER#.
+               my $f=pkgfile($package,"postinst");
+               if ($f) {
+                       doit("install", "-o", 0, "-g", 0, "-m", 755, 
+                            $f, "$tmp/DEBIAN/postinst");
+               }
+               next;           
+       }
+       
        # Install debian install scripts.
        # If any .debhelper files exist, add them into the scripts.
        foreach my $file (qw{postinst preinst prerm postrm}) {
index 66dafd0ca22af9913762c37cc1f23ad01bec9d9b..ebf6a13123090c0943bf5e24711fb327fba30c8d 100755 (executable)
@@ -83,7 +83,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
        }
 
-       if ($config ne '') {
+       if (! is_udeb($package) && $config ne '') {
                doit("install", "-o", 0, "-g", 0, "-m", 755, "-p",
                     $config, "$tmp/DEBIAN/config");
        }
index 3fe3d0c43c581300e60f7921df4b6a214554eb52..f729186058e948c76a2a7134a78214db5a7203e1 100755 (executable)
@@ -88,6 +88,8 @@ instances of the same text to be added to maintainer scripts.
 init();
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
+       next if is_udeb($package);
+       
        my $tmp=tmpdir($package);
        my $file=pkgfile($package,"docs");
 
index 8934e2fb173062697947b17c9b6f13e88182d2ec..dcd37ad5a08315084b241f0493274767c50530fb 100755 (executable)
@@ -58,6 +58,8 @@ directory, it will install the complete contents of the directory.
 init();
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
+       next if is_udeb($package);
+
        my $tmp=tmpdir($package);
        my $file=pkgfile($package,"examples");
        
index 3d03d2642eb2798d1197159e8d195db92f7aaa7d..b626e33d26358e6ab1229b2ed1e4e0f313a8a053 100755 (executable)
@@ -82,6 +82,8 @@ my @sofiles;
 my @sodests;
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
+       next if is_udeb($package);
+
        my $tmp=tmpdir($package);
        my $file=pkgfile($package,"manpages");
        my @manpages;
index 39946f6a4f734396d5e5347b1e41c55da84c0863..415c86b7a21ec63aaa5a24be4cba6f548269f8a2 100755 (executable)
@@ -126,11 +126,13 @@ sub find_so_man {
 }
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
+       next if is_udeb($package);
+
        my $tmp=tmpdir($package);
 
        # Find all filenames that look like man pages.
        @manpages=();
-       @allpackages=GetPackages('');
+       @allpackages=getpackages('');
        find(\&find_man,'.'); # populates @manpages
        
        foreach my $page (@manpages) {
index a888aecaa5e86f3378c7300a889bbb81cfaed23d..1d57b01eb0842c603d6c62a09abc131a96c900b2 100755 (executable)
@@ -86,6 +86,8 @@ Generates a shlibs file that looks something like:
 init();
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
+       next if is_udeb($package);
+       
        my $tmp=tmpdir($package);
 
        my %seen;
index 7d313220a58238caf752deb57bbabc1697219543..0619a3bae2337063f5bce1df6942d8c7a6782bb1 100755 (executable)
@@ -46,6 +46,8 @@ being listed in the md5sums file.
 init();
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
+       next if is_udeb($package);
+       
        my $tmp=tmpdir($package);
 
        if (! -d "$tmp/DEBIAN") {
index 02afea89a7fdfa20be35ecdf8d0342ebee5253f1..eb32fd46e36719b441cd55c61a46b47b380e562e 100755 (executable)
--- a/dh_python
+++ b/dh_python
@@ -132,7 +132,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                $strong_dep = 1;
                my $pack = $package;
                $pack =~ s/^python/python$python_version/;
-               if (grep { "$_" eq "$pack" } GetPackages()) {
+               if (grep { "$_" eq "$pack" } getpackages()) {
                        addsubstvar($package, "python:Depends", $pack);
                }
        }
index 3192b189ae7791ed40056b273ffb1306d32d4d1b..c92d1bf100b9208a3cb93791c911d01c705db5f0 100755 (executable)
@@ -101,6 +101,8 @@ if ($dh{L_PARAMS}) {
 }
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
+       next if is_udeb($package);
+       
        my $tmp=tmpdir($package);
        my $ext=pkgext($package);
 
index 239f53e757e6d122b162ac0150b72a1477b08eb9..5a3156e185f1bef5d868480cea2e51fd8c966c82 100644 (file)
@@ -237,5 +237,10 @@ delsubstvar($package, $substvar)
 excludefile($filename)
        This function returns true if -X has been used to ask for the file
        to be excluded.
+is_udeb($package)
+       Returns true if the package is marked as a udeb in the control
+       file.
+udeb_filename($package)
+       Returns the filename of the udeb package.
 
 -- Joey Hess <joeyh@debian.org>