42 Commits
8.81 ... 8.92

Author SHA1 Message Date
Joey Hess
3572ac62b9 foo 2014-08-31 14:16:51 -07:00
Joey Hess
6443b942ab prep 2014-08-31 14:16:33 -07:00
Joey Hess
919297f3d1 Remove suggests for lsb-rpm, which no longer exists. Closes: #756873 2014-08-02 19:20:25 -04:00
Joey Hess
22709da70e prep 2014-06-13 12:04:21 -04:00
Joey Hess
06ae0587ac prep release 2014-06-13 12:04:01 -04:00
Joey Hess
c1b64b0c48 Support other deb data.tar compression schemes in fallback code. Closes: #718364 Thanks, Guillem Jover 2014-05-18 12:21:01 -04:00
Guillem Jover
93ad8ae367 Update deb support in fallback code
Add support for control.tar, control.tar.xz, data.tar, data.tar.xz,
data.tar.bz2 (deprecated) and data.tar.lzma (deprecated), so that the
fallback code is in line with current dpkg-deb.

The deprecated members are supported because there might be such binary
packages laying around.
2014-05-18 12:20:18 -04:00
Joey Hess
d3750a8156 prep release 2014-02-27 12:00:21 -04:00
Joey Hess
7a1afcfb97 prep release 2014-02-27 11:59:27 -04:00
Joey Hess
2999238f34 Add conversion from ppc64le (rpm) to ppc64el (deb). 2014-02-26 13:09:32 -04:00
Joey Hess
887717f304 changelog 2014-01-17 14:05:43 -04:00
Teemu Ikonen
9cb511802b Add --target=<arch> option for setting architecture. 2014-01-17 14:05:05 -04:00
Krzysztof Opasiak
6f5a303f3b Treat armv7l as an alias to armel architecture.
There are some OS like Tizne which use rpm's and build
them for armv7l architecture. In debain nomenclature
this architecture is armel, so armv7l should be
an alias to armel.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2013-12-10 12:36:17 -04:00
Joey Hess
92933477e6 need to check in these files to use dgit
These files appear in the tarball, so dgit requires they be in git. hmm.
2013-08-26 01:06:39 -04:00
Joey Hess
53751ccbbf Merge remote-tracking branch 'remotes/dgit/dgit/sid' 2013-08-26 00:59:39 -04:00
Joey Hess
41fc0d549f prep release (with dgit!) 2013-08-26 00:48:28 -04:00
Joey Hess
b1bd50cc90 Handle whitespace in path to RPMs. Closes: #719776 (Thanks, Christopher Huhn) 2013-08-15 11:10:46 +02:00
Christopher Huhn
dd38b4e86d Correctly handle RPMs with whitespace in their path 2013-08-15 11:09:22 +02:00
Joey Hess
7aee419bd2 Correct man page to say RPMBUILDOPT (not RPMBUILDOPTS). Closes: #701106 2013-02-21 17:05:03 -04:00
Joey Hess
db4ea6fa4a releasing version 8.88 2012-08-09 14:45:24 -04:00
Joey Hess
f545de15f5 alien (8.88) unstable; urgency=low
* Ensure that version numbers begin with well, a number, when building a
    deb, otherwise dpkg-deb will refuse to build it.

# imported from the archive
2012-08-09 14:44:49 -04:00
Joey Hess
2fb28d27d2 Ensure that version numbers begin with well, a number, when building a deb, otherwise dpkg-deb will refuse to build it. 2012-08-09 14:14:59 -04:00
Joey Hess
363deec1c6 releasing version 8.87 2012-04-05 13:54:58 -04:00
Joey Hess
b69f536367 Fix adding of postinst script to deb, containing rpm permissions fixups code. Closes: #667651 2012-04-05 13:51:24 -04:00
Joey Hess
f717997da1 Use lsb-rpmbuild, not lsb-rpm. Closes: #667044
Note that lsb-rpm has been dropped from rpm in Debian unstable. So
this changes nothing really; it already fell back to rpmbuild.

And I can find no mention of either lsb-rpm or lsb-rpmbuild in the LSB
spec, although I didn't look very hard.
2012-04-04 13:36:18 -04:00
Joey Hess
3faa48b23f update copyright format url 2012-02-25 10:43:13 -04:00
Joey Hess
e745cde2a0 releasing version 8.86 2011-11-12 13:14:11 -04:00
Joey Hess
5e4e122d58 Filter out illegal characters in version number when building a deb. Closes: #648531 2011-11-12 13:12:25 -04:00
Joey Hess
873c3606f3 typo 2011-09-29 21:31:38 -04:00
Joey Hess
7640cb99d4 releasing version 8.85 2011-06-19 15:51:33 -04:00
Joey Hess
585fc93270 Avoid breaking on spaces in filenames. Closes: #618636
The runpipe interface is not a good one, it would be better to use
something that does not expose to the shell.

