diff --git a/Alien/Package/Deb.pm b/Alien/Package/Deb.pm index c8946f6..828727b 100644 --- a/Alien/Package/Deb.pm +++ b/Alien/Package/Deb.pm @@ -77,6 +77,28 @@ sub install { die "Unable to install"; } +=item getcontrolfile + +Helper method. Pass it the name of a control file, and it will pull it out +of the deb and return it. + +=cut + +sub getcontrolfile { + my $this=shift; + my $controlfile=shift; + my $file=$this->filename; + + if ($this->have_dpkg_deb) { + return `dpkg-deb --info $file $controlfile 2>/dev/null`; + } + else { + # Have to handle old debs without a leading ./ and + # new ones with it. + return `ar p $file control.tar.gz | tar Oxzf - $controlfile ./$controlfile 2>/dev/null` + } +} + =item scan Implement the scan method to read a deb file. @@ -88,16 +110,7 @@ sub scan { $this->SUPER::scan(@_); my $file=$this->filename; - # Extract the control file from the deb file. - my @control; - if ($this->have_dpkg_deb) { - @control = `dpkg-deb --info $file control`; - } - else { - # It can have one of two names, depending on the tar - # version the .deb was built from. - @control = `ar p $file control.tar.gz | tar Oxzf - control [./]control`; - } + my @control=$this->getcontrolfile('control'); # Parse control file and extract fields. Use a translation table # to map between the debian names and the internal field names, @@ -137,18 +150,11 @@ sub scan { $this->group("unknown") if ! $this->group; $this->distribution("Debian"); $this->origformat("deb"); - $this->binary_info(scalar `dpkg --info $file`); + $this->binary_info(scalar $this->getcontrolfile('control')); # Read in the list of conffiles, if any. my @conffiles; - if ($this->have_dpkg_deb) { - @conffiles=map { chomp; $_ } - `dpkg-deb --info $file conffiles 2>/dev/null`; - } - else { - @conffiles=map { chomp; $_ } - `ar p $file control.tar.gz | tar Oxzf - conffiles 2>/dev/null`; - } + @conffiles=map { chomp; $_ } $this->getcontrolfile('conffiles'); $this->conffiles(\@conffiles); # Read in the list of all files. @@ -166,12 +172,7 @@ sub scan { # Read in the scripts, if any. foreach my $field (qw{postinst postrm preinst prerm}) { - if ($this->have_dpkg_deb) { - $this->$field(scalar `dpkg-deb --info $file $field 2>/dev/null`); - } - else { - $this->$field(scalar `ar p $file control.tar.gz | tar Oxzf - $field 2>/dev/null`); - } + $this->$field(scalar $this->getcontrolfile($field)); } return 1; diff --git a/Alien/Package/Rpm.pm b/Alien/Package/Rpm.pm index 592c6ab..aa79b1f 100644 --- a/Alien/Package/Rpm.pm +++ b/Alien/Package/Rpm.pm @@ -219,14 +219,21 @@ sub prep { my @conffiles = @{$this->conffiles}; my $filelist; foreach my $fn (@{$this->filelist}) { + # Unquote any escaped characters in filenames - needed for + # non ascii characters. (eg. iso_8859-1 latin set) + if ($fn =~ /\\/) { + $fn=eval qq{"$fn"}; + } + + # Note all filenames are quoted in case they contain + # spaces. if ($fn =~ m:/$:) { - $filelist.="%dir $fn\n"; + $filelist.=qq{%dir "$fn"\n}; } elsif (grep(m:^\Q$fn\E$:,@conffiles)) { # it's a conffile - $filelist.="%config $fn\n"; + $filelist.=qq{%config "$fn"\n}; } else { # normal file - # Quote filename in case it has spaces in it. $filelist.=qq{"$fn"\n}; } } diff --git a/README b/README index 47c35e4..8b79099 100644 --- a/README +++ b/README @@ -41,6 +41,19 @@ Other things you'll need: The Stampede version is at ftp://ykbsb2.yk.psu.edu/pub/alien/alien-extra.slp +Note: + + Alien is really designed to be used to convert from alien file formats to + the packaging format used by the distribution you run it on. Of course, + it can also convert from your distribution's native format to alien + formats, or from one alien format to another. Do be warned though, that + if these latter types of conversions are done, the generated packages may + have incorrect dependancy information. This is known to be true if you + convert a rpm into a deb on a Red Hat system, for example. Even with + alien-extra installed, dpkg will be unable to properly calculate library + dependancies for the deb it is creating, and you will get a package + without any library dependancies. + Programs that use alien: I know of one program that acts as a frontend to alien - kpackviewer is a diff --git a/debian/changelog b/debian/changelog index edbf1b1..103c625 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +alien (7.6) unstable; urgency=low + + * Added a note about a sticky library dependancy issue that I can't fix. + * Applied a patch from Chris Gorman to deal with spaces in directory + names, spaces in conffile names (!!), and accented characters + everywhere in deb -> rpm conversions. + * Fixed numerous problems when converting from .deb w/o dpkg installed. + + -- Joey Hess Thu, 20 Jul 2000 15:12:08 -0700 + alien (7.5) unstable; urgency=low * Fixed an uninitialized value when converting from a .src.rpm.