]> err.no Git - dpkg/commitdiff
Move variables automatically modified at build time to a new style perl
authorGuillem Jover <guillem@debian.org>
Sat, 21 Jul 2007 16:25:07 +0000 (16:25 +0000)
committerGuillem Jover <guillem@debian.org>
Sat, 21 Jul 2007 16:25:07 +0000 (16:25 +0000)
module.

ChangeLog
debian/changelog
debian/dpkg.install
m4/perl.m4
scripts/Dpkg.pm [new file with mode: 0644]
scripts/Makefile.am

index eeb892787f755924c1ae0a43afb8690fac1f1919..f78c72e845a7e5fc0fad5c4f1bc5e22709e91d74 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-07-21  Guillem Jover  <guillem@debian.org>
+
+       * m4/perl.m4 (DPKG_PROG_PERL): Add support for user overridable
+       PERL_LIBDIR variable, autodetected from the system installation.
+       * scripts/Makefile.am (perllibdir): New variable.
+       (nobase_dist_perllib_DATA): Likewise.
+       (install-data-hook): New target.
+       * scripts/Dpkg.pm: New file.
+
 2007-07-03  Frank Lichtenheld  <djpig@debian.org>
 
        * configure.ac: Bump version to 1.14.6~.
index c2f9ec8068101f106b702ff7b4dc92d8c20e3954..735ffe014a32510fbdf187f32c3e9005fe5a2bdd 100644 (file)
@@ -14,6 +14,8 @@ dpkg (1.14.6) UNRELEASED; urgency=low
       and remove leftover string from man page split.
     - Split option descriptions so that it gets easier to distinguish.
     - Unify author and copyright information formatting.
+  * Move variables automatically modified at build time to a new style perl
+    module.
 
   [ Updated scripts translations ]
   * French (Frédéric Bothamy, Christian Perrier).
index 08da4b7821de8e7b916d550e9b8eee5097a301f1..478405f715ef451b4c2969a106a6dd943f8c4a53 100644 (file)
@@ -35,6 +35,7 @@ usr/share/man/*/*/start-stop-daemon.8
 usr/share/man/*/start-stop-daemon.8
 usr/share/man/*/*/update-alternatives.8
 usr/share/man/*/update-alternatives.8
+usr/share/perl5
 var/lib/dpkg/alternatives
 var/lib/dpkg/info
 var/lib/dpkg/parts
index 165f487cd1e8044c9edd3e2cf8c40ec95d9f05d8..360cda323c7d6f23f4317f00fb7f36edb9dad1c0 100644 (file)
@@ -4,4 +4,6 @@
 AC_DEFUN([DPKG_PROG_PERL],
 [AC_ARG_VAR([PERL], [Perl interpreter])dnl
 AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])dnl
+AC_ARG_VAR([PERL_LIBDIR], [Perl library directory])dnl
+PERL_LIBDIR=`$PERL -MConfig -e 'print $Config{vendorlib}'`dnl
 ])# DPKG_PROG_PERL
diff --git a/scripts/Dpkg.pm b/scripts/Dpkg.pm
new file mode 100644 (file)
index 0000000..fc6d875
--- /dev/null
@@ -0,0 +1,17 @@
+package Dpkg;
+
+use strict;
+use warnings;
+
+use base qw(Exporter);
+our @EXPORT = qw($version $progname $admindir $dpkglibdir $pkgdatadir);
+
+our ($progname) = $0 =~ m:.*/(.*):;
+
+# The following lines are automatically fixed at install time
+our $version = "1.14";
+our $admindir = "/var/lib/dpkg";
+our $dpkglibdir = ".";
+our $pkgdatadir = "..";
+
+1;
index b8b364352b658244d43bcd9fb8556c74964cee80..e83f2abaa21e177d302c0be37363d07ea643bacc 100644 (file)
@@ -53,6 +53,9 @@ CLEANFILES = \
        $(bin_SCRIPTS) $(sbin_SCRIPTS) $(changelog_SCRIPTS) \
        install-info install-info-stamp
 
+perllibdir = $(PERL_LIBDIR)
+nobase_dist_perllib_DATA = \
+       Dpkg.pm
 
 dist_pkglib_SCRIPTS = \
        controllib.pl \
@@ -94,6 +97,14 @@ install-data-local:
        $(mkdir_p) $(DESTDIR)$(sysconfdir)/alternatives
        $(INSTALL_DATA) $(srcdir)/README.alternatives $(DESTDIR)$(sysconfdir)/alternatives/README
 
+# Ideally we'd use 'sed -i', but unfortunately that's not portable.
+install-data-hook:
+       cp -p $(DESTDIR)$(perllibdir)/Dpkg.pm \
+             $(DESTDIR)$(perllibdir)/Dpkg.pm.tmp
+       $(do_perl_subst) <$(DESTDIR)$(perllibdir)/Dpkg.pm.tmp \
+                        >$(DESTDIR)$(perllibdir)/Dpkg.pm
+       rm $(DESTDIR)$(perllibdir)/Dpkg.pm.tmp
+
 uninstall-local:
        rm -f $(DESTDIR)$(sysconfdir)/alternatives/README
        rm -f $(DESTDIR)$(sbindir)/install-info