mirror of
https://github.com/Project-OSS-Revival/alien.git
synced 2026-04-25 14:00:17 +00:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22709da70e | ||
|
|
06ae0587ac | ||
|
|
c1b64b0c48 | ||
|
|
93ad8ae367 | ||
|
|
d3750a8156 | ||
|
|
7a1afcfb97 | ||
|
|
2999238f34 | ||
|
|
887717f304 | ||
|
|
9cb511802b | ||
|
|
6f5a303f3b | ||
|
|
92933477e6 | ||
|
|
53751ccbbf | ||
|
|
41fc0d549f | ||
|
|
b1bd50cc90 | ||
|
|
dd38b4e86d | ||
|
|
7aee419bd2 | ||
|
|
db4ea6fa4a | ||
|
|
f545de15f5 | ||
|
|
2fb28d27d2 | ||
|
|
363deec1c6 | ||
|
|
b69f536367 | ||
|
|
f717997da1 | ||
|
|
3faa48b23f |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
alien.lsm
|
||||
alien.spec
|
||||
@@ -9,6 +9,7 @@ Alien::Package::Deb - an object that represents a deb package
|
||||
package Alien::Package::Deb;
|
||||
use strict;
|
||||
use base qw(Alien::Package);
|
||||
use List::Util qw(first);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@@ -23,6 +24,10 @@ Alien::Package.
|
||||
|
||||
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
|
||||
|
||||
After the build stage, set to a hash reference of the directories we moved
|
||||
@@ -117,6 +122,26 @@ sub test {
|
||||
}
|
||||
}
|
||||
|
||||
=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
|
||||
|
||||
Helper method. Pass it the name of a control file, and it will pull it out
|
||||
@@ -142,11 +167,58 @@ sub getcontrolfile {
|
||||
" tar xf - './$file' &&".
|
||||
" 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);
|
||||
}
|
||||
}
|
||||
|
||||
=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
|
||||
|
||||
Implement the scan method to read a deb file.
|
||||
@@ -209,15 +281,15 @@ sub scan {
|
||||
|
||||
# Read in the list of all files.
|
||||
# Note that tar doesn't supply a leading '/', so we have to add that.
|
||||
my @filelist;
|
||||
my $datamember_cmd;
|
||||
if ($this->have_dpkg_deb) {
|
||||
@filelist=map { chomp; s:\./::; "/$_" }
|
||||
$this->runpipe(0, "dpkg-deb --fsys-tarfile '$file' | tar tf -");
|
||||
$datamember_cmd = "dpkg-deb --fsys-tarfile '$file'";
|
||||
}
|
||||
else {
|
||||
@filelist=map { chomp; s:\./::; "/$_" }
|
||||
$this->runpipe(0, "ar -p '$file' data.tar.gz | gzip -dc | tar tf -");
|
||||
$datamember_cmd = $this->get_datamember_cmd($file);
|
||||
}
|
||||
my @filelist=map { chomp; s:\./::; "/$_" }
|
||||
$this->runpipe(0, "$datamember_cmd | tar tf -");
|
||||
$this->filelist(\@filelist);
|
||||
|
||||
# Read in the scripts, if any.
|
||||
@@ -244,7 +316,9 @@ sub unpack {
|
||||
or die "Unpacking of '$file' failed: $!";
|
||||
}
|
||||
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: $!";
|
||||
}
|
||||
|
||||
@@ -443,18 +517,16 @@ EOF
|
||||
close OUT;
|
||||
$this->do("chmod", 755, "$dir/debian/rules");
|
||||
|
||||
# Save any scripts.
|
||||
if ($this->usescripts) {
|
||||
foreach my $script (qw{postinst postrm preinst prerm}) {
|
||||
my $data=$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;
|
||||
$this->savescript($script, $this->$script());
|
||||
}
|
||||
}
|
||||
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!
|
||||
# Move files to FHS-compliant locations, if possible.
|
||||
@@ -596,14 +668,13 @@ sub version {
|
||||
# get
|
||||
return unless defined wantarray; # optimization
|
||||
$_=$this->{version};
|
||||
# Make sure the version contains a digit at the start, as required
|
||||
# by dpkg-deb.
|
||||
unless (/^[0-9]/) {
|
||||
$_="0".$_;
|
||||
}
|
||||
# filter out some characters not allowed in debian versions
|
||||
s/[^-.+~:A-Za-z0-9]//g; # see lib/dpkg/parsehelp.c parseversion
|
||||
# Make sure the version contains digets.
|
||||
unless (/[0-9]/) {
|
||||
# Drat. Well, add some. dpkg-deb won't work
|
||||
# on a version w/o numbers!
|
||||
return $_."0";
|
||||
}
|
||||
return $_;
|
||||
}
|
||||
|
||||
@@ -729,30 +800,50 @@ sub username {
|
||||
return $username;
|
||||
}
|
||||
|
||||
=item postinst
|
||||
=item savescript
|
||||
|
||||
Returns the postinst. This may include generated shell code to set owners
|
||||
and groups from the owninfo field, and update modes from the modeinfo field.
|
||||
Saves script to debian directory.
|
||||
|
||||
=cut
|
||||
|
||||
sub postinst {
|
||||
sub savescript {
|
||||
my $this=shift;
|
||||
my $script=shift;
|
||||
my $data=shift;
|
||||
|
||||
if (@_) {
|
||||
$this->{postinst}=shift;
|
||||
if ($script eq 'postinst') {
|
||||
$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 $modeinfo = $this->modeinfo;
|
||||
my $postinst = $this->{postinst};
|
||||
return $postinst unless ref $owninfo;
|
||||
return $postinst unless ref $owninfo && %$owninfo;
|
||||
|
||||
# If there is no postinst, let's make one up..
|
||||
$postinst="#!/bin/sh\n" unless defined $postinst && length $postinst;
|
||||
|
||||
return $postinst unless %$owninfo;
|
||||
|
||||
my ($firstline, $rest)=split(/\n/, $postinst, 2);
|
||||
if ($firstline !~ m/^#!\s*\/bin\/(ba)?sh/) {
|
||||
print STDERR "warning: unable to add ownership fixup code to postinst as the postinst is not a shell script!\n";
|
||||
|
||||
@@ -96,8 +96,8 @@ sub revert {
|
||||
|
||||
=item build
|
||||
|
||||
Uses the parent's build method. If a lsb-rpm is available, uses it to build
|
||||
the package.
|
||||
Uses the parent's build method. If a lsb-rpmbuild is available, uses it to
|
||||
build the package.
|
||||
|
||||
=cut
|
||||
|
||||
@@ -105,8 +105,8 @@ sub build {
|
||||
my $this=shift;
|
||||
my $buildcmd=shift || 'rpmbuild';
|
||||
foreach (split(/:/,$ENV{PATH})) {
|
||||
if (-x "$_/lsb-rpm") {
|
||||
$buildcmd='lsb-rpm';
|
||||
if (-x "$_/lsb-rpmbuild") {
|
||||
$buildcmd='lsb-rpmbuild';
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,11 +161,11 @@ sub unpack {
|
||||
|
||||
# Check if we need to use lzma to uncompress the cpio archive
|
||||
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 |';
|
||||
}
|
||||
|
||||
$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";
|
||||
|
||||
# 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
|
||||
# reasonable.
|
||||
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";
|
||||
while (<RPMLIST>) {
|
||||
chomp;
|
||||
@@ -184,7 +184,7 @@ sub unpack {
|
||||
foreach my $file (`cd $workdir; find ./`) {
|
||||
chomp $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.
|
||||
my %owninfo = ();
|
||||
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>) {
|
||||
chomp;
|
||||
my ($mode, $owner, $group, $file) = split(/ /, $_, 4);
|
||||
@@ -607,9 +607,16 @@ sub arch {
|
||||
# Treat armv4l as arm.
|
||||
$arch='arm';
|
||||
}
|
||||
elsif ($arch eq 'armv7l') {
|
||||
# Treat armv7l as armel.
|
||||
$arch='armel';
|
||||
}
|
||||
elsif ($arch eq 'parisc') {
|
||||
$arch='hppa';
|
||||
}
|
||||
elsif ($arch eq 'ppc64le') {
|
||||
$arch='ppc64el';
|
||||
}
|
||||
|
||||
$this->{arch}=$arch;
|
||||
}
|
||||
@@ -629,6 +636,9 @@ sub arch {
|
||||
elsif ($arch eq 'all') {
|
||||
$arch='noarch';
|
||||
}
|
||||
elsif ($arch eq 'ppc64el') {
|
||||
$arch='ppc64le';
|
||||
}
|
||||
|
||||
return $arch
|
||||
}
|
||||
|
||||
14
alien.lsm
Normal file
14
alien.lsm
Normal file
@@ -0,0 +1,14 @@
|
||||
Begin3
|
||||
Title: alien
|
||||
Version: 8.91
|
||||
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.91.tar.gz
|
||||
Copying-policy: GPL
|
||||
End
|
||||
14
alien.pl
14
alien.pl
@@ -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
|
||||
packages.
|
||||
|
||||
=item B<--target=>I<architecture>
|
||||
|
||||
Force the architecture of the generated package to the given string.
|
||||
|
||||
=item B<-v>, B<--verbose>
|
||||
|
||||
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
|
||||
|
||||
=item RPMBUILDOPTS
|
||||
=item RPMBUILDOPT
|
||||
|
||||
Options to pass to rpm when it is building a package.
|
||||
|
||||
@@ -330,6 +334,7 @@ Usage: alien [options] file [...]
|
||||
-i, --install Install generated package.
|
||||
-g, --generate Generate build tree, but do not build package.
|
||||
-c, --scripts Include scripts in package.
|
||||
--target=<arch> Set architecture of the generated package.
|
||||
-v, --verbose Display each command alien runs.
|
||||
--veryverbose Be verbose, and also display output of run commands.
|
||||
-k, --keep-version Do not change version of generated package.
|
||||
@@ -344,7 +349,7 @@ EOF
|
||||
# Start by processing the parameters.
|
||||
my (%destformats, $generate, $install, $single, $scripts, $patchfile,
|
||||
$nopatch, $tgzdescription, $tgzversion, $keepversion, $fixperms,
|
||||
$test, $anypatch);
|
||||
$test, $anypatch, $target);
|
||||
my $versionbump=1;
|
||||
|
||||
# Bundling is nice anyway, and it is required or Getopt::Long will confuse
|
||||
@@ -366,6 +371,7 @@ GetOptions(
|
||||
"patch=s" => \$patchfile,
|
||||
"nopatch" => \$nopatch,
|
||||
"anypatch" => \$anypatch,
|
||||
"target=s" => \$target,
|
||||
"description=s" => \$tgzdescription,
|
||||
"V" => \&version,
|
||||
"version:s" => sub { length $_[1] ? $tgzversion=$_[1] : version() },
|
||||
@@ -446,6 +452,10 @@ foreach my $file (@ARGV) {
|
||||
die "Unknown type of package, $file.\n";
|
||||
}
|
||||
|
||||
if ($target) {
|
||||
$package->arch($target);
|
||||
}
|
||||
|
||||
if (! $package->usescripts && $package->scripts) {
|
||||
$package->usescripts($scripts);
|
||||
if (! $scripts) {
|
||||
|
||||
34
alien.spec
Normal file
34
alien.spec
Normal file
@@ -0,0 +1,34 @@
|
||||
Summary: Install Debian, Slackware, and Stampede packages with rpm.
|
||||
Name: alien
|
||||
Packager: Joey Hess <joey@kitenet.net>
|
||||
Version: 8.91
|
||||
Release: 1
|
||||
Source: ftp://kitenet.net/pub/code/debian/alien_8.91.tar.gz
|
||||
License: GPL
|
||||
Group: Utilities/File
|
||||
Buildroot: /tmp/alien-8.91.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.91.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
|
||||
40
debian/changelog
vendored
40
debian/changelog
vendored
@@ -1,3 +1,43 @@
|
||||
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.
|
||||
|
||||
2
debian/compat
vendored
2
debian/compat
vendored
@@ -1 +1 @@
|
||||
7
|
||||
9
|
||||
|
||||
4
debian/control
vendored
4
debian/control
vendored
@@ -1,9 +1,9 @@
|
||||
Source: alien
|
||||
Section: admin
|
||||
Priority: optional
|
||||
Build-Depends: debhelper (>= 7.0.50)
|
||||
Build-Depends: debhelper (>= 9)
|
||||
Maintainer: Joey Hess <joeyh@debian.org>
|
||||
Standards-Version: 3.9.2
|
||||
Standards-Version: 3.9.5
|
||||
Vcs-Git: git://git.kitenet.net/alien
|
||||
Homepage: http://kitenet.net/~joey/code/alien/
|
||||
|
||||
|
||||
2
debian/copyright
vendored
2
debian/copyright
vendored
@@ -1,4 +1,4 @@
|
||||
Format: http://dep.debian.net/deps/dep5/
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Source: native package
|
||||
|
||||
Files: *
|
||||
|
||||
Reference in New Issue
Block a user