* 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.
This commit is contained in:
joey
2002-08-19 16:53:30 +00:00
parent c6b855ed5c
commit 21393f2767
4 changed files with 41 additions and 34 deletions

View File

@@ -176,31 +176,6 @@ sub unpack {
or die "error moving unpacked files into the default prefix directory: $!"; 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 (<GETPERMS>) {
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 # When cpio extracts the file, any child directories that are
# present, but whose parent directories are not, end up mode 700. # present, but whose parent directories are not, end up mode 700.
# This next block corrects that to 755, which is more reasonable. # This next block corrects that to 755, which is more reasonable.
@@ -234,6 +209,31 @@ sub unpack {
} }
chmod 0755, keys %tochmod if %tochmod; 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 (<GETPERMS>) {
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; return 1;
} }

View File

@@ -17,6 +17,11 @@ sub MY::postamble {
VER=$(shell perl -e '$$_=<>;print m/\((.*?)\)/'<debian/changelog) VER=$(shell perl -e '$$_=<>;print m/\((.*?)\)/'<debian/changelog)
all:: extra_build
clean:: extra_build
install:: extra_install
pure_install:: extra_install
extra_build: extra_build:
perl -i -pe "s/\@version\@/$(VER)/g" <alien.lsm.in >alien.lsm perl -i -pe "s/\@version\@/$(VER)/g" <alien.lsm.in >alien.lsm
perl -i -pe "s/\@version\@/$(VER)/g" <alien.spec.in >alien.spec perl -i -pe "s/\@version\@/$(VER)/g" <alien.spec.in >alien.spec
@@ -39,13 +44,5 @@ alien:
WriteMakefile( WriteMakefile(
'NAME' => 'Alien', 'NAME' => 'Alien',
'EXE_FILES' => ['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'}, 'clean' => {FILES => 'alien'},
); );

3
README
View File

@@ -66,7 +66,8 @@ Programs that use alien:
package viewer that can convert between package formats by using alien. Its package viewer that can convert between package formats by using alien. Its
homepage is at http://www.momentus.com.br/users/hook/kpackviewer.html 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: Please report any bugs in alien to the author:

9
debian/changelog vendored
View File

@@ -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 <joeyh@debian.org> Mon, 19 Aug 2002 12:49:04 -0400
alien (8.16) unstable; urgency=low alien (8.16) unstable; urgency=low
* Fixed rpm unpacking. * Fixed rpm unpacking.