As a quick fix, quote filenames in runpipe calls. Too bad if you have a
quote character in a file though. Later need to find a better interface
or do full shell escaping.
2011-06-11 13:00:34 -04:00
Joey Hess
5b49be4d3d releasing version 8.84 2011-04-15 14:14:38 -04:00
Joey Hess
2dee87ca02 add bug closure 2011-04-15 14:13:11 -04:00
Joey Hess
5c6bf645b5 DEP5 2011-01-13 18:48:08 -04:00
Joey Hess
1ca19300b4 Squash an uninitialized value when creating a deb. 2011-01-06 13:49:40 -04:00
Joey Hess
9b37ec8545 Silence error message when deleting build tree after making an rpm, if rpmbuild has already deleted it. 2011-01-06 13:47:37 -04:00
Joey Hess
143131c8c0 releasing version 8.83 2010-09-09 08:25:35 -04:00
Joey Hess
0d765b965d Correct handling of arch all packages in deb arch check. Closes: #596209 2010-09-09 08:24:54 -04:00
Joey Hess
efeddebd32 releasing version 8.82 2010-08-30 17:09:52 -04:00
Joey Hess
3a44b767ac Print a nice error message when attempting to build a deb from a package of an unsupported architecture. Closes: #592625 2010-08-30 17:02:26 -04:00
Joey Hess
291db35466 use dpkg-mergechangelog 2010-05-24 11:12:33 -04:00
Joey Hess
66b2a2a226 debhelper updates
* Use debhelper compat level v7 when building packages. All changes
  since v4 seem safe for alien's generated rules files.
* Use dh_prep instead of deprecated dh_clean -k.
2010-05-23 18:56:57 -04:00
15 changed files with 349 additions and 115 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
debian/changelog merge=dpkg-mergechangelogs

2
.gitignore vendored
View File

@@ -1,2 +0,0 @@
alien.lsm
alien.spec

View File

@@ -339,14 +339,17 @@ sub DESTROY {
die "alien internal error: unpacked_tree is set to '/'. Please file a bug report!"; die "alien internal error: unpacked_tree is set to '/'. Please file a bug report!";
} }
# Just in case some dir perms are too screwed up for rm to work and if (-d $this->unpacked_tree) {
# we're not running as root. NB: can't use xargs # Just in case some dir perms are too screwed up for
# rm to work and we're not running as root. NB: can't
# use xargs
$this->do('find', $this->unpacked_tree, '-type', 'd', $this->do('find', $this->unpacked_tree, '-type', 'd',
'-exec', 'chmod', '755', '{}', ';'); '-exec', 'chmod', '755', '{}', ';');
$this->do('rm', '-rf', $this->unpacked_tree) $this->do('rm', '-rf', $this->unpacked_tree)
or die "unable to delete temporary directory '".$this->unpacked_tree."': $!"; or die "unable to delete temporary directory '".$this->unpacked_tree."': $!";
$this->unpacked_tree(''); $this->unpacked_tree('');
}
$?=$exitcode; $?=$exitcode;
} }

View File

