# 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 {
# 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.
@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;
$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.
# 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;
my $package="";
my $arch="";
+ my $package_type;
my @list=();
my %seen;
open (CONTROL, 'debian/control') ||
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') ||
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
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
+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
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
# 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}});
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");
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}) {
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");
}
init();
foreach my $package (@{$dh{DOPACKAGES}}) {
+ next if is_udeb($package);
+
my $tmp=tmpdir($package);
my $file=pkgfile($package,"docs");
init();
foreach my $package (@{$dh{DOPACKAGES}}) {
+ next if is_udeb($package);
+
my $tmp=tmpdir($package);
my $file=pkgfile($package,"examples");
my @sodests;
foreach my $package (@{$dh{DOPACKAGES}}) {
+ next if is_udeb($package);
+
my $tmp=tmpdir($package);
my $file=pkgfile($package,"manpages");
my @manpages;
}
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) {
init();
foreach my $package (@{$dh{DOPACKAGES}}) {
+ next if is_udeb($package);
+
my $tmp=tmpdir($package);
my %seen;
init();
foreach my $package (@{$dh{DOPACKAGES}}) {
+ next if is_udeb($package);
+
my $tmp=tmpdir($package);
if (! -d "$tmp/DEBIAN") {
$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);
}
}
}
foreach my $package (@{$dh{DOPACKAGES}}) {
+ next if is_udeb($package);
+
my $tmp=tmpdir($package);
my $ext=pkgext($package);
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>