[debhelper-devel] [debhelper] 07/11: dh_installdeb: Migrate files from /usr to profile's prefix

Niels Thykier nthykier at moszumanska.debian.org
Sun Jan 7 21:38:03 UTC 2018


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to annotated tag Release_2.6.0
in repository debhelper.

commit 25cfa6fc7f974ea799fc6e5ccca469919f233e64
Author: Dan Nicholson <nicholson at endlessm.com>
Date:   Thu Jan 28 09:28:16 2016 -0800

    dh_installdeb: Migrate files from /usr to profile's prefix
    
    Prior to creating the binary package with dpkg-deb, migrate installed
    files from /usr to the build profile specified prefix. This will
    transparently migrate the files without requiring any other debhelper
    commands since dh_installdeb is always used and always comes after all
    other installation activities are done.
---
 dh_installdeb | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/dh_installdeb b/dh_installdeb
index 0bd9252..07606de 100755
--- a/dh_installdeb
+++ b/dh_installdeb
@@ -19,6 +19,9 @@ B<dh_installdeb> is a debhelper program that is responsible for installing
 files into the F<DEBIAN> directories in package build directories with the
 correct permissions.
 
+If a build profile within B<DEB_BUILD_PROFILES> specifies a non-/usr
+prefix, files will be moved from F</usr> to the appropriate prefix.
+
 =head1 FILES
 
 =over 4
@@ -80,6 +83,18 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 		doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
 	}
 
+	# Migrate files to non-/usr prefix
+	my $prefix=substr get_buildprefix($package), 1;
+	if ($prefix ne "usr" && -d "$tmp/usr") {
+		# Create the prefix if necessary
+		doit("install", "-d", "-o", 0, "-g", 0, "$tmp/$prefix");
+
+		# Move files from /usr to prefix and delete /usr
+		my $cmd="tar -C $tmp/usr -cf- . | tar -C $tmp/$prefix -xpf-";
+		complex_doit($cmd);
+		doit("rm", "-rf", "$tmp/usr");
+	}
+
 	if (is_udeb($package)) {
 		# For udebs, only do the postinst, and no #DEBHELPER#.
 		# Udebs also support menutest and isinstallable scripts.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list