@@ -9,6 +9,7 @@ Alien::Package::Deb - an object that represents a deb package
package Alien::Package::Deb; package Alien::Package::Deb;
use strict; use strict;
use base qw(Alien::Package); use base qw(Alien::Package);
use List::Util qw(first);
=head1 DESCRIPTION =head1 DESCRIPTION
@@ -23,6 +24,10 @@ Alien::Package.
Set to a true value if dpkg-deb is available. Set to a true value if dpkg-deb is available.
=item deb_member_list
Set to the list of member names in the deb package.
=item dirtrans =item dirtrans
After the build stage, set to a hash reference of the directories we moved After the build stage, set to a hash reference of the directories we moved
@@ -110,13 +115,33 @@ sub test {
return map { s/\n//; $_ } return map { s/\n//; $_ }
grep { grep {
! /unknown-section alien/ ! /unknown-section alien/
} $this->runpipe(1, "lintian $deb"); } $this->runpipe(1, "lintian '$deb'");
} }
else { else {
return "lintian not available, so not testing"; return "lintian not available, so not testing";
} }
} }
=item get_deb_member_list
Helper method. Pass it the name of the deb and it will return the list of
ar members.
=cut
sub get_deb_member_list {
my $this=shift;
my $file=$this->filename;
my $members=$this->deb_member_list;
unless (defined $members) {
$members = [ map { chomp; $_ } $this->runpipe(1, "ar -t '$file'") ];
$this->deb_member_list($members);
}
return @{$members};
}
=item getcontrolfile =item getcontrolfile
Helper method. Pass it the name of a control file, and it will pull it out Helper method. Pass it the name of a control file, and it will pull it out
@@ -130,7 +155,7 @@ sub getcontrolfile {
my $file=$this->filename; my $file=$this->filename;
if ($this->have_dpkg_deb) { if ($this->have_dpkg_deb) {
return $this->runpipe(1, "dpkg-deb --info $file $controlfile 2>/dev/null"); return $this->runpipe(1, "dpkg-deb --info '$file' $controlfile 2>/dev/null");
} }
else { else {
# Solaris tar doesn't support O # Solaris tar doesn't support O
@@ -139,14 +164,61 @@ sub getcontrolfile {
return "(mkdir /tmp/tar_out.$$ &&". return "(mkdir /tmp/tar_out.$$ &&".
" cd /tmp/tar_out.$$ &&". " cd /tmp/tar_out.$$ &&".
" tar xf - ./$file &&". " tar xf - './$file' &&".
" cat $file; cd /; rm -rf /tmp/tar_out.$$)"; " cat '$file'; cd /; rm -rf /tmp/tar_out.$$)";
} }
my $getcontrol = "ar -p $file control.tar.gz | gzip -dc | ".tar_out($controlfile)." 2>/dev/null"; my $controlcomp;
my $controlmember = first { /^control\.tar/ }
$this->get_deb_member_list;
if (! defined $controlmember) {
die 'Cannot find control member!';
} elsif ($controlmember eq 'control.tar.gz') {
$controlcomp = 'gzip -dc';
} elsif ($controlmember eq 'control.tar.xz') {
$controlcomp = 'xz -dc';
} elsif ($controlmember eq 'control.tar') {
$controlcomp = 'cat';
} else {
die 'Unknown control member!';
}
my $getcontrol = "ar -p '$file' $controlmember | $controlcomp | ".tar_out($controlfile)." 2>/dev/null";
return $this->runpipe(1, $getcontrol); return $this->runpipe(1, $getcontrol);
} }
} }
=item get_datamember_cmd
Helper method. Pass it the name of the deb and it will return the raw
command needed to extract the data.tar member.
=cut
sub get_datamember_cmd {
my $this=shift;
my $file=$this->filename;
my $datacomp;
my $datamember = first { /^data\.tar/ }
$this->get_deb_member_list;
if (! defined $datamember) {
die 'Cannot find data member!';
} elsif ($datamember eq 'data.tar.gz') {
$datacomp = 'gzip -dc';
} elsif ($datamember eq 'data.tar.bz2') {
$datacomp = 'bzip2 -dc';
} elsif ($datamember eq 'data.tar.xz') {
$datacomp = 'xz -dc';
} elsif ($datamember eq 'data.tar.lzma') {
$datacomp = 'xz -dc';
} elsif ($datamember eq 'data.tar') {
$datacomp = 'cat';
} else {
die 'Unknown data member!';
}
return "ar -p '$file' $datamember | $datacomp";
}
=item scan =item scan
Implement the scan method to read a deb file. Implement the scan method to read a deb file.
@@ -209,15 +281,15 @@ sub scan {
# Read in the list of all files. # Read in the list of all files.
# Note that tar doesn't supply a leading '/', so we have to add that. # Note that tar doesn't supply a leading '/', so we have to add that.
my @filelist; my $datamember_cmd;
if ($this->have_dpkg_deb) { if ($this->have_dpkg_deb) {
@filelist=map { chomp; s:\./::; "/$_" } $datamember_cmd = "dpkg-deb --fsys-tarfile '$file'";
$this->runpipe(0, "dpkg-deb --fsys-tarfile $file | tar tf -");
} }
else { else {
@filelist=map { chomp; s:\./::; "/$_" } $datamember_cmd = $this->get_datamember_cmd($file);
$this->runpipe(0, "ar -p $file data.tar.gz | gzip -dc | tar tf -");
} }
my @filelist=map { chomp; s:\./::; "/$_" }
$this->runpipe(0, "$datamember_cmd | tar tf -");
$this->filelist(\@filelist); $this->filelist(\@filelist);
# Read in the scripts, if any. # Read in the scripts, if any.
@@ -244,7 +316,9 @@ sub unpack {
or die "Unpacking of '$file' failed: $!"; or die "Unpacking of '$file' failed: $!";
} }
else { else {
$this->do("ar -p $file data.tar.gz | gzip -dc | (cd ".$this->unpacked_tree."; tar xpf -)") my $datamember_cmd = $this->get_datamember_cmd($file);
$this->do("$datamember_cmd | (cd ".$this->unpacked_tree."; tar xpf -)")
or die "Unpacking of '$file' failed: $!"; or die "Unpacking of '$file' failed: $!";
} }
@@ -307,7 +381,7 @@ sub prep {
or die "patch error: $!"; or die "patch error: $!";
# Look for .rej files. # Look for .rej files.
die "patch failed with .rej files; giving up" die "patch failed with .rej files; giving up"
if $this->runpipe(1, "find $dir -name \"*.rej\""); if $this->runpipe(1, "find '$dir' -name \"*.rej\"");
$this->do('find', '.', '-name', '*.orig', '-exec', 'rm', '{}', ';'); $this->do('find', '.', '-name', '*.orig', '-exec', 'rm', '{}', ';');
$this->do("chmod", 755, "$dir/debian/rules"); $this->do("chmod", 755, "$dir/debian/rules");
@@ -383,6 +457,11 @@ sub prep {
close OUT; close OUT;
} }
# Use debhelper v7
open (OUT, ">$dir/debian/compat") || die "$dir/debian/compat: $!";
print OUT "7\n";
close OUT;
# A minimal rules file. # A minimal rules file.
open (OUT, ">$dir/debian/rules") || die "$dir/debian/rules: $!"; open (OUT, ">$dir/debian/rules") || die "$dir/debian/rules: $!";
my $fixpermscomment = $this->fixperms ? "" : "#"; my $fixpermscomment = $this->fixperms ? "" : "#";
@@ -390,12 +469,6 @@ sub prep {
#!/usr/bin/make -f #!/usr/bin/make -f
# debian/rules for alien # debian/rules for alien
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# Use v4 compatability mode, so ldconfig gets added to maint scripts.
export DH_COMPAT=4
PACKAGE=\$(shell dh_listpackages) PACKAGE=\$(shell dh_listpackages)
build: build:
@@ -411,7 +484,7 @@ binary-indep: build
binary-arch: build binary-arch: build
dh_testdir dh_testdir
dh_testroot dh_testroot
dh_clean -k -d dh_prep
dh_installdirs dh_installdirs
dh_installdocs dh_installdocs
@@ -444,18 +517,16 @@ EOF
close OUT; close OUT;
$this->do("chmod", 755, "$dir/debian/rules"); $this->do("chmod", 755, "$dir/debian/rules");
# Save any scripts.
if ($this->usescripts) { if ($this->usescripts) {
foreach my $script (qw{postinst postrm preinst prerm}) { foreach my $script (qw{postinst postrm preinst prerm}) {
my $data=$this->$script(); $this->savescript($script, $this->$script());
next unless defined $data;
next if $data =~ m/^\s*$/;
open (OUT,">$dir/debian/$script") ||
die "$dir/debian/$script: $!";
print OUT $data;
close OUT;
} }
} }
else {
# There may be a postinst with permissions fixups even when
# scripts are disabled.
$this->savescript("postinst", undef);
}
my %dirtrans=( # Note: no trailing slashes on these directory names! my %dirtrans=( # Note: no trailing slashes on these directory names!
# Move files to FHS-compliant locations, if possible. # Move files to FHS-compliant locations, if possible.
@@ -489,6 +560,16 @@ Build a deb.
sub build { sub build {
my $this=shift; my $this=shift;
# Detect architecture mismatch and abort with a comprehensible
# error message.
my $arch=$this->arch;
if ($arch ne 'all') {
my $ret=system("dpkg-architecture", "-i".$arch);
if ($ret != 0) {
die $this->filename." is for architecture ".$this->arch." ; the package cannot be built on this system"."\n";
}
}
chdir $this->unpacked_tree; chdir $this->unpacked_tree;
my $log=$this->runpipe(1, "debian/rules binary 2>&1"); my $log=$this->runpipe(1, "debian/rules binary 2>&1");
chdir ".."; chdir "..";
@@ -587,12 +668,13 @@ sub version {
# get # get
return unless defined wantarray; # optimization return unless defined wantarray; # optimization
$_=$this->{version}; $_=$this->{version};
# Make sure the version contains digets. # Make sure the version contains a digit at the start, as required
unless (/[0-9]/) { # by dpkg-deb.
# Drat. Well, add some. dpkg-deb won't work unless (/^[0-9]/) {
# on a version w/o numbers! $_="0".$_;
return $_."0";
} }
# filter out some characters not allowed in debian versions
s/[^-.+~:A-Za-z0-9]//g; # see lib/dpkg/parsehelp.c parseversion
return $_; return $_;
} }
@@ -718,29 +800,49 @@ sub username {
return $username; return $username;
} }
=item postinst =item savescript
Returns the postinst. This may include generated shell code to set owners Saves script to debian directory.
and groups from the owninfo field, and update modes from the modeinfo field.
=cut =cut
sub postinst { sub savescript {
my $this=shift; my $this=shift;
my $script=shift;
my $data=shift;
if (@_) { if ($script eq 'postinst') {
$this->{postinst}=shift; $data=$this->gen_postinst($data);
} }
my $dir=$this->unpacked_tree;
return unless defined $data;
next if $data =~ m/^\s*$/;
open (OUT,">$dir/debian/$script") ||
die "$dir/debian/$script: $!";
print OUT $data;
close OUT;
}
=item gen_postinst
Modifies or creates a postinst. This may include generated shell code to set
owners and groups from the owninfo field, and update modes from the modeinfo
field.
=cut
sub gen_postinst {
my $this=shift;
my $postinst=shift;
my $owninfo = $this->owninfo; my $owninfo = $this->owninfo;
my $modeinfo = $this->modeinfo; my $modeinfo = $this->modeinfo;
my $postinst = $this->{postinst}; return $postinst unless ref $owninfo && %$owninfo;
return $postinst unless ref $owninfo;
# If there is no postinst, let's make one up.. # If there is no postinst, let's make one up..
$postinst="#!/bin/sh\n" unless length $postinst; $postinst="#!/bin/sh\n" unless defined $postinst && length $postinst;
return $postinst unless %$owninfo;
my ($firstline, $rest)=split(/\n/, $postinst, 2); my ($firstline, $rest)=split(/\n/, $postinst, 2);
if ($firstline !~ m/^#!\s*\/bin\/(ba)?sh/) { if ($firstline !~ m/^#!\s*\/bin\/(ba)?sh/) {

View File

@@ -30,7 +30,7 @@ sub checkfile {
my $this=shift; my $this=shift;
my $file=shift; my $file=shift;
return unless $file =~ m/^lsb-.*\.rpm$/; return unless $file =~ m/^lsb-.*\.rpm$/;
my @deps=$this->runpipe(1, "LANG=C rpm -qp -R $file"); my @deps=$this->runpipe(1, "LANG=C rpm -qp -R '$file'");
return 1 if grep { s/\s+//g; $_ eq 'lsb' } @deps; return 1 if grep { s/\s+//g; $_ eq 'lsb' } @deps;
return; return;
} }
@@ -96,8 +96,8 @@ sub revert {
=item build =item build
Uses the parent's build method. If a lsb-rpm is available, uses it to build Uses the parent's build method. If a lsb-rpmbuild is available, uses it to
the package. build the package.
=cut =cut
@@ -105,8 +105,8 @@ sub build {
my $this=shift; my $this=shift;
my $buildcmd=shift || 'rpmbuild'; my $buildcmd=shift || 'rpmbuild';
foreach (split(/:/,$ENV{PATH})) { foreach (split(/:/,$ENV{PATH})) {
if (-x "$_/lsb-rpm") { if (-x "$_/lsb-rpmbuild") {
$buildcmd='lsb-rpm'; $buildcmd='lsb-rpmbuild';
last; last;
} }
} }

View File

@@ -83,7 +83,7 @@ sub scan {
foreach my $field (qw{NAME VERSION RELEASE ARCH CHANGELOGTEXT foreach my $field (qw{NAME VERSION RELEASE ARCH CHANGELOGTEXT
SUMMARY DESCRIPTION PREFIXES}, SUMMARY DESCRIPTION PREFIXES},
keys(%fieldtrans)) { keys(%fieldtrans)) {
my $value=$this->runpipe(0, "LANG=C rpm -qp --queryformat \%{$field} $file"); my $value=$this->runpipe(0, "LANG=C rpm -qp --queryformat \%{$field} '$file'");
next if $? || $value eq '(none)'; next if $? || $value eq '(none)';
my $key; my $key;
if (exists $fieldtrans{$field}) { if (exists $fieldtrans{$field}) {
@@ -96,16 +96,16 @@ sub scan {
} }
# Get the conffiles list. # Get the conffiles list.
$this->conffiles([map { chomp; $_ } $this->runpipe(0, "LANG=C rpm -qcp $file")]); $this->conffiles([map { chomp; $_ } $this->runpipe(0, "LANG=C rpm -qcp '$file'")]);
if (defined $this->conffiles->[0] && if (defined $this->conffiles->[0] &&
$this->conffiles->[0] eq '(contains no files)') { $this->conffiles->[0] eq '(contains no files)') {
$this->conffiles([]); $this->conffiles([]);
} }
$this->binary_info(scalar $this->runpipe(0, "rpm -qpi $file")); $this->binary_info(scalar $this->runpipe(0, "rpm -qpi '$file'"));
# Get the filelist. # Get the filelist.
$this->filelist([map { chomp; $_ } $this->runpipe(0, "LANG=C rpm -qpl $file")]); $this->filelist([map { chomp; $_ } $this->runpipe(0, "LANG=C rpm -qpl '$file'")]);
if (defined $this->filelist->[0] && if (defined $this->filelist->[0] &&
$this->filelist->[0] eq '(contains no files)') { $this->filelist->[0] eq '(contains no files)') {
$this->filelist([]); $this->filelist([]);
@@ -128,7 +128,7 @@ sub scan {
} }
unless (defined $this->copyright) { unless (defined $this->copyright) {
# Older rpms have no licence tag, but have a copyright. # Older rpms have no licence tag, but have a copyright.
$this->copyright($this->runpipe(0, "LANG=C rpm -qp --queryformat \%{COPYRIGHT} $file")); $this->copyright($this->runpipe(0, "LANG=C rpm -qp --queryformat \%{COPYRIGHT} '$file'"));
# Fallback. # Fallback.
if (! $this->copyright) { if (! $this->copyright) {
@@ -161,11 +161,11 @@ sub unpack {
# Check if we need to use lzma to uncompress the cpio archive # Check if we need to use lzma to uncompress the cpio archive
my $decomp=''; my $decomp='';
if ($this->do("rpm2cpio ".$this->filename." | lzma -t -q > /dev/null 2>&1")) { if ($this->do("rpm2cpio '".$this->filename."' | lzma -t -q > /dev/null 2>&1")) {
$decomp = 'lzma -d -q |'; $decomp = 'lzma -d -q |';
} }
$this->do("rpm2cpio ".$this->filename." | (cd $workdir; $decomp cpio --extract --make-directories --no-absolute-filenames --preserve-modification-time) 2>&1") $this->do("rpm2cpio '".$this->filename."' | (cd $workdir; $decomp cpio --extract --make-directories --no-absolute-filenames --preserve-modification-time) 2>&1")
or die "Unpacking of '".$this->filename."' failed"; or die "Unpacking of '".$this->filename."' failed";
# cpio does not necessarily store all parent directories in an # cpio does not necessarily store all parent directories in an
@@ -174,7 +174,7 @@ sub unpack {
# Find those directories and make them mode 755, which is more # Find those directories and make them mode 755, which is more
# reasonable. # reasonable.
my %seenfiles; my %seenfiles;
open (RPMLIST, "rpm2cpio ".$this->filename." | $decomp cpio -it --quiet |") open (RPMLIST, "rpm2cpio '".$this->filename."' | $decomp cpio -it --quiet |")
or die "File list of '".$this->filename."' failed"; or die "File list of '".$this->filename."' failed";
while (<RPMLIST>) { while (<RPMLIST>) {
chomp; chomp;
@@ -184,7 +184,7 @@ sub unpack {
foreach my $file (`cd $workdir; find ./`) { foreach my $file (`cd $workdir; find ./`) {
chomp $file; chomp $file;
if (! $seenfiles{$file} && -d "$workdir/$file" && ! -l "$workdir/$file") { if (! $seenfiles{$file} && -d "$workdir/$file" && ! -l "$workdir/$file") {
$this->do("chmod 755 $workdir/$file"); $this->do("chmod 755 '$workdir/$file'");
} }
} }
@@ -248,7 +248,7 @@ sub unpack {
# postinst. # postinst.
my %owninfo = (); my %owninfo = ();
my %modeinfo = (); my %modeinfo = ();
open (GETPERMS, 'rpm --queryformat \'[%{FILEMODES} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILENAMES}\n]\' -qp '.$this->filename.' |'); open (GETPERMS, 'rpm --queryformat \'[%{FILEMODES} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILENAMES}\n]\' -qp \''.$this->filename.'\' |');
while (<GETPERMS>) { while (<GETPERMS>) {
chomp; chomp;
my ($mode, $owner, $group, $file) = split(/ /, $_, 4); my ($mode, $owner, $group, $file) = split(/ /, $_, 4);
@@ -424,7 +424,7 @@ sub build {
$opts="--buildarch ".$this->arch; $opts="--buildarch ".$this->arch;
} }
else { else {
# Presumably we're delaing with rpm 3.0 or above, which # Presumably we're dealing with rpm 3.0 or above, which
# doesn't output rpmdir in any format I'd care to try to # doesn't output rpmdir in any format I'd care to try to
# parse. Instead, rpm is now of a late enough version to # parse. Instead, rpm is now of a late enough version to
# notice the %define's in the spec file, that will make the # notice the %define's in the spec file, that will make the
@@ -439,7 +439,7 @@ sub build {
$opts.=" $ENV{RPMBUILDOPT}" if exists $ENV{RPMBUILDOPT}; $opts.=" $ENV{RPMBUILDOPT}" if exists $ENV{RPMBUILDOPT};
my $pwd=`pwd`; my $pwd=`pwd`;
chomp $pwd; chomp $pwd;
my $command="cd $dir; $buildcmd --buildroot=$pwd/$dir -bb $opts ".$this->name."-".$this->version."-".$this->release.".spec"; my $command="cd $dir; $buildcmd --buildroot='$pwd/$dir' -bb $opts '".$this->name."-".$this->version."-".$this->release.".spec'";
my $log=$this->runpipe(1, "$command 2>&1"); my $log=$this->runpipe(1, "$command 2>&1");
if ($?) { if ($?) {
die "Package build failed. Here's the log of the command ($command):\n", $log; die "Package build failed. Here's the log of the command ($command):\n", $log;
@@ -607,9 +607,16 @@ sub arch {
# Treat armv4l as arm. # Treat armv4l as arm.
$arch='arm'; $arch='arm';
} }
elsif ($arch eq 'armv7l') {
# Treat armv7l as armel.
$arch='armel';
}
elsif ($arch eq 'parisc') { elsif ($arch eq 'parisc') {
$arch='hppa'; $arch='hppa';
} }
elsif ($arch eq 'ppc64le') {
$arch='ppc64el';
}
$this->{arch}=$arch; $this->{arch}=$arch;
} }
@@ -629,6 +636,9 @@ sub arch {
elsif ($arch eq 'all') { elsif ($arch eq 'all') {
$arch='noarch'; $arch='noarch';
} }
elsif ($arch eq 'ppc64el') {
$arch='ppc64le';
}
return $arch return $arch
} }

View File

@@ -166,7 +166,7 @@ sub scan {
# Read in the file list. # Read in the file list.
my @filelist; my @filelist;
# FIXME: support gzip files too! # FIXME: support gzip files too!
foreach ($this->runpipe(0, "bzip2 -d < $file | tar -tf -")) { foreach ($this->runpipe(0, "bzip2 -d < '$file' | tar -tf -")) {
chomp; chomp;
s:^\./:/:; s:^\./:/:;
$_="/$_" unless m:^/:; $_="/$_" unless m:^/:;
@@ -179,7 +179,7 @@ sub scan {
$this->distribution('Stampede'); $this->distribution('Stampede');
$this->origformat('slp'); $this->origformat('slp');
$this->changelogtext(''); $this->changelogtext('');
$this->binary_info($this->runpipe(0, "ls -l $file")); $this->binary_info($this->runpipe(0, "ls -l '$file'"));
return 1; return 1;
} }

View File

@@ -118,7 +118,7 @@ sub scan {
$this->group("unknown"); $this->group("unknown");
$this->origformat('tgz'); $this->origformat('tgz');
$this->changelogtext(''); $this->changelogtext('');
$this->binary_info($this->runpipe(0, "ls -l $file")); $this->binary_info($this->runpipe(0, "ls -l '$file'"));
# Now figure out the conffiles. Assume anything in etc/ is a # Now figure out the conffiles. Assume anything in etc/ is a
# conffile. # conffile.
@@ -152,7 +152,7 @@ sub scan {
# Now get the scripts. # Now get the scripts.
foreach my $script (keys %{scripttrans()}) { foreach my $script (keys %{scripttrans()}) {
$this->$script(scalar $this->runpipe(1, "tar Oxf $file install/${scripttrans()}{$script} 2>/dev/null")); $this->$script(scalar $this->runpipe(1, "tar Oxf '$file' install/${scripttrans()}{$script} 2>/dev/null"));
} }
return 1; return 1;

14
alien.lsm Normal file
View File

@@ -0,0 +1,14 @@
Begin3
Title: alien
Version: 8.92
Entered-date: 31MAR97
Description: Alien converts Slackware .tgz packages, Red Hat .rpm packages,
Debian .deb packages, and Stampede .slp packages. It can
convert from any of the formats to any other format. It works
only on binary packages. It also support LSB packages.
Keywords: debian dpkg deb red hat redhat rpm slackware tgz stampede slp convert package LSB
Author: joey@kitenet.net
Primary-site: sunsite.unc.edu /pub/Linux/utils/package
80 alien-8.92.tar.gz
Copying-policy: GPL
End

View File

@@ -193,6 +193,10 @@ some things to mess with their permissions and owners to the degree this does,
so it defaults to off. This can only be used when converting to debian so it defaults to off. This can only be used when converting to debian
packages. packages.
=item B<--target=>I<architecture>
Force the architecture of the generated package to the given string.
=item B<-v>, B<--verbose> =item B<-v>, B<--verbose>
Be verbose: Display each command B<alien> runs in the process of converting a Be verbose: Display each command B<alien> runs in the process of converting a
@@ -246,7 +250,7 @@ B<alien> recognizes the following environment variables:
=over 4 =over 4
=item RPMBUILDOPTS =item RPMBUILDOPT
Options to pass to rpm when it is building a package. Options to pass to rpm when it is building a package.
@@ -330,6 +334,7 @@ Usage: alien [options] file [...]
-i, --install Install generated package. -i, --install Install generated package.
-g, --generate Generate build tree, but do not build package. -g, --generate Generate build tree, but do not build package.
-c, --scripts Include scripts in package. -c, --scripts Include scripts in package.
--target=<arch> Set architecture of the generated package.
-v, --verbose Display each command alien runs. -v, --verbose Display each command alien runs.
--veryverbose Be verbose, and also display output of run commands. --veryverbose Be verbose, and also display output of run commands.
-k, --keep-version Do not change version of generated package. -k, --keep-version Do not change version of generated package.
@@ -344,7 +349,7 @@ EOF
# Start by processing the parameters. # Start by processing the parameters.
my (%destformats, $generate, $install, $single, $scripts, $patchfile, my (%destformats, $generate, $install, $single, $scripts, $patchfile,
$nopatch, $tgzdescription, $tgzversion, $keepversion, $fixperms, $nopatch, $tgzdescription, $tgzversion, $keepversion, $fixperms,
$test, $anypatch); $test, $anypatch, $target);
my $versionbump=1; my $versionbump=1;
# Bundling is nice anyway, and it is required or Getopt::Long will confuse # Bundling is nice anyway, and it is required or Getopt::Long will confuse
@@ -366,6 +371,7 @@ GetOptions(
"patch=s" => \$patchfile, "patch=s" => \$patchfile,
"nopatch" => \$nopatch, "nopatch" => \$nopatch,
"anypatch" => \$anypatch, "anypatch" => \$anypatch,
"target=s" => \$target,
"description=s" => \$tgzdescription, "description=s" => \$tgzdescription,
"V" => \&version, "V" => \&version,
"version:s" => sub { length $_[1] ? $tgzversion=$_[1] : version() }, "version:s" => sub { length $_[1] ? $tgzversion=$_[1] : version() },
@@ -446,6 +452,10 @@ foreach my $file (@ARGV) {
die "Unknown type of package, $file.\n"; die "Unknown type of package, $file.\n";
} }
if ($target) {
$package->arch($target);
}
if (! $package->usescripts && $package->scripts) { if (! $package->usescripts && $package->scripts) {
$package->usescripts($scripts); $package->usescripts($scripts);
if (! $scripts) { if (! $scripts) {

34
alien.spec Normal file
View File

@@ -0,0 +1,34 @@
Summary: Install Debian, Slackware, and Stampede packages with rpm.
Name: alien
Packager: Joey Hess <joey@kitenet.net>
Version: 8.92
Release: 1
Source: ftp://kitenet.net/pub/code/debian/alien_8.92.tar.gz
License: GPL
Group: Utilities/File
Buildroot: /tmp/alien-8.92.build
Requires: perl
BuildArchitectures: noarch
%description
Alien allows you to convert Debian, Slackware, and Stampede Packages into Red
Hat packages, which can be installed with rpm.
It can also generate Slackware, Debian and Stampede packages.
This is a tool only suitable for binary packages.
%prep
%setup -n alien
rm -rf /tmp/alien-8.92.build
%install
perl Makefile.PL PREFIX=$RPM_BUILD_ROOT/usr
make
make pure_install VARPREFIX=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -not -type d -printf "/%%P\n" | \
sed '/\/man\//s/$/\*/' > manifest
%files -f manifest
%defattr(-,root,root)
%doc debian/changelog GPL README alien.lsm

84
debian/changelog vendored
View File

@@ -1,3 +1,87 @@
alien (8.92) unstable; urgency=medium
* Remove suggests for lsb-rpm, which no longer exists.
Closes: #756873
-- Joey Hess <joeyh@debian.org> Sun, 31 Aug 2014 14:16:23 -0700
alien (8.91) unstable; urgency=medium
* Support other deb data.tar compression schemes in fallback code.
Closes: #718364
Thanks, Guillem Jover
-- Joey Hess <joeyh@debian.org> Fri, 13 Jun 2014 12:03:54 -0400
alien (8.90) unstable; urgency=medium
* Add --target=<arch> option for setting architecture. Closes: #260948
(Thanks, Teemu Ikonen)
* Add conversion from ppc64le (rpm) to ppc64el (deb).
* debhelper v9
-- Joey Hess <joeyh@debian.org> Thu, 27 Feb 2014 11:59:07 -0400
alien (8.89) unstable; urgency=low
* Correct man page to say RPMBUILDOPT (not RPMBUILDOPTS). Closes: #701106
* Handle whitespace in path to RPMs. Closes: #719776
(Thanks, Christopher Huhn)
-- Joey Hess <joeyh@debian.org> Thu, 22 Aug 2013 21:53:44 -0400
alien (8.88) unstable; urgency=low
* Ensure that version numbers begin with well, a number, when building a
deb, otherwise dpkg-deb will refuse to build it.
-- Joey Hess <joeyh@debian.org> Thu, 09 Aug 2012 14:44:49 -0400
alien (8.87) unstable; urgency=low
* Use lsb-rpmbuild, not lsb-rpm. Closes: #667044
* Fix adding of postinst script to deb, containing rpm permissions
fixups code. Closes: #667651
-- Joey Hess <joeyh@debian.org> Thu, 05 Apr 2012 13:53:29 -0400
alien (8.86) unstable; urgency=low
* Filter out illegal characters in version number when building a deb.
Closes: #648531
-- Joey Hess <joeyh@debian.org> Sat, 12 Nov 2011 13:12:35 -0400
alien (8.85) unstable; urgency=low
* Avoid breaking on spaces in filenames. Closes: #618636
-- Joey Hess <joeyh@debian.org> Sun, 19 Jun 2011 15:43:49 -0400
alien (8.84) unstable; urgency=low
* Silence error message when deleting build tree after making an rpm,
if rpmbuild has already deleted it. Closes: #622846
* Squash an uninitialized value when creating a deb.
-- Joey Hess <joeyh@debian.org> Fri, 15 Apr 2011 14:13:20 -0400
alien (8.83) unstable; urgency=low
* Correct handling of arch all packages in deb arch check. Closes: #596209
-- Joey Hess <joeyh@debian.org> Thu, 09 Sep 2010 08:24:58 -0400
alien (8.82) unstable; urgency=low
* Use debhelper compat level v7 when building packages. All changes
since v4 seem safe for alien's generated rules files.
* Use dh_prep instead of deprecated dh_clean -k.
* Print a nice error message when attempting to build a deb from a package
of an unsupported architecture. Closes: #592625
-- Joey Hess <joeyh@debian.org> Mon, 30 Aug 2010 17:04:24 -0400
alien (8.81) unstable; urgency=low alien (8.81) unstable; urgency=low
* Avoid uninitialized value warning when debian/rules fails to run * Avoid uninitialized value warning when debian/rules fails to run

2
debian/compat vendored
View File

@@ -1 +1 @@
7 9

8
debian/control vendored
View File

@@ -1,17 +1,17 @@
Source: alien Source: alien
Section: admin Section: admin
Priority: optional Priority: optional
Build-Depends: debhelper (>= 7.0.50) Build-Depends: debhelper (>= 9)
Maintainer: Joey Hess <joeyh@debian.org> Maintainer: Joey Hess <joeyh@debian.org>
Standards-Version: 3.8.4 Standards-Version: 3.9.5
Vcs-Git: git://git.kitenet.net/alien Vcs-Git: git://git.kitenet.net/alien
Homepage: http://kitenet.net/~joey/code/alien/ Homepage: http://kitenet.net/~joey/code/alien/
Package: alien Package: alien
Architecture: all Architecture: all
Section: admin Section: admin
Depends: debhelper (>= 3), ${misc:Depends}, ${perl:Depends}, rpm (>= 2.4.4-2), dpkg-dev, make, cpio, rpm2cpio Depends: debhelper (>= 7), ${misc:Depends}, ${perl:Depends}, rpm (>= 2.4.4-2), dpkg-dev, make, cpio, rpm2cpio
Suggests: patch, bzip2, lsb-rpm, lintian, lzma Suggests: patch, bzip2, lintian, lzma
Description: convert and install rpm and other packages Description: convert and install rpm and other packages
Alien allows you to convert LSB, Red Hat, Stampede and Slackware Packages Alien allows you to convert LSB, Red Hat, Stampede and Slackware Packages
into Debian packages, which can be installed with dpkg. into Debian packages, which can be installed with dpkg.

44
debian/copyright vendored
View File

@@ -1,35 +1,13 @@
This is a program originally written by Christoph Lameter Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
<clameter@debian.org>. Source: native package
Deb to rpm conversion code was taken from the Martian program by Files: *
Randolph Chung <randolph@tausq.org>. Copyright:
1996, 1997 Christoph Lameter
The Solaris pkg code was written by Mark A. Hershberger 1997 Randolph Chung
<mah@everybody.org>. 2001 Mark A. Hershberger
1997-2011 Joey Hess
This program is now maintained by Joey Hess <joeyh@debian.org>. License: GPL-2+
On Debian systems, the complete text of the GPL can be found in
Copyright 1996, 1997 Christoph Lameter /usr/share/common-licenses/GPL.
Portions copyright 1997 Randolph Chung
Portions copyright 2001 Mark A. Hershberger
Copyright 1997-2007 Joey Hess
License:
alien is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
On Debian systems, the complete text of the GPL can be found in
/usr/share/common-licenses/GPL.