X-Git-Url: http://git.jankratochvil.net/?p=macros.git;a=blobdiff_plain;f=AutoGen.pm;h=17c1483b405b2a17663fc93c5d4304f929746049;hp=fcd9374db302b5da2402f3a0f044b4ee59381a1c;hb=38afe711acc16741ac20d9002e00626b7fe6d088;hpb=3d46297144805bfd628fb628534fe2257609b3a5 diff --git a/AutoGen.pm b/AutoGen.pm index fcd9374..17c1483 100644 --- a/AutoGen.pm +++ b/AutoGen.pm @@ -231,21 +231,28 @@ my($class,%args)=@_; @origs=glob $glob; confess "Invalid glob $glob: ".join(",",@origs) if 1!=@origs; } - my($base,$ext)=($origs[0]=~/^orig-(.*)[.]tar[.](gz|Z|bz2)$/); + my($origbase,$ext)=($origs[0]=~/^orig-(.*)[.]tar[.](gz|Z|bz2)$/); _copy $origs[0],_rpmeval("_sourcedir")."/".($origs[0]=~/^orig-(.*)$/)[0]; _system "tar x".($ext eq "bz2" ? "j" : "z")."f ".$origs[0]; - _mkdir $base."-orig"; + _mkdir $origbase."-orig"; # FIXME: Copy also dot-prefixed files! - _move \1,$base."/*",$base."-orig/"; - _system "tar xzf $name-*.tar.gz"; + _move \1,$origbase."/*",$origbase."-orig/"; + rmdir $origbase or confess "rmdir $origbase: $!"; + my @ours; + for my $glob ("$name-*.tar.gz") { + @ours=glob $glob; + confess "Invalid glob $glob: ".join(",",@ours) if 1!=@ours; + } + my($ourbase)=($ours[0]=~/^(.*)[.]tar[.]gz$/); + _system "tar xzf ".$ours[0]; # Use single-argument system() as we need shell redirection. # FIXME: Use directory-independent _cleanfiles(), not root-directory '.cvsignore'. # "-X -" does not work, it needs to be stat(2)able file. _system "diff -ruP -X .cvsignore -I '".'[$]\(Id\|RCSfile\)\>.*[$]'."'" - ." $base-orig/ $base/" + ." $origbase-orig/ $ourbase/" ." >"._rpmeval("_sourcedir")."/".$patch, sub { $_[0]==0 || $_[0]==1; }; # diff(1) returns non-zero return code on any diffs. - _remove \1,$base,$base."-orig"; + _remove \1,$ourbase,$origbase."-orig"; } _system(join(" ","rpmbuild", "-ba",