From c435a17b8c4d73e51ba8df4493bb4390972d4bc0 Mon Sep 17 00:00:00 2001From: Raphael Hertzog <hertzog@debian.org>Date: Wed, 20 Feb 2008 16:53:34 +0100Subject: [PATCH] Integrate a differentiation mechanism for Debian derivatives* configure.ac: Allow usage of --with-distribution=NAME.* scripts/Dpkg.pm: Export the distribution name for use byothers. First plans are to use this in dpkg-source to letderivatives provide an alternate patch list (whose filename wouldembed this distribution name) to use while unpacking a sourcepackage.* src/main.c: Display the distribution name in dpkg --version too.* scripts/dpkg-buildpackage.pl: Export the distribution name inthe environment variable DEB_DISTRIBUTION. Made the change ina way that doesn't fail if it's started with a Dpkg.pm that lacksthe $distribution variable.--- ChangeLog | 14 ++++++++++++++ configure.ac | 12 ++++++++++++ man/ChangeLog | 5 +++++ man/dpkg-buildpackage.1 | 14 ++++++++++++++ scripts/Dpkg.pm | 4 +++- scripts/Makefile.am | 3 ++- scripts/dpkg-buildpackage.pl | 4 ++++ src/main.c | 2 ++ 8 files changed, 56 insertions(+), 2 deletions(-)diff --git a/ChangeLog b/ChangeLogindex 92a2adb..e7684fc 100644--- a/ChangeLog+++ b/ChangeLog@@ -1,3 +1,17 @@+2008-02-20 Raphael Hertzog <hertzog@debian.org>++ * configure.ac: Allow usage of --with-distribution=NAME.+ * scripts/Dpkg.pm: Export the distribution name for use by+ others. First plans are to use this in dpkg-source to let+ derivatives provide an alternate patch list (whose filename would+ embed this distribution name) to use while unpacking a source+ package.+ * src/main.c: Display the distribution name in dpkg --version too.+ * scripts/dpkg-buildpackage.pl: Export the distribution name in+ the environment variable DEB_DISTRIBUTION. Made the change in+ a way that doesn't fail if it's started with a Dpkg.pm that lacks+ the $distribution variable.+ 2008-02-19 Frank Lichtenheld <djpig@debian.org> * m4/libs.m4 (DPKG_LIB_CURSES): Use libncursesw ifdiff --git a/configure.ac b/configure.acindex 5bd0ea3..e88306a 100644--- a/configure.ac+++ b/configure.ac@@ -49,6 +49,18 @@ AC_ARG_WITH(admindir, esac]) AC_SUBST(admindir)+# Allow specification of alternate distribution name+distribution="Debian"+AC_ARG_WITH(distribution,+ AS_HELP_STRING([--with-distribution=DISTNAME],+ [distribution name (default is Debian)]),+[case "$with_distribution" in+ "") AC_MSG_ERROR([invalid distribution specified]) ;;+ *) distribution="$with_distribution" ;;+esac])+AC_SUBST(distribution)+AC_DEFINE_UNQUOTED(DISTRIBUTION_NAME, "${distribution}",+ [Name of the distribution using this build of dpkg]) # Checks for programs. AC_PROG_CCdiff --git a/man/ChangeLog b/man/ChangeLogindex 94dd80b..31160e6 100644--- a/man/ChangeLog+++ b/man/ChangeLog@@ -1,3 +1,8 @@+2008-02-20 Raphael Hertzog <hertzog@debian.org>++ * dpkg-buildpackage.1: Document better environment+ variables including the new DEB_DISTRIBUTION.+ 2008-02-19 Frank Lichtenheld <djpig@debian.org> * dpkg-source.1: Fix documentation ofdiff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1index e220f87..6a365cf 100644--- a/man/dpkg-buildpackage.1+++ b/man/dpkg-buildpackage.1@@ -205,6 +205,20 @@ Show the usage message and exit. Show the version and exit. . .SH ENVIRONMENT+.B dpkg\-buildpackage+exports several environment variables for use by the package build system.+.SS Variables coming from dpkg\-architecture+Variables exported by+.B dpkg\-architecture \-f+are integrated in the build environment. This enables \fIrules\fP files to+adjust their behaviour depending on the current architecture.+.SS Distribution specific variable+The variable+.B DEB_DISTRIBUTION+contains the lower\-case name of the distribution. The distribution name+must have been set at compile\-time with the+\-\-with\-distribution=\fIname\fP configure flag.+.SS Compiler and linker options A set of environment variables for setting compiler and linker options are set to default values unless already set in the environment. Note that this mechanism was only introduced in dpkg-dev, version 1.14.17 anddiff --git a/scripts/Dpkg.pm b/scripts/Dpkg.pmindex 30993ef..5f81a37 100644--- a/scripts/Dpkg.pm+++ b/scripts/Dpkg.pm@@ -10,7 +10,8 @@ use warnings; # the dependency of dpkg-dev on dpkg. use base qw(Exporter);-our @EXPORT = qw($version $progname $admindir $dpkglibdir $pkgdatadir);+our @EXPORT = qw($version $progname $admindir $dpkglibdir $pkgdatadir+ $distribution); our ($progname) = $0 =~ m#(?:.*/)?([^/]*)#;@@ -20,5 +21,6 @@ our $admindir = "/var/lib/dpkg"; our $dpkglibdir = "."; our $pkgdatadir = ".."; $pkgdatadir = $ENV{DPKG_DATADIR} if defined $ENV{DPKG_DATADIR};+our $distribution = "Debian"; 1;diff --git a/scripts/Makefile.am b/scripts/Makefile.amindex b003137..ddce302 100644--- a/scripts/Makefile.am+++ b/scripts/Makefile.am@@ -109,7 +109,8 @@ do_perl_subst = sed -e "s:^\#![:space:]*/usr/bin/perl:\#!$(PERL):" \ -e "s:\$$dpkglibdir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$dpkglibdir=\"$(pkglibdir)\":" \ -e "s:\$$pkgdatadir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$pkgdatadir=\"$(pkgdatadir)\":" \ -e "s:\$$admindir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$admindir=\"$(admindir)\":" \- -e "s:\$$version[[:space:]]*=[[:space:]]*['\"][^'\"]*[\"']:\$$version=\"$(PACKAGE_VERSION)\":"+ -e "s:\$$version[[:space:]]*=[[:space:]]*['\"][^'\"]*[\"']:\$$version=\"$(PACKAGE_VERSION)\":" \+ -e "s:\$$distribution[[:space:]]*=[[:space:]]*['\"][^'\"]*[\"']:\$$distribution=\"$(distribution)\":" do_shell_subst = sed -e "s:version=\"[^\"]*\":version=\"$(PACKAGE_VERSION)\":"diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.plindex 6e1dc0e..d401dfa 100755--- a/scripts/dpkg-buildpackage.pl+++ b/scripts/dpkg-buildpackage.pl@@ -255,6 +255,10 @@ if ($parallel) { Dpkg::BuildOptions::set($build_opts); }+if ($Dpkg::distribution) {+ $ENV{"DEB_DISTRIBUTION"} = lc($Dpkg::distribution);+}+ my $default_flags = defined $build_opts->{noopt} ? "-g -O0" : "-g -O2"; my %flags = ( CPPFLAGS => '', CFLAGS => $default_flags,diff --git a/src/main.c b/src/main.cindex b4bd50f..a7f43f3 100644--- a/src/main.c+++ b/src/main.c@@ -43,6 +43,8 @@ static void printversion(void) { if (printf(_("Debian `%s' package management program version %s.\n"), DPKG, DPKG_VERSION_ARCH) < 0) werr("stdout");+ if (strcmp(DISTRIBUTION_NAME, "Debian") != 0)+ if (printf(_("Built for: %s\n"), DISTRIBUTION_NAME)) werr("stdout"); if (printf(_("This is free software; see the GNU General Public License version 2 or\n" "later for copying conditions. There is NO warranty.\n" "See %s --license for copyright and license details.\n"),-- 1.5.4.2