X-Git-Url: http://git.jankratochvil.net/?p=macros.git;a=blobdiff_plain;f=AutoGen.pm;h=aa4bb647bc1fbfac7c81eb70bb6da10d265cb2a5;hp=64dbad35d751ee3cb3e03511b12b748c4468147e;hb=6cf1604c42c41f1b95fae2d07e3b4725a1f99f90;hpb=8d1e5812718e7fa4c79c2af83e2a217b1542eb81 diff --git a/AutoGen.pm b/AutoGen.pm index 64dbad3..aa4bb64 100644 --- a/AutoGen.pm +++ b/AutoGen.pm @@ -88,7 +88,7 @@ my($filename)=@_; local *F; open F,$filename or confess "Open \"$filename\": $!"; my $r=; - close F or cluck "Close \"$filename\": $!"; + close F or confess "Close \"$filename\": $!"; # Do not &cluck as it may be pipe result return $r; } @@ -97,9 +97,9 @@ sub _writefile my($filename,@content)=@_; local *F; - open F,">".$filename or confess "rewrite \"$filename\": $!"; + open F,($filename=~/^[|]/ ? "" : ">").$filename or confess "rewrite \"$filename\": $!"; print F @content; - close F or cluck "close \"$filename\": $!"; + close F or confess "close \"$filename\": $!"; # Do not &cluck as it may be pipe result } my %_rpmeval_cache; @@ -222,7 +222,7 @@ my($class,%args)=@_; else { my @origs; for my $glob ("orig-$name-*.tar.{gz,Z}") { - @origs=glob "orig-$name-*.tar.{gz,Z,bz2}"; + @origs=glob $glob; confess "Invalid glob $glob: ".join(",",@origs) if 1!=@origs; } my $base=($origs[0]=~/^orig-(.*)[.]tar[.](?:gz|Z)$/)[0]; @@ -265,12 +265,27 @@ my($class,%args)=@_; my $name=$Options{"name"}; $class->_prepdist($name); _system "make distdir"; - _system(join(" ","cd $name-*;dpkg-buildpackage", + # Copy 'orig' archive after &_prepdist which would delete it. + my @origs; + for my $glob ("orig-$name-*.tar.{gz,Z}") { + @origs=glob $glob; + if (@origs) { + confess "Invalid glob $glob: ".join(",",@origs) if 1!=@origs; + (my $deborig=$origs[0])=~s/^orig-([^-]+)-(.*)([.]tar[.][^.]+)$/$1_$2.orig$3/; + _copy $origs[0],$deborig; + } + } + my @subdirs; + for my $glob ("$name-*") { + @subdirs=glob $glob; + confess "Invalid glob $glob: ".join(",",@subdirs) if 1!=@subdirs; + } + _system(join(" ","cd ".$subdirs[0].";dpkg-buildpackage", "-rfakeroot", ($args{"sign"} ? () : ("-us","-uc")), )); - _remove \1,"$name-*"; - _system "ls -l ${name}_*"; + _remove \1,$subdirs[0]; + _system "ls -l ${name}*_[0-9]*"; exit 0; # should never return } @@ -324,7 +339,7 @@ sub _cleanfiles ./-[0-9]* ./-devel-[0-9]* ./.spec ./.m4 ./.spec.m4 ./debian/tmp ./debian/ - ./_[0-9]* + ./*_[0-9]* ./macros/macros.dep ./po/Makefile.in.in ./po/POTFILES* ./po/cat-id-tbl.c ./po/cat-id-tbl.tmp ./po/*.gmo ./po/*.mo ./po/stamp-cat-id ./po/.pot ./po/ChangeLog @@ -457,6 +472,7 @@ my($class,%options)=@_; "rpmtest" ,sub { $class->_rpmbuild("sign"=>0); }, "deb" ,sub { $class->_debbuild("sign"=>1); }, "debtest" ,sub { $class->_debbuild("sign"=>0); }, + "cleanfilesfordir=s",sub { print "$_\n" for (_cleanfilesfordir $_[1]); exit 0; }, "dist" ,\$Options{"ARGV_dist"}, "copy!" ,\$Options{"ARGV_copy"}, "fullclean",\$Options{"ARGV_fullclean"}, @@ -549,6 +565,22 @@ my($class,%options)=@_; File::Touch->new("atime_only"=>1)->touch("ChangeLog") if !$Options{"ChangeLog"}; _system qw(automake --add-missing),@copy_arg; _system qw(autoconf); + _writefile "| patch configure",<<'CONFIGURE_SUBST_X_EOF'; +--- configure-orig Wed Aug 20 12:10:37 2003 ++++ configure Wed Aug 20 13:22:51 2003 +@@ -21590,6 +21590,11 @@ + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file ++ for f in $ac_file_inputs; do ++ if test -x $f; then ++ chmod +x $ac_file ++ fi ++ done + else + cat $tmp/out + rm -f $tmp/out +CONFIGURE_SUBST_X_EOF # Why it is left there after RedHat autoconf-2.53-8 ? _remove "nocheck",\1,"autom4te-*.cache";