]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_install
r584: * Fix stupid typo in dh_movefiles. Closes: #188833
[debhelper.git] / dh_install
index afd5a2641418bfe2360b33deb098c5307fadcc7b..c37b9d3587978aeb1fcaba8cf39c6ba00bb2e2f4 100755 (executable)
@@ -56,11 +56,11 @@ specified, you should not list destination directories in
 debian/package.install files or on the command line. Instead, dh_install
 will guess as follows:
 
-Strip off debian/tmp from the front of the filename, if it is present, and
-install into the dirname of the filename. So if the filename is
-debian/tmp/usr/bin, then that directory will be copied to 
-debian/package/usr/. If the filename is debian/tmp/etc/passwd, it will be 
-copied to debian/package/etc/.
+Strip off debian/tmp (or the sourcedir if one is given) from the front of
+the filename, if it is present, and install into the dirname of the
+filename. So if the filename is debian/tmp/usr/bin, then that directory
+will be copied to debian/package/usr/. If the filename is
+debian/tmp/etc/passwd, it will be copied to debian/package/etc/.
 
 Note that if you list only a filename on a line by itself in a
 debian/package.install file, with no explicit destination, then dh_install
@@ -122,7 +122,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
        # Support for -X flag.
        my $exclude = '';
        if ($dh{EXCLUDE_FIND}) {
-               $exclude = '-and ! \( '.$dh{EXCLUDE_FIND}.' \)';
+               $exclude = '! \( '.$dh{EXCLUDE_FIND}.' \)';
        }
        
        foreach my $set (@install) {
@@ -138,7 +138,11 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                        if (! defined $dest) {
                                # Guess at destination directory.
                                $dest=$src;
-                               $dest=~s/^(.*\/)?debian\/tmp//;
+                               my $strip=$srcdir;
+                               if ($strip eq '.') {
+                                       $strip = "debian/tmp";
+                               }
+                               $dest=~s/^(.*\/)?\Q$strip\E//;
                                $dest=dirname($dest);
                        }
                        
@@ -153,6 +157,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                                # @installed stuff more robust.
                                $src=~y:/:/:s;
                                $src=~s:/+$::;
+                               $src=~s:^(\./)*::;
                                push @installed, "\Q$src\E\/.*|\Q$src\E";
                        }
                        
@@ -161,7 +166,10 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                                # Pity there's no cp --exclude ..
                                my $pwd=`pwd`;
                                chomp $pwd;
-                               complex_doit("cd $src/.. && find $dir_basename \\( -type f -or -type l \\) $exclude -exec cp --parents -dp {} $pwd/$tmp/$dest/ \\;");
+                               complex_doit("cd $src/.. && find $dir_basename $exclude \\( -type f -or -type l \\) -exec cp --parents -dp {} $pwd/$tmp/$dest/ \\;");
+                               # cp is annoying so I need a separate pass
+                               # just for empty directories
+                               complex_doit("cd $src/.. && find $dir_basename $exclude \\( -type d -and -empty \\) -exec cp --parents -a {} $pwd/$tmp/$dest/ \\;");
                        }
                        else {
                                doit("cp", "-a", $src, "$tmp/$dest/");
@@ -186,7 +194,7 @@ if ($dh{LIST_MISSING}) {
                push @missing, $_ unless /$installed/ || excludefile($_);
        }, $srcdir);
        if (@missing) {
-               warning "$_ not installed" foreach @missing;
+               warning "$_ exists in debian/tmp but not installed to anywhere" foreach @missing;
        }
 }
 
@@ -213,7 +221,7 @@ If you want a libfoo-dev package too, debian/libfoo-dev.install might contain:
 
 =head1 SEE ALSO
 
-L<debhelper(1)>
+L<debhelper(7)>
 
 This program is a part of debhelper.