mirror of
https://github.com/Project-OSS-Revival/alien.git
synced 2026-04-24 14:00:17 +00:00
The rewrite can convert from rpm to deb -- this is getting exciting!
This commit is contained in:
@@ -79,10 +79,19 @@ A longer description of the package. May contain multiple paragraphs.
|
||||
|
||||
A short statement of copyright.
|
||||
|
||||
=item origformat
|
||||
|
||||
What format the package was originally in.
|
||||
|
||||
=item distribution
|
||||
|
||||
What distribution family the package originated from.
|
||||
|
||||
=item binary_info
|
||||
|
||||
Whatever the package's package tool says when told to display info about
|
||||
the package.
|
||||
|
||||
=item conffiles
|
||||
|
||||
A reference to a list of all the conffiles in the package.
|
||||
@@ -91,6 +100,10 @@ A reference to a list of all the conffiles in the package.
|
||||
|
||||
A reference to a list of all the files in the package.
|
||||
|
||||
=item changelogtext
|
||||
|
||||
The text of the changelog
|
||||
|
||||
=item postinst
|
||||
|
||||
The postinst script of the package.
|
||||
@@ -195,6 +208,19 @@ sub unpack {
|
||||
$this->unpacked_tree($workdir);
|
||||
}
|
||||
|
||||
=item prep
|
||||
|
||||
This method causes the object to prepare a build tree to be used in
|
||||
building the object. It expects that the unpack method has already been
|
||||
called. It takes the tree generated by that method, and mangles it somehow,
|
||||
to produce a suitable build tree.
|
||||
|
||||
(This is just a stub method that all child classes should override.)
|
||||
|
||||
=cut
|
||||
|
||||
sub prep {}
|
||||
|
||||
=item DESTROY
|
||||
|
||||
When an object is destroyed, it cleans some stuff up. In particular, if the
|
||||
|
||||
@@ -122,6 +122,8 @@ sub read_file {
|
||||
$this->copyright("see /usr/share/doc/".$this->name."/copyright");
|
||||
$this->group("unknown") if ! $this->group;
|
||||
$this->distribution("Debian");
|
||||
$this->origformat("deb");
|
||||
$this->binary_info(scalar `dpkg --info $file`);
|
||||
|
||||
# Read in the list of conffiles, if any.
|
||||
my @conffiles;
|
||||
@@ -151,10 +153,10 @@ sub read_file {
|
||||
# Read in the scripts, if any.
|
||||
foreach my $field (qw{postinst postrm preinst prerm}) {
|
||||
if ($this->have_dpkg_deb) {
|
||||
$this->$field(`dpkg-deb --info $file $field 2>/dev/null`);
|
||||
$this->$field(scalar `dpkg-deb --info $file $field 2>/dev/null`);
|
||||
}
|
||||
else {
|
||||
$this->$field(`ar p $file control.tar.gz | tar Oxzf - $field 2>/dev/null`);
|
||||
$this->$field(scalar `ar p $file control.tar.gz | tar Oxzf - $field 2>/dev/null`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,6 +186,142 @@ sub unpack {
|
||||
return 1;
|
||||
}
|
||||
|
||||
=item prep
|
||||
|
||||
Adds a populated debian directory the unpacked package tree, making it
|
||||
ready for building. This can either be done automatically, or via a patch
|
||||
file.
|
||||
|
||||
=cut
|
||||
|
||||
sub prep {
|
||||
my $this=shift;
|
||||
my $dir=$this->unpacked_tree;
|
||||
|
||||
mkdir "$dir/debian", 0755 ||
|
||||
die "mkdir $dir/debian failed: $!";
|
||||
|
||||
# Use a patch file to debianize?
|
||||
if (defined $this->patchfile) {
|
||||
# The -f passed to zcat makes it pass uncompressed files
|
||||
# through without error.
|
||||
system("zcat -f ".$this->patchfile." | (cd $dir; patch -p1)") ||
|
||||
die "patch error: $!";
|
||||
# Look for .rej files.
|
||||
die "patch failed with .rej files; giving up"
|
||||
if `find $dir -name "*.rej"`;
|
||||
system('find . -name \'*.orig\' -exec rm {} \\;');
|
||||
chmod 0755,"$dir/debian/rules";
|
||||
return;
|
||||
}
|
||||
|
||||
# Automatic debianization.
|
||||
# Changelog file.
|
||||
open (OUT, ">$dir/debian/changelog") || die "$dir/debian/changelog: $!";
|
||||
print OUT $this->name." (".$this->version."-".$this->release.") experimental; urgency=low\n";
|
||||
print OUT "\n";
|
||||
print OUT " * Converted from .".$this->origformat." format to .deb\n";
|
||||
print OUT "\n";
|
||||
print OUT " -- ".$this->username." <".$this->email."> ".$this->date."\n";
|
||||
print OUT "\n";
|
||||
print OUT $this->changelogtext."\n";
|
||||
close OUT;
|
||||
|
||||
# Control file.
|
||||
open (OUT, ">$dir/debian/control") || die "$dir/debian/control: $!";
|
||||
print OUT "Source: ".$this->name."\n";
|
||||
print OUT "Section: alien\n";
|
||||
print OUT "Priority: extra\n";
|
||||
print OUT "Maintainer: ".$this->username." <".$this->email.">\n";
|
||||
print OUT "\n";
|
||||
print OUT "Package: ".$this->name."\n";
|
||||
print OUT "Architecture: ".$this->arch."\n";
|
||||
print OUT "Depends: \${shlibs:Depends}\n";
|
||||
print OUT "Description: ".$this->summary."\n";
|
||||
print OUT $this->description."\n";
|
||||
print OUT ".\n"
|
||||
print OUT " (Converted from a .".$this->origformat." package by alien.)\n";
|
||||
close OUT;
|
||||
|
||||
# Copyright file.
|
||||
open (OUT, ">$dir/debian/copyright") || die "$dir/debian/copyright: $!";
|
||||
print OUT "This package was debianized by the alien program by converting\n";
|
||||
print OUT "a binary .".$this->origformat." package on ".$this->date."\n";
|
||||
print OUT "\n";
|
||||
print OUT "Copyright: ".$this->copyright."\n";
|
||||
print OUT "\n";
|
||||
print OUT "Information from the binary package:\n";
|
||||
print OUT $this->binary_info."\n";
|
||||
close OUT;
|
||||
|
||||
# Conffiles, if any.
|
||||
my @conffiles=@{$this->conffiles};
|
||||
if (@conffiles) {
|
||||
open (OUT, ">$dir/debian/conffiles") || die "$dir/debian/conffiles: $!";
|
||||
print OUT join("\n", @conffiles)."\n";
|
||||
close OUT;
|
||||
}
|
||||
|
||||
# A minimal rules file.
|
||||
open (OUT, ">$dir/debian/rules") || die "$dir/debian/rules: $!";
|
||||
print OUT <<EOF;
|
||||
#!/usr/bin/make -f
|
||||
# debian/rules for alien
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
build:
|
||||
dh_testdir
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean
|
||||
|
||||
binary-indep: build
|
||||
|
||||
binary-arch: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
cp -a `ls |grep -v debian` debian/tmp
|
||||
#
|
||||
# If you need to move files around in debian/tmp or do some
|
||||
# binary patching ... Insert it here
|
||||
#
|
||||
dh_installdocs
|
||||
dh_installchangelogs
|
||||
# dh_strip
|
||||
dh_compress
|
||||
# dh_fixperms
|
||||
dh_suidregister
|
||||
dh_installdeb
|
||||
-dh_shlibdeps
|
||||
dh_gencontrol
|
||||
dh_makeshlibs
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary
|
||||
EOF
|
||||
close OUT;
|
||||
chmod 0755,"$dir/debian/rules";
|
||||
|
||||
# Save any scripts.
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
=item package
|
||||
|
||||
Set/get package name.
|
||||
@@ -302,6 +440,69 @@ sub description {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
=item date
|
||||
|
||||
Returns the date, in rfc822 format.
|
||||
|
||||
=cut
|
||||
|
||||
sub date {
|
||||
my $this=shift;
|
||||
|
||||
my $date=`822-date`;
|
||||
chomp $date;
|
||||
if (!$date) {
|
||||
die "822-date did not return a valid result. You probably need to install the dpkg-dev debian package";
|
||||
}
|
||||
|
||||
return $date;
|
||||
}
|
||||
|
||||
=item email
|
||||
|
||||
Returns an email address for the current user.
|
||||
|
||||
=cut
|
||||
|
||||
sub email {
|
||||
my $this=shift;
|
||||
|
||||
return $ENV{EMAIL} if exists $ENV{EMAIL};
|
||||
|
||||
my $login = getlogin || (getpwuid($<))[0] || $ENV{USER};
|
||||
open (MAILNAME,"</etc/mailname");
|
||||
my $mailname=<MAILNAME>;
|
||||
chomp $mailname;
|
||||
close MAILNAME;
|
||||
if (!$mailname) {
|
||||
$mailname=`hostname -f`;
|
||||
chomp $mailname;
|
||||
}
|
||||
return "$login\@$mailname";
|
||||
}
|
||||
|
||||
=item username
|
||||
|
||||
Returns the user name of the real uid.
|
||||
|
||||
=cut
|
||||
|
||||
sub username {
|
||||
my $this=shift;
|
||||
|
||||
my $username;
|
||||
my $login = getlogin || (getpwuid($<))[0] || $ENV{USER};
|
||||
(undef, undef, undef, undef, undef, undef, $username) = getpwnam($login);
|
||||
|
||||
# Remove GECOS fields from username.
|
||||
$username=~s/,.*//g;
|
||||
|
||||
# The ultimate fallback.
|
||||
if (!$username) {
|
||||
$username=$login;
|
||||
}
|
||||
}
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Joey Hess <joey@kitenet.net>
|
||||
|
||||
@@ -24,10 +24,6 @@ Alien::Package.
|
||||
|
||||
Relocatable rpm packages have a prefixes field.
|
||||
|
||||
=item changelogtext
|
||||
|
||||
The text of the changelog
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=over 4
|
||||
@@ -80,7 +76,7 @@ sub read_file {
|
||||
# Get the conffiles list.
|
||||
$this->conffiles([map { chomp; $_ } `rpm -qcp $file`]);
|
||||
|
||||
$this->copyright_extra(scalar `rpm -qpi $file`);
|
||||
$this->binary_info(scalar `rpm -qpi $file`);
|
||||
|
||||
# Get the filelist.
|
||||
$this->filelist([map { chomp; $_ } `rpm -qpl $file`]);
|
||||
@@ -109,6 +105,7 @@ sub read_file {
|
||||
}
|
||||
|
||||
$this->distribution("Red Hat");
|
||||
$this->origformat("rpm");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
2
Makefile
2
Makefile
@@ -44,7 +44,7 @@ rpm: version
|
||||
rm -f /home/joey/src/redhat/SOURCES/alien_$(VER).tar.gz
|
||||
mv /home/joey/src/redhat/SRPMS/* /home/ftp/pub/code/SRPMS
|
||||
mv /home/joey/src/redhat/RPMS/noarch/* /home/ftp/pub/code/RPMS/noarch
|
||||
fakroot rm -rf /home/joey/src/redhat/SOURCES \
|
||||
fakeroot rm -rf /home/joey/src/redhat/SOURCES \
|
||||
/home/joey/src/redhat/BUILD \
|
||||
/home/joey/src/redhat/SRPMS \
|
||||
/home/joey/src/redhat/RPMS/
|
||||
|
||||
90
README
90
README
@@ -1,43 +1,71 @@
|
||||
Alien is a program that converts rpm, dpkg, or slackware tgz packages into
|
||||
rpm or dpkg packages. If you're using Debian or Red Hat and you want to
|
||||
install a package from one of the other distributions, you can use alien to
|
||||
convert it to your preferred package format and install it.
|
||||
The Alien package converter:
|
||||
|
||||
Despite the high version number, alien is still (and will probably always
|
||||
be) rather experimental software. It has been used and tested by Debian
|
||||
users for many months, but there are still many limitations. For one thing,
|
||||
Alien only handles binary packages, not source packages. It also doesn't try
|
||||
to convert the scripts that should be run when the package installs.
|
||||
Alien is a program that converts between redhat rpm, debian dpkg, stampede
|
||||
slp and slackware tgz file formats. If you want to use a package from
|
||||
another linux distribution than the one you have installed on your system,
|
||||
you can use alien to convert it to your preferred package format and
|
||||
install it.
|
||||
|
||||
Alien should not be used to replace important system packages, like sysvinit,
|
||||
shared libraries, or other things that are essential for the functioning of
|
||||
your system. Many of these packages are set up differently by Debian and
|
||||
Red Hat, and packages from the different distributions cannot be used
|
||||
interchangably. In general, if you can't uninstall the package without
|
||||
breaking your system, don't try to replace it with an alien version.
|
||||
Warning, alien can be dangerous:
|
||||
|
||||
Alien has successfully been used for converting add on software, such as
|
||||
Applixware, Metro X, and many other packages.
|
||||
Despite the high version number, alien is still (and will probably always
|
||||
be) rather experimental software. It's been under development for many
|
||||
years now, but there are still many bugs and limitations.
|
||||
|
||||
Alien should not be used to replace important system packages, like
|
||||
sysvinit, libc, or other things that are essential for the functioning of
|
||||
your system. Many of these packages are set up differently by the
|
||||
different distributions, and packages from the different distributions
|
||||
cannot be used interchangeably. In general, if you can't uninstall the
|
||||
package without breaking your system, don't try to replace it with an
|
||||
alien version.
|
||||
|
||||
Getting alien:
|
||||
|
||||
Alien will be available on Sunsite, but it hasn't moved out of Incoming yet.
|
||||
For now, you can get it at the alien home page:
|
||||
http://kite.ml.org/programs/alien/
|
||||
The newest versions of alien are available at the alien home page; drop by
|
||||
http://kitenet.net/programs/alien/
|
||||
|
||||
You can also get rpm or deb packages of alien:
|
||||
deb: ftp://master.debian.org/debian/unstable/binary-all/admin/alien_5.0.deb
|
||||
rpm: ftp://ftp.redhat.com/pub/contrib/RPMS/alien-5.0-1.i386.rpm
|
||||
On sunsite and its mirrors, alien is located in the
|
||||
pub/Linux/utils/scripts/ directory.
|
||||
|
||||
You can also get rpm or deb packages of alien:
|
||||
deb: ftp://ftp.debian.org/debian/unstable/binary-all/admin/alien_*.deb
|
||||
rpm: ftp://ftp.redhat.com/pub/contrib/noarch/alien-*.rpm
|
||||
|
||||
Other things you'll need:
|
||||
|
||||
To use alien, you will need several other programs. Alien is a perl program,
|
||||
and requires perl version 5 or greater. You must also have the Getopt::Long
|
||||
perl module installed on your system. I believe this is a standard part of
|
||||
perl.
|
||||
To use alien, you will need several other programs. Alien is a perl
|
||||
program, and requires perl version 5.004 or greater. If you use slackware,
|
||||
make sure you get perl 5.004, the perl 5.003 in slackware does not work
|
||||
with alien!
|
||||
|
||||
To convert packages to or from rpms, you need the Red Hat Package Manager;
|
||||
get it from Red Hat's ftp site.
|
||||
To convert packages to or from rpms, you need the Red Hat Package Manager;
|
||||
get it from Red Hat's ftp site.
|
||||
|
||||
If you want to convert packages into debian packages, you will need the dpkg,
|
||||
dpkg-dev, and debmake packages, which are available on the Debian ftp site.
|
||||
If you want to convert packages into debian packages, you will need the
|
||||
dpkg, dpkg-dev, and debhelper packages, which are available on the Debian
|
||||
ftp site.
|
||||
|
||||
To convert to/from stampede packages, you will need bzip2, get it at
|
||||
http://www.muraroa.demon.co.uk/
|
||||
|
||||
Attention, Slackware, Red Hat, and Stampede users: Bruce S. Babcock
|
||||
<babcock@math.psu.edu> has put together an "alien-extra"
|
||||
package of all the extra files you need to use alien on
|
||||
a Red Hat or Slackware system.
|
||||
The Slackware version is at
|
||||
ftp://ykbsb2.yk.psu.edu/pub/alien/alien-extra.tgz
|
||||
The RedHat version is at
|
||||
ftp://ykbsb2.yk.psu.edu/pub/alien/alien-extra.rpm
|
||||
The Stampede version is at
|
||||
ftp://ykbsb2.yk.psu.edu/pub/alien/alien-extra.slp
|
||||
|
||||
Programs that use alien:
|
||||
|
||||
I know of one program that acts as a frontend to alien - kpackviewer is a
|
||||
package viewer that can convert between package formats by using alien. It's
|
||||
homepage is at http://www.momentus.com.br/users/hook/kpackviewer.html
|
||||
|
||||
Please report any bugs in alien to the author:
|
||||
|
||||
Joey Hess <joey@kitenet.net>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Begin3
|
||||
Title: alien
|
||||
Version: 6.48
|
||||
Version: 6.59
|
||||
Entered-date: 31MAR97
|
||||
Description: Alien converts Slackware .tgz packages, Red Hat .rpm packages,
|
||||
Debian .deb packages, and Stampede .slp packages. It can
|
||||
@@ -9,6 +9,6 @@ Description: Alien converts Slackware .tgz packages, Red Hat .rpm packages,
|
||||
Keywords: debian dpkg deb red hat redhat rpm slackware tgz stampede slp convert package
|
||||
Author: joey@kitenet.net
|
||||
Primary-site: sunsite.unc.edu /pub/Linux/utils/package
|
||||
32 alien-6.48.tar.gz
|
||||
32 alien-6.59.tar.gz
|
||||
Copying-policy: GPL
|
||||
End
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
Summary: Install Debian and Slackware Packages with rpm.
|
||||
Name: alien
|
||||
Packager: Joey Hess <joey@kitenet.net>
|
||||
Version: 6.48
|
||||
Version: 6.59
|
||||
Release: 1
|
||||
Source: ftp://kitenet.net/pub/code/debian/alien_6.48.tar.gz
|
||||
Source: ftp://kitenet.net/pub/code/debian/alien_6.59.tar.gz
|
||||
Copyright: GPL
|
||||
Group: Utilities/File
|
||||
Buildroot: /tmp/alien-6.48.build
|
||||
Buildroot: /tmp/alien-6.59.build
|
||||
Requires: perl
|
||||
|
||||
%description
|
||||
@@ -19,7 +19,7 @@ This is a tool only suitable for binary packages.
|
||||
|
||||
%prep
|
||||
%setup -n alien
|
||||
rm -r /tmp/alien-6.48.build || true
|
||||
rm -r /tmp/alien-6.59.build || true
|
||||
|
||||
%install
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
|
||||
24
debian/changelog
vendored
24
debian/changelog
vendored
@@ -1,3 +1,27 @@
|
||||
alien (6.99) unstable; urgency=low
|
||||
|
||||
* The great rewrite. Alien is now based on pure object oriented package
|
||||
objects. These objects can read all relevant details about a package, and
|
||||
can generate packages based on that information. Thus, converting from one
|
||||
format to another becomes a simple matter of generating one of these
|
||||
objects, pointing it at a package, reblessing it into the destination
|
||||
class, and telling it to write the new package out! A basic alien can now
|
||||
be written using these objects in one "line" of perl -- in fact, here is
|
||||
one:
|
||||
perl -e 'use Alien::Package::Deb; use Alien::Package::Rpm; \
|
||||
$p=Alien::Package::Rpm->new(filename => shift);
|
||||
$p->read_file; $p->unpack;
|
||||
bless($p, "Alien::Package::Deb");
|
||||
$p->prep; $p->build;'
|
||||
* Almost every line of code has been rewritten.
|
||||
* Package descriptions now include a note that they were converted with
|
||||
alien. There are other numerous changes to the converted packages, for
|
||||
instance, generated .deb's now have more info in their copyright file.
|
||||
* The template files were all moved inside the objects, which is actually
|
||||
cleaner and is certainly easier to deal with.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Thu, 20 Apr 2000 18:52:41 -0700
|
||||
|
||||
alien (6.59) unstable; urgency=low
|
||||
|
||||
* Fixed typo, Closes: #60424
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
Alien can use special diff files to help make alien packages conform to
|
||||
debian policy. This is only used when you are converting to deb format. This
|
||||
documents briefly explains how to make them. It assumes you are familiar with
|
||||
document briefly explains how to make them. It assumes you are familiar with
|
||||
working with debian source packages.
|
||||
|
||||
* Use "alien -g file.rpm" to generate a "source" directory tree.
|
||||
* Make whatever changes you need to make to debian/rules, add other files,
|
||||
whatever.
|
||||
etc.
|
||||
* Use dpkg-buildpackage to generate a standard debian .diff.gz file, and
|
||||
stick it in /var/lib/alien.
|
||||
* Test "alien file.rpm" - it should use your diff. If it works properly,
|
||||
|
||||
Reference in New Issue
Block a user