]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_movefiles
r399: * dh_movefiles: added error message on file not found
[debhelper.git] / dh_movefiles
index bf1fa667be99b1fe7ca8b57600b13cf7802dfc83..cbfc3e6c71aa5b2ba02abd87779c38ae87f31a47 100755 (executable)
@@ -29,7 +29,7 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
 
         # debian/files has a different purpose, so ignore it.
        if ( $files && $files ne "debian/files" ) {
-               @tomove=filearray($files);
+               @tomove=filearray($files, $sourcedir);
        }
        
        if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
@@ -37,37 +37,34 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
        }
 
        if (@tomove && $TMP eq $sourcedir) {
-               error("I was asked to move files from $sourcedir to $sourcedir.");
+               error("I was asked to move files from $sourcedir to $sourcedir. Perhaps you should set DH_COMAPT=2?");
        }
 
-       if (@tomove) {
-               if (! -d $TMP) {
-                       doit("install","-d",$TMP);
-               }
-               # Now we need to expand wildcards in @tomove.
+       # Now we need to expand wildcards in @tomove.
+       # This is only necessary in pre-v3 land -- as of v3, the
+       # expension is automatically done by filearray().
+       if (@tomove && ! Debian::Debhelper::Dh_Lib::compat(3)) {
                @filelist=();
                foreach (@tomove) {
                        push @filelist, glob("$sourcedir/$_");
                }
+               @tomove=@filelist;
+       }
 
-               # If the globs expended to nothing, we are done.
-               next unless @filelist;
+       if (@tomove) {
+               if (! -d $TMP) {
+                       doit("install","-d",$TMP);
+               }
 
-               # Order the files. First all real files, then symlinks. 
-               # Putting symlinks last is a nice thing to do for library 
-               # packages and doesn't affect much of anything else.
                doit("rm","-f","debian/movelist");
-               foreach (@filelist) {
-                       $file=$_;
-                       $ret=1 if (! -e $file && ! -l $file);
-                       $file=~s:^$sourcedir/+::;
-                       complex_doit("(cd $sourcedir >/dev/null ; find $file ! -type d -and ! -type l -print || true) >> debian/movelist");
-               }
-               foreach (@filelist) {
+               foreach (@tomove) {
                        $file=$_;
-                       $ret=1 if (! -e $file && ! -l $file);
-                       $file=~s:^$sourcedir/+::;
-                       complex_doit("(cd $sourcedir >/dev/null ; find $file ! -type d -and -type l -print || true) >> debian/movelist");
+                       if (! -e $file && ! -l $file) {
+                               $ret=1;
+                               warning("$file not found");
+                       }
+                       $file=~s:^\Q$sourcedir\E/+::;
+                       complex_doit("(cd $sourcedir >/dev/null ; find $file ! -type d -print || true) >> debian/movelist");
                }
                complex_doit("(cd $sourcedir >/dev/null ; tar --create --remove-files --files-from=../movelist --file -) | (cd $TMP >/dev/null ;tar xpf -)");
                doit("rm","-f","debian/movelist");