3 # Move files out of debian/tmp, into subpackages.
5 BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
11 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
12 $TMP=tmpdir($PACKAGE);
13 $files=pkgfile($PACKAGE,"files");
15 if (! -d "debian/tmp") {
16 error("debian/tmp does not exist.");
21 # debian/files has a different purpose, so ignore it.
22 if ( $files && $files ne "debian/files" ) {
23 @tomove=filearray($files);
26 if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
30 if (@tomove && $TMP eq "debian/tmp") {
31 error("I was asked to move files from debian/tmp to debian/tmp.");
36 doit("install","-d",$TMP);
38 # Now we need to expand wildcards in @tomove.
41 push @filelist, glob("debian/tmp/$_");
44 # Order the files. First all real files, then symlinks.
45 # Putting symlinks last is a nice thing to do for library
46 # packages and doesn't affect much of anything else.
47 doit("rm","-f","movelist");
49 $ret=1 if (! -e $_ && ! -l $_);
51 complex_doit("(cd debian/tmp ; find $_ ! -type d -and ! -type l -print || true) >> movelist");
54 $ret=1 if (! -e $_ && ! -l $_);
56 complex_doit("(cd debian/tmp ; find $_ ! -type d -and -type l -print || true) >> movelist");
58 complex_doit("(cd debian/tmp;tar --create --remove-files --files-from=../../movelist --file -) | (cd $TMP;tar xpf -)");
59 doit("rm","-f","movelist");
63 # If $ret is set, we wern't actually able to find some
64 # files that were specified to be moved, and we should
65 # exit with the code in $ret. This program puts off
66 # exiting with an error until all files have been tried
67 # to be moved, because this makes it easier for some
68 # packages that arn't always sure exactly which files need