diff --git a/Alien/Package/Rpm.pm b/Alien/Package/Rpm.pm index 022b71d..3135dff 100644 --- a/Alien/Package/Rpm.pm +++ b/Alien/Package/Rpm.pm @@ -176,31 +176,6 @@ sub unpack { or die "error moving unpacked files into the default prefix directory: $!"; } - if ($> == 0) { - # rpm files have two sets of permissions; the set in the cpio - # archive, and the set in the control data; which override them. - # The set in the control data are more correct, so let's use those. - open (GETPERMS, 'rpm --queryformat \'[%{FILEMODES} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILENAMES}\n]\' -qp '.$this->filename.' |'); - while () { - chomp; - my ($mode, $owner, $group, $file) = split(/ /, $_, 4); - $mode = $mode & 07777; # remove filetype - my $uid = getpwnam($owner); - if (! defined $uid) { - print STDERR "WARNING: $file is owned by a user ($owner) not on this system; using root instead"; - $uid=0; - } - my $gid = getgrnam($group); - if (! defined $gid) { - print STDERR "WARNING: $file is owned by a group ($group) not on this system; using group root instead"; - $gid=0; - } - next unless -e "$workdir/$file"; # skip broken links - chown($uid, $gid, "$workdir/$file") || die "failed chowning $file to $uid\:$gid\: $!"; - chmod($mode, "$workdir/$file") || die "failed changing mode of $file to $mode\: $!"; - } - } - # When cpio extracts the file, any child directories that are # present, but whose parent directories are not, end up mode 700. # This next block corrects that to 755, which is more reasonable. @@ -234,6 +209,31 @@ sub unpack { } chmod 0755, keys %tochmod if %tochmod; + if ($> == 0) { + # rpm files have two sets of permissions; the set in the cpio + # archive, and the set in the control data; which override them. + # The set in the control data are more correct, so let's use those. + open (GETPERMS, 'rpm --queryformat \'[%{FILEMODES} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILENAMES}\n]\' -qp '.$this->filename.' |'); + while () { + chomp; + my ($mode, $owner, $group, $file) = split(/ /, $_, 4); + $mode = $mode & 07777; # remove filetype + my $uid = getpwnam($owner); + if (! defined $uid) { + print STDERR "WARNING: $file is owned by a user ($owner) not on this system; using root instead\n"; + $uid=0; + } + my $gid = getgrnam($group); + if (! defined $gid) { + print STDERR "WARNING: $file is owned by a group ($group) not on this system; using group root instead\n"; + $gid=0; + } + next unless -e "$workdir/$file"; # skip broken links + chown($uid, $gid, "$workdir/$file") || die "failed chowning $file to $uid\:$gid\: $!"; + chmod($mode, "$workdir/$file") || die "failed changing mode of $file to $mode\: $!"; + } + } + return 1; } diff --git a/Makefile.PL b/Makefile.PL index 22a3500..28f04ad 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -17,6 +17,11 @@ sub MY::postamble { VER=$(shell perl -e '$$_=<>;print m/\((.*?)\)/'alien.lsm perl -i -pe "s/\@version\@/$(VER)/g" alien.spec @@ -39,13 +44,5 @@ alien: WriteMakefile( 'NAME' => 'Alien', 'EXE_FILES' => ['alien'], - # Pure evil. Hook into build and install targets - 'depend' => {'all:' => 'extra_build', - # Why build on clean? Because I want to ensure the spec file - # gets put in the tarball, and so it has to happen in debian/rules - # clean - 'clean:' => 'extra_build', - 'install:' => 'extra_install', - 'pure_install:' => 'extra_install'}, 'clean' => {FILES => 'alien'}, ); diff --git a/README b/README index 0ea5978..0442e09 100644 --- a/README +++ b/README @@ -66,7 +66,8 @@ Programs that use alien: package viewer that can convert between package formats by using alien. Its homepage is at http://www.momentus.com.br/users/hook/kpackviewer.html - Corel also appears to have something in Corel linux that uses alien. + Corel also appears to have (or had) something in Corel linux that + uses alien. Please report any bugs in alien to the author: diff --git a/debian/changelog b/debian/changelog index d7fab25..0eee993 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +alien (8.17) unstable; urgency=low + + * When converting from rpm, do parent directory 755 chmods first, then + known permissions setting from rpm --queryformat, so that it can override + any directories that do indeed have a permission set. + * Fixed MakeFile.PL to work with perl 5.8. + + -- Joey Hess Mon, 19 Aug 2002 12:49:04 -0400 + alien (8.16) unstable; urgency=low * Fixed rpm unpacking.