mirror of
https://github.com/Project-OSS-Revival/alien.git
synced 2026-04-25 14:00:17 +00:00
Compare commits
79 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d8ec3bf09 | ||
|
|
decc4d75c8 | ||
|
|
de7aa3b0f8 | ||
|
|
5836229bae | ||
|
|
8bba6dfdc5 | ||
|
|
04a9c4fa04 | ||
|
|
9a6bf8f390 | ||
|
|
32f04aed12 | ||
|
|
ab603a11e0 | ||
|
|
b3bc197956 | ||
|
|
ee8794614c | ||
|
|
c4c8e3bc4a | ||
|
|
c6b123e40f | ||
|
|
c83906446f | ||
|
|
6a2e53bc63 | ||
|
|
ccd0532208 | ||
|
|
3985359d47 | ||
|
|
385b2066d3 | ||
|
|
b65f2d6974 | ||
|
|
2989545da6 | ||
|
|
3e7874e029 | ||
|
|
919146ea09 | ||
|
|
7179500cf8 | ||
|
|
f0fe4f6c80 | ||
|
|
922b06bf8d | ||
|
|
b235b51c36 | ||
|
|
3e46c56693 | ||
|
|
80877786d3 | ||
|
|
0de126bcfb | ||
|
|
3f13d15dfd | ||
|
|
f66dbb457b | ||
|
|
a5a16d572f | ||
|
|
18e40eeabb | ||
|
|
1a98232df6 | ||
|
|
648de61a5d | ||
|
|
0a70fe5858 | ||
|
|
e2eb7e0026 | ||
|
|
9b5622f8f2 | ||
|
|
88a0008668 | ||
|
|
a7be498dca | ||
|
|
f11a007797 | ||
|
|
9f53b73b58 | ||
|
|
bb351ddbc8 | ||
|
|
3572ac62b9 | ||
|
|
6443b942ab | ||
|
|
919297f3d1 | ||
|
|
22709da70e | ||
|
|
06ae0587ac | ||
|
|
c1b64b0c48 | ||
|
|
93ad8ae367 | ||
|
|
d3750a8156 | ||
|
|
7a1afcfb97 | ||
|
|
2999238f34 | ||
|
|
887717f304 | ||
|
|
9cb511802b | ||
|
|
6f5a303f3b | ||
|
|
92933477e6 | ||
|
|
53751ccbbf | ||
|
|
41fc0d549f | ||
|
|
b1bd50cc90 | ||
|
|
dd38b4e86d | ||
|
|
7aee419bd2 | ||
|
|
db4ea6fa4a | ||
|
|
f545de15f5 | ||
|
|
2fb28d27d2 | ||
|
|
363deec1c6 | ||
|
|
b69f536367 | ||
|
|
f717997da1 | ||
|
|
3faa48b23f | ||
|
|
e745cde2a0 | ||
|
|
5e4e122d58 | ||
|
|
873c3606f3 | ||
|
|
7640cb99d4 | ||
|
|
585fc93270 | ||
|
|
5b49be4d3d | ||
|
|
2dee87ca02 | ||
|
|
5c6bf645b5 | ||
|
|
1ca19300b4 | ||
|
|
9b37ec8545 |
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -1 +0,0 @@
|
|||||||
debian/changelog merge=dpkg-mergechangelogs
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
alien.lsm
|
|
||||||
alien.spec
|
|
||||||
@@ -62,7 +62,7 @@ The package's maintainer.
|
|||||||
|
|
||||||
=item depends
|
=item depends
|
||||||
|
|
||||||
The package's dependancies. Only dependencies that should exist on all
|
The package's dependencies. Only dependencies that should exist on all
|
||||||
target distributions can be put in here though (ie: lsb).
|
target distributions can be put in here though (ie: lsb).
|
||||||
|
|
||||||
=item group
|
=item group
|
||||||
@@ -173,7 +173,7 @@ sub install {
|
|||||||
=item test
|
=item test
|
||||||
|
|
||||||
Test a package file. The filename is passed, should return an array of lines
|
Test a package file. The filename is passed, should return an array of lines
|
||||||
of test results. Child classses may implement this.
|
of test results. Child classes may implement this.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
@@ -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
|
||||||
$this->do('find', $this->unpacked_tree, '-type', 'd',
|
# rm to work and we're not running as root. NB: can't
|
||||||
'-exec', 'chmod', '755', '{}', ';');
|
# use xargs
|
||||||
|
$this->do('find', $this->unpacked_tree, '-type', 'd',
|
||||||
|
'-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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -66,7 +71,7 @@ sub init {
|
|||||||
|
|
||||||
=item checkfile
|
=item checkfile
|
||||||
|
|
||||||
Detect deb files by their extention.
|
Detect deb files by their extension.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
@@ -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,65 @@ 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.zst') {
|
||||||
|
$controlcomp = 'zstd -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.zst') {
|
||||||
|
$datacomp = 'zstd -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.
|
||||||
@@ -178,19 +254,27 @@ sub scan {
|
|||||||
for (my $i=0; $i <= $#control; $i++) {
|
for (my $i=0; $i <= $#control; $i++) {
|
||||||
$_ = $control[$i];
|
$_ = $control[$i];
|
||||||
chomp;
|
chomp;
|
||||||
if (/^(\w.*?):\s+(.*)/) {
|
if (/^(\w.*?):\s*(.*)/) {
|
||||||
# Really old debs might have oddly capitalized
|
# Really old debs might have oddly capitalized
|
||||||
# field names.
|
# field names.
|
||||||
$field=ucfirst(lc($1));
|
$field=ucfirst(lc($1));
|
||||||
if (exists $fieldtrans{$field}) {
|
if (exists $fieldtrans{$field}) {
|
||||||
$field=$fieldtrans{$field};
|
$field=$fieldtrans{$field};
|
||||||
$this->$field($2);
|
my $value = $2;
|
||||||
|
# Only set field if value is non-empty.
|
||||||
|
# For Description, empty first line means
|
||||||
|
# the actual text starts on next line.
|
||||||
|
$this->$field($value) if length $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif (/^ / && $field eq 'summary') {
|
elsif (/^ / && $field eq 'summary') {
|
||||||
# Handle extended description.
|
# Handle extended description.
|
||||||
s/^ //g;
|
s/^ //g;
|
||||||
$_="" if $_ eq ".";
|
$_="" if $_ eq ".";
|
||||||
|
# If summary is empty, use first line of extended description
|
||||||
|
if (!defined $this->summary || !length $this->summary) {
|
||||||
|
$this->summary($_);
|
||||||
|
}
|
||||||
$description.="$_\n";
|
$description.="$_\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,15 +293,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 +328,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 +393,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");
|
||||||
|
|
||||||
@@ -385,7 +471,7 @@ sub prep {
|
|||||||
|
|
||||||
# Use debhelper v7
|
# Use debhelper v7
|
||||||
open (OUT, ">$dir/debian/compat") || die "$dir/debian/compat: $!";
|
open (OUT, ">$dir/debian/compat") || die "$dir/debian/compat: $!";
|
||||||
print OUT "7\n";
|
print OUT "10\n";
|
||||||
close OUT;
|
close OUT;
|
||||||
|
|
||||||
# A minimal rules file.
|
# A minimal rules file.
|
||||||
@@ -397,63 +483,53 @@ sub prep {
|
|||||||
|
|
||||||
PACKAGE=\$(shell dh_listpackages)
|
PACKAGE=\$(shell dh_listpackages)
|
||||||
|
|
||||||
build:
|
%:
|
||||||
dh_testdir
|
dh \$\@
|
||||||
|
|
||||||
clean:
|
override_dh_clean:
|
||||||
dh_testdir
|
|
||||||
dh_testroot
|
|
||||||
dh_clean -d
|
dh_clean -d
|
||||||
|
|
||||||
binary-indep: build
|
override_dh_auto_configure:
|
||||||
|
|
||||||
binary-arch: build
|
override_dh_auto_build:
|
||||||
dh_testdir
|
|
||||||
dh_testroot
|
|
||||||
dh_prep
|
|
||||||
dh_installdirs
|
|
||||||
|
|
||||||
dh_installdocs
|
override_dh_auto_install:
|
||||||
dh_installchangelogs
|
mkdir -p debian/\$(PACKAGE)
|
||||||
|
# Copy the packages's files.
|
||||||
# Copy the packages's files.
|
|
||||||
find . -maxdepth 1 -mindepth 1 -not -name debian -print0 | \\
|
find . -maxdepth 1 -mindepth 1 -not -name debian -print0 | \\
|
||||||
xargs -0 -r -i cp -a {} debian/\$(PACKAGE)
|
sed -e s#'./'##g | \\
|
||||||
|
xargs -0 -r -i cp -a ./{} debian/\$(PACKAGE)/{}
|
||||||
#
|
#
|
||||||
# If you need to move files around in debian/\$(PACKAGE) or do some
|
# If you need to move files around in debian/\$(PACKAGE) or do some
|
||||||
# binary patching, do it here
|
# binary patching, do it here
|
||||||
#
|
#
|
||||||
|
|
||||||
|
override_dh_strip:
|
||||||
# This has been known to break on some wacky binaries.
|
# This has been known to break on some wacky binaries.
|
||||||
# dh_strip
|
# dh_strip
|
||||||
dh_compress
|
|
||||||
$fixpermscomment dh_fixperms
|
override_dh_usrlocal:
|
||||||
dh_makeshlibs
|
-dh_usrlocal || printf "Your package seems to be installing files into /usr/local/, which could be buggy. Will continue anyway.\\n"
|
||||||
dh_installdeb
|
|
||||||
-dh_shlibdeps
|
override_dh_fixperms:
|
||||||
dh_gencontrol
|
$fixpermscomment dh_fixperms
|
||||||
dh_md5sums
|
|
||||||
dh_builddeb
|
override_dh_shlibdeps:
|
||||||
|
-dh_shlibdeps
|
||||||
|
|
||||||
binary: binary-indep binary-arch
|
|
||||||
.PHONY: build clean binary-indep binary-arch binary
|
|
||||||
EOF
|
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") ||
|
else {
|
||||||
die "$dir/debian/$script: $!";
|
# There may be a postinst with permissions fixups even when
|
||||||
print OUT $data;
|
# scripts are disabled.
|
||||||
close OUT;
|
$this->savescript("postinst", undef);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my %dirtrans=( # Note: no trailing slashes on these directory names!
|
my %dirtrans=( # Note: no trailing slashes on these directory names!
|
||||||
@@ -542,7 +618,7 @@ sub cleantree {
|
|||||||
|
|
||||||
Set/get package name.
|
Set/get package name.
|
||||||
|
|
||||||
Always returns the packge name in lowercase with all invalid characters
|
Always returns the package name in lowercase with all invalid characters
|
||||||
rmoved. The name is however, stored unchanged.
|
rmoved. The name is however, stored unchanged.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
@@ -596,12 +672,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 $_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -727,29 +804,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/) {
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ Alien::Package::Rpm - an object that represents a rpm package
|
|||||||
|
|
||||||
package Alien::Package::Rpm;
|
package Alien::Package::Rpm;
|
||||||
use strict;
|
use strict;
|
||||||
use base qw(Alien::Package);
|
use Exporter qw(import);
|
||||||
|
our @EXPORT_OK = qw(arch);
|
||||||
|
use base qw(Alien::Package Exporter);
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
@@ -31,7 +33,7 @@ Relocatable rpm packages have a prefixes field.
|
|||||||
|
|
||||||
=item checkfile
|
=item checkfile
|
||||||
|
|
||||||
Detect rpm files by their extention.
|
Detect rpm files by their extension.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
@@ -44,7 +46,7 @@ sub checkfile {
|
|||||||
|
|
||||||
=item install
|
=item install
|
||||||
|
|
||||||
Install a rpm. If RPMINSTALLOPT is set in the environement, the options in
|
Install a rpm. If RPMINSTALLOPT is set in the environment, the options in
|
||||||
it are passed to rpm on its command line.
|
it are passed to rpm on its command line.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
@@ -83,7 +85,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 +98,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 +130,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 +163,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 +176,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 +186,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 +250,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);
|
||||||
@@ -302,35 +304,167 @@ sub prep {
|
|||||||
my $this=shift;
|
my $this=shift;
|
||||||
my $dir=$this->unpacked_tree || die "The package must be unpacked first!";
|
my $dir=$this->unpacked_tree || die "The package must be unpacked first!";
|
||||||
|
|
||||||
|
# Exclude standard system directories
|
||||||
|
# This list is adapted from the rpmlint source code
|
||||||
|
my @standard_dirs = (
|
||||||
|
"/",
|
||||||
|
"/bin/",
|
||||||
|
"/boot/",
|
||||||
|
"/etc/",
|
||||||
|
"/etc/X11/",
|
||||||
|
"/etc/opt/",
|
||||||
|
"/etc/profile.d/",
|
||||||
|
"/etc/skel/",
|
||||||
|
"/etc/xinetd.d/",
|
||||||
|
"/home/",
|
||||||
|
"/lib/",
|
||||||
|
"/lib/modules/",
|
||||||
|
"/lib64/",
|
||||||
|
"/media/",
|
||||||
|
"/mnt/",
|
||||||
|
"/mnt/cdrom/",
|
||||||
|
"/mnt/disk/",
|
||||||
|
"/mnt/floppy/",
|
||||||
|
"/opt/",
|
||||||
|
"/proc/",
|
||||||
|
"/root/",
|
||||||
|
"/run/",
|
||||||
|
"/sbin/",
|
||||||
|
"/selinux/",
|
||||||
|
"/srv/",
|
||||||
|
"/sys/",
|
||||||
|
"/tmp/",
|
||||||
|
"/usr/",
|
||||||
|
"/usr/X11R6/",
|
||||||
|
"/usr/X11R6/bin/",
|
||||||
|
"/usr/X11R6/doc/",
|
||||||
|
"/usr/X11R6/include/",
|
||||||
|
"/usr/X11R6/lib/",
|
||||||
|
"/usr/X11R6/lib64/",
|
||||||
|
"/usr/X11R6/man/",
|
||||||
|
"/usr/X11R6/man/man1/",
|
||||||
|
"/usr/X11R6/man/man2/",
|
||||||
|
"/usr/X11R6/man/man3/",
|
||||||
|
"/usr/X11R6/man/man4/",
|
||||||
|
"/usr/X11R6/man/man5/",
|
||||||
|
"/usr/X11R6/man/man6/",
|
||||||
|
"/usr/X11R6/man/man7/",
|
||||||
|
"/usr/X11R6/man/man8/",
|
||||||
|
"/usr/X11R6/man/man9/",
|
||||||
|
"/usr/X11R6/man/mann/",
|
||||||
|
"/usr/bin/",
|
||||||
|
"/usr/bin/X11/",
|
||||||
|
"/usr/etc/",
|
||||||
|
"/usr/games/",
|
||||||
|
"/usr/include/",
|
||||||
|
"/usr/lib/",
|
||||||
|
"/usr/lib/X11/",
|
||||||
|
"/usr/lib/games/",
|
||||||
|
"/usr/lib/gcc-lib/",
|
||||||
|
"/usr/lib/menu/",
|
||||||
|
"/usr/lib64/",
|
||||||
|
"/usr/lib64/gcc-lib/",
|
||||||
|
"/usr/local/",
|
||||||
|
"/usr/local/bin/",
|
||||||
|
"/usr/local/doc/",
|
||||||
|
"/usr/local/etc/",
|
||||||
|
"/usr/local/games/",
|
||||||
|
"/usr/local/info/",
|
||||||
|
"/usr/local/lib/",
|
||||||
|
"/usr/local/lib64/",
|
||||||
|
"/usr/local/man/",
|
||||||
|
"/usr/local/man/man1/",
|
||||||
|
"/usr/local/man/man2/",
|
||||||
|
"/usr/local/man/man3/",
|
||||||
|
"/usr/local/man/man4/",
|
||||||
|
"/usr/local/man/man5/",
|
||||||
|
"/usr/local/man/man6/",
|
||||||
|
"/usr/local/man/man7/",
|
||||||
|
"/usr/local/man/man8/",
|
||||||
|
"/usr/local/man/man9/",
|
||||||
|
"/usr/local/man/mann/",
|
||||||
|
"/usr/local/sbin/",
|
||||||
|
"/usr/local/share/",
|
||||||
|
"/usr/local/share/man/",
|
||||||
|
"/usr/local/share/man/man1/",
|
||||||
|
"/usr/local/share/man/man2/",
|
||||||
|
"/usr/local/share/man/man3/",
|
||||||
|
"/usr/local/share/man/man4/",
|
||||||
|
"/usr/local/share/man/man5/",
|
||||||
|
"/usr/local/share/man/man6/",
|
||||||
|
"/usr/local/share/man/man7/",
|
||||||
|
"/usr/local/share/man/man8/",
|
||||||
|
"/usr/local/share/man/man9/",
|
||||||
|
"/usr/local/share/man/mann/",
|
||||||
|
"/usr/local/src/",
|
||||||
|
"/usr/sbin/",
|
||||||
|
"/usr/share/",
|
||||||
|
"/usr/share/dict/",
|
||||||
|
"/usr/share/doc/",
|
||||||
|
"/usr/share/icons/",
|
||||||
|
"/usr/share/info/",
|
||||||
|
"/usr/share/man/",
|
||||||
|
"/usr/share/man/man1/",
|
||||||
|
"/usr/share/man/man2/",
|
||||||
|
"/usr/share/man/man3/",
|
||||||
|
"/usr/share/man/man4/",
|
||||||
|
"/usr/share/man/man5/",
|
||||||
|
"/usr/share/man/man6/",
|
||||||
|
"/usr/share/man/man7/",
|
||||||
|
"/usr/share/man/man8/",
|
||||||
|
"/usr/share/man/man9/",
|
||||||
|
"/usr/share/man/mann/",
|
||||||
|
"/usr/share/misc/",
|
||||||
|
"/usr/src/",
|
||||||
|
"/usr/tmp/",
|
||||||
|
"/var/",
|
||||||
|
"/var/cache/",
|
||||||
|
"/var/db/",
|
||||||
|
"/var/lib/",
|
||||||
|
"/var/lib/games/",
|
||||||
|
"/var/lib/misc/",
|
||||||
|
"/var/lib/rpm/",
|
||||||
|
"/var/local/",
|
||||||
|
"/var/log/",
|
||||||
|
"/var/mail/",
|
||||||
|
"/var/nis/",
|
||||||
|
"/var/opt/",
|
||||||
|
"/var/preserve/",
|
||||||
|
"/var/spool/",
|
||||||
|
"/var/spool/mail/",
|
||||||
|
"/var/tmp/"
|
||||||
|
);
|
||||||
|
|
||||||
# Place %config in front of files that are conffiles.
|
# Place %config in front of files that are conffiles.
|
||||||
my @conffiles = @{$this->conffiles};
|
my @conffiles = @{$this->conffiles};
|
||||||
my $filelist;
|
my $filelist;
|
||||||
foreach my $fn (@{$this->filelist}) {
|
foreach my $fn (@{$this->filelist}) {
|
||||||
# Unquote any escaped characters in filenames - needed for
|
if (! grep(m:^\Q$fn\E$:,@standard_dirs)) {
|
||||||
# non ascii characters. (eg. iso_8859-1 latin set)
|
# Unquote any escaped characters in filenames - needed for
|
||||||
if ($fn =~ /\\/) {
|
# non ascii characters. (eg. iso_8859-1 latin set)
|
||||||
$fn=eval qq{"$fn"};
|
if ($fn =~ /\\/) {
|
||||||
}
|
$fn=eval qq{"$fn"};
|
||||||
|
}
|
||||||
|
|
||||||
# Note all filenames are quoted in case they contain
|
# Note all filenames are quoted in case they contain
|
||||||
# spaces.
|
# spaces.
|
||||||
if ($fn =~ m:/$:) {
|
if ($fn =~ m:/$:) {
|
||||||
$filelist.=qq{%dir "$fn"\n};
|
$filelist.=qq{%dir "$fn"\n};
|
||||||
}
|
}
|
||||||
elsif (grep(m:^\Q$fn\E$:,@conffiles)) { # it's a conffile
|
elsif (grep(m:^\Q$fn\E$:,@conffiles)) { # it's a conffile
|
||||||
$filelist.=qq{%config "$fn"\n};
|
$filelist.=qq{%config "$fn"\n};
|
||||||
}
|
}
|
||||||
else { # normal file
|
else { # normal file
|
||||||
$filelist.=qq{"$fn"\n};
|
$filelist.=qq{"$fn"\n};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Write out the spec file.
|
# Write out the spec file.
|
||||||
my $spec="$dir/".$this->name."-".$this->version."-".$this->release.".spec";
|
my $spec="$dir/".$this->name."-".$this->version."-".$this->release.".spec";
|
||||||
open (OUT, ">$spec") || die "$spec: $!";
|
open (OUT, ">$spec") || die "$spec: $!";
|
||||||
my $pwd=`pwd`;
|
# Note: Buildroot is passed via --buildroot command line option
|
||||||
chomp $pwd;
|
# to handle paths with spaces correctly
|
||||||
print OUT "Buildroot: $pwd/$dir\n"; # must be absolute dirname
|
|
||||||
print OUT "Name: ".$this->name."\n";
|
print OUT "Name: ".$this->name."\n";
|
||||||
print OUT "Version: ".$this->version."\n";
|
print OUT "Version: ".$this->version."\n";
|
||||||
print OUT "Release: ".$this->release."\n";
|
print OUT "Release: ".$this->release."\n";
|
||||||
@@ -348,22 +482,22 @@ sub prep {
|
|||||||
if ($this->usescripts) {
|
if ($this->usescripts) {
|
||||||
if ($this->preinst) {
|
if ($this->preinst) {
|
||||||
print OUT "\%pre\n";
|
print OUT "\%pre\n";
|
||||||
print OUT $this->preinst."\n";
|
print OUT escape_percents($this->preinst)."\n";
|
||||||
print OUT "\n";
|
print OUT "\n";
|
||||||
}
|
}
|
||||||
if ($this->postinst) {
|
if ($this->postinst) {
|
||||||
print OUT "\%post\n";
|
print OUT "\%post\n";
|
||||||
print OUT $this->postinst."\n";
|
print OUT escape_percents($this->postinst)."\n";
|
||||||
print OUT "\n";
|
print OUT "\n";
|
||||||
}
|
}
|
||||||
if ($this->prerm) {
|
if ($this->prerm) {
|
||||||
print OUT "\%preun\n";
|
print OUT "\%preun\n";
|
||||||
print OUT $this->prerm."\n";
|
print OUT escape_percents($this->prerm)."\n";
|
||||||
print OUT "\n";
|
print OUT "\n";
|
||||||
}
|
}
|
||||||
if ($this->postrm) {
|
if ($this->postrm) {
|
||||||
print OUT "\%postun\n";
|
print OUT "\%postun\n";
|
||||||
print OUT $this->postrm."\n";
|
print OUT escape_percents($this->postrm)."\n";
|
||||||
print OUT "\n";
|
print OUT "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -392,7 +526,7 @@ sub cleantree {
|
|||||||
|
|
||||||
=item build
|
=item build
|
||||||
|
|
||||||
Build a rpm. If RPMBUILDOPT is set in the environement, the options in
|
Build a rpm. If RPMBUILDOPT is set in the environment, the options in
|
||||||
it are passed to rpm on its command line.
|
it are passed to rpm on its command line.
|
||||||
|
|
||||||
An optional parameter, if passed, can be used to specify the program to use
|
An optional parameter, if passed, can be used to specify the program to use
|
||||||
@@ -424,7 +558,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 +573,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;
|
||||||
@@ -479,7 +613,7 @@ sub version {
|
|||||||
|
|
||||||
Set/get script fields.
|
Set/get script fields.
|
||||||
|
|
||||||
When retrieving a value, we have to do some truely sick mangling. Since
|
When retrieving a value, we have to do some truly sick mangling. Since
|
||||||
debian/slackware scripts can be anything -- perl programs or binary files
|
debian/slackware scripts can be anything -- perl programs or binary files
|
||||||
-- and rpm is limited to only shell scripts, we need to encode the files
|
-- and rpm is limited to only shell scripts, we need to encode the files
|
||||||
and add a scrap of shell script to make it unextract and run on the fly.
|
and add a scrap of shell script to make it unextract and run on the fly.
|
||||||
@@ -524,6 +658,7 @@ sub _script_helper {
|
|||||||
$this->{$script} = $value;
|
$this->{$script} = $value;
|
||||||
}
|
}
|
||||||
$this->{$script} = shift if @_;
|
$this->{$script} = shift if @_;
|
||||||
|
return $this->{$script};
|
||||||
|
|
||||||
# get
|
# get
|
||||||
return unless defined wantarray; # optimization
|
return unless defined wantarray; # optimization
|
||||||
@@ -559,12 +694,17 @@ sub prerm {
|
|||||||
my $this=shift;
|
my $this=shift;
|
||||||
$this->_script_helper('prerm', @_);
|
$this->_script_helper('prerm', @_);
|
||||||
}
|
}
|
||||||
|
sub escape_percents {
|
||||||
|
my $s=shift;
|
||||||
|
$s =~ s/\%/\%\%/g;
|
||||||
|
return $s;
|
||||||
|
}
|
||||||
|
|
||||||
=item arch
|
=item arch
|
||||||
|
|
||||||
Set/get arch field. When the arch field is set, some sanitizing is done
|
Set/get arch field. When the arch field is set, some sanitizing is done
|
||||||
first to convert it to the debian format used internally. When it's
|
first to convert it to the debian format used internally. When it's
|
||||||
retreived it's converted back to rpm form from the internal form.
|
retrieved it's converted back to rpm form from the internal form.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
@@ -607,9 +747,20 @@ 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 'aarch64') {
|
||||||
|
# Treat aarch64 as arm64.
|
||||||
|
$arch='arm64';
|
||||||
|
}
|
||||||
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 +780,12 @@ sub arch {
|
|||||||
elsif ($arch eq 'all') {
|
elsif ($arch eq 'all') {
|
||||||
$arch='noarch';
|
$arch='noarch';
|
||||||
}
|
}
|
||||||
|
elsif ($arch eq 'arm64') {
|
||||||
|
$arch='aarch64';
|
||||||
|
}
|
||||||
|
elsif ($arch eq 'ppc64el') {
|
||||||
|
$arch='ppc64le';
|
||||||
|
}
|
||||||
|
|
||||||
return $arch
|
return $arch
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ character, I=unsigned integer.)
|
|||||||
=item footer_version
|
=item footer_version
|
||||||
|
|
||||||
What package format are we up to now? (Lowest one this is still
|
What package format are we up to now? (Lowest one this is still
|
||||||
compatable with.)
|
compatible with.)
|
||||||
|
|
||||||
=item archtrans
|
=item archtrans
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ Holds the slp package format version of the slp file.
|
|||||||
|
|
||||||
=item checkfile
|
=item checkfile
|
||||||
|
|
||||||
Detect slp files by their extention.
|
Detect slp files by their extension.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -270,7 +270,7 @@ Set/get conffiles.
|
|||||||
|
|
||||||
When the conffiles are set, the format used by slp (a colon-delimited list)
|
When the conffiles are set, the format used by slp (a colon-delimited list)
|
||||||
is turned into the real list that is used internally. The list is changed
|
is turned into the real list that is used internally. The list is changed
|
||||||
back into slp's internal format when it is retreived.
|
back into slp's internal format when it is retrieved.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
@@ -291,7 +291,7 @@ Set/get copyright.
|
|||||||
|
|
||||||
When the copyright is set, the number used by slp is changed into a textual
|
When the copyright is set, the number used by slp is changed into a textual
|
||||||
description. This is changed back into a number when the value is
|
description. This is changed back into a number when the value is
|
||||||
retreived.
|
retrieved.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
@@ -315,7 +315,7 @@ Set/get arch.
|
|||||||
|
|
||||||
When the arch is set, the number used by slp is changed into a textual
|
When the arch is set, the number used by slp is changed into a textual
|
||||||
description. This is changed back into a number when the value is
|
description. This is changed back into a number when the value is
|
||||||
retreived.
|
retrieved.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
@@ -341,7 +341,7 @@ sub arch {
|
|||||||
|
|
||||||
Set/get release version.
|
Set/get release version.
|
||||||
|
|
||||||
When the release version is retreived, it is converted to an unsigned
|
When the release version is retrieved, it is converted to an unsigned
|
||||||
integer, as is required by the slp package format.
|
integer, as is required by the slp package format.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ package Alien::Package::Tgz;
|
|||||||
use strict;
|
use strict;
|
||||||
use base qw(Alien::Package);
|
use base qw(Alien::Package);
|
||||||
use Cwd qw(abs_path);
|
use Cwd qw(abs_path);
|
||||||
|
use Alien::Package::Rpm qw(arch);
|
||||||
|
|
||||||
my $tarext=qr/\.(?:tgz|tar(?:\.(?:gz|Z|z|bz|bz2))?|taz)$/;
|
my $tarext=qr/\.(?:tgz|tar(?:\.(?:gz|Z|z|bz|bz2))?|taz)$/;
|
||||||
|
|
||||||
@@ -45,7 +46,7 @@ use constant scripttrans => {
|
|||||||
|
|
||||||
=item checkfile
|
=item checkfile
|
||||||
|
|
||||||
Detect tgz files by their extention.
|
Detect tgz files by their extension.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
@@ -96,7 +97,7 @@ sub scan {
|
|||||||
# Get basename of the filename.
|
# Get basename of the filename.
|
||||||
my ($basename)=('/'.$file)=~m#^/?.*/(.*?)$#;
|
my ($basename)=('/'.$file)=~m#^/?.*/(.*?)$#;
|
||||||
|
|
||||||
# Strip out any tar extentions.
|
# Strip out any tar extensions.
|
||||||
$basename=~s/$tarext//;
|
$basename=~s/$tarext//;
|
||||||
|
|
||||||
if ($basename=~m/([\w-]+)-([0-9\.?]+).*/) {
|
if ($basename=~m/([\w-]+)-([0-9\.?]+).*/) {
|
||||||
@@ -110,15 +111,99 @@ sub scan {
|
|||||||
|
|
||||||
$this->arch('all');
|
$this->arch('all');
|
||||||
|
|
||||||
$this->summary("Converted tgz package");
|
# Attempt to extract slack-desc
|
||||||
$this->description($this->summary);
|
my $slack_desc_content = $this->runpipe(1, "tar Oxf '$file' install/slack-desc 2>/dev/null");
|
||||||
|
my $pkg_name = $this->name(); # Get package name early
|
||||||
|
|
||||||
|
if ($slack_desc_content && $slack_desc_content =~ /\S/) {
|
||||||
|
my @slack_lines = split /\n/, $slack_desc_content;
|
||||||
|
|
||||||
|
# Default values if parsing fails or parts are missing
|
||||||
|
my $default_summary_text = "Package from tgz file (slack-desc found)";
|
||||||
|
my $default_description_text = "Package from tgz file (slack-desc found)";
|
||||||
|
$this->summary($default_summary_text);
|
||||||
|
$this->description($default_description_text);
|
||||||
|
|
||||||
|
my $summary_parsed_successfully = 0;
|
||||||
|
|
||||||
|
if (@slack_lines) {
|
||||||
|
my $first_line = $slack_lines[0]; # Peek at first line
|
||||||
|
# Try to parse summary from the first line using the strict format
|
||||||
|
if ($first_line =~ /^\Q$pkg_name\E: \Q$pkg_name\E \((.+)\)\s*$/) {
|
||||||
|
my $summary_candidate = $1;
|
||||||
|
if ($summary_candidate =~ /\S/) { # Check if captured summary is not just whitespace
|
||||||
|
$this->summary($summary_candidate);
|
||||||
|
$this->description($summary_candidate); # Initial guess for description
|
||||||
|
shift @slack_lines; # Consume the line as it was successfully parsed
|
||||||
|
$summary_parsed_successfully = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Description Parsing from remaining lines (or all lines if summary parse failed)
|
||||||
|
my @description_parts;
|
||||||
|
my $expected_prefix_regex = qr/^\Q$pkg_name\E: /; # $pkg_name: <text>
|
||||||
|
my $paragraph_break_regex = qr/^\Q$pkg_name\E:$/; # $pkg_name:
|
||||||
|
|
||||||
|
foreach my $line (@slack_lines) {
|
||||||
|
if ($line =~ $paragraph_break_regex) {
|
||||||
|
push @description_parts, ""; # Paragraph break
|
||||||
|
} elsif ((my $desc_content = $line) =~ s/$expected_prefix_regex//) {
|
||||||
|
# Prefix was stripped, $desc_content now holds the rest
|
||||||
|
push @description_parts, $desc_content;
|
||||||
|
} else {
|
||||||
|
# Line does not match strict format, ignore it for description.
|
||||||
|
# This handles cases where the first line was not a valid summary
|
||||||
|
# and is now being re-evaluated here but doesn't fit description format either.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (@description_parts) {
|
||||||
|
my $parsed_description = join("\n", @description_parts);
|
||||||
|
# Remove leading/trailing empty lines from the final description block
|
||||||
|
$parsed_description =~ s/^\n+//;
|
||||||
|
$parsed_description =~ s/\n+$/\n/; # Keep single trailing newline if content, or make it one if many
|
||||||
|
$parsed_description =~ s/\s+$//; # Trim trailing whitespace overall, including last newline if it was just that
|
||||||
|
|
||||||
|
if ($parsed_description =~ /\S/) {
|
||||||
|
$this->description($parsed_description);
|
||||||
|
# If summary is still the generic default, but we have a description,
|
||||||
|
# try to set summary from the first line of this description.
|
||||||
|
if ($this->summary() eq $default_summary_text) {
|
||||||
|
my ($first_desc_line) = split /\n/, $parsed_description;
|
||||||
|
if ($first_desc_line && length($first_desc_line) < 100 && $first_desc_line =~ /\S/) {
|
||||||
|
$this->summary($first_desc_line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
# Description parts were found but resulted in an empty string (e.g. only paragraph markers)
|
||||||
|
# Revert to summary if summary was good, or default if summary was also default.
|
||||||
|
if ($summary_parsed_successfully) {
|
||||||
|
$this->description($this->summary());
|
||||||
|
} else {
|
||||||
|
$this->description($default_description_text); # Keep default
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elsif (!$summary_parsed_successfully) {
|
||||||
|
# No description parts AND summary was not parsed successfully means slack-desc was
|
||||||
|
# present but entirely unparsable or empty after the first line (if any).
|
||||||
|
# Summary and Description remain $default_summary_text.
|
||||||
|
}
|
||||||
|
# If summary was parsed but no description lines, description is already set to summary.
|
||||||
|
|
||||||
|
} else {
|
||||||
|
# Original behavior if slack-desc is not found or empty
|
||||||
|
$this->summary("Converted tgz package");
|
||||||
|
$this->description($this->summary);
|
||||||
|
}
|
||||||
|
|
||||||
$this->copyright('unknown');
|
$this->copyright('unknown');
|
||||||
$this->release(1);
|
$this->release(1);
|
||||||
$this->distribution("Slackware/tarball");
|
$this->distribution("Slackware/tarball");
|
||||||
$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 +237,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;
|
||||||
@@ -177,6 +262,161 @@ sub unpack {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Helper function for _format_slack_desc
|
||||||
|
sub _format_slack_desc_section {
|
||||||
|
my ($pkgname, $text_content, $num_target_lines, $max_total_line_length) = @_;
|
||||||
|
|
||||||
|
my $line_prefix_with_space = "$pkgname: ";
|
||||||
|
my $line_prefix_no_space = "$pkgname:";
|
||||||
|
# Max length for the actual content, after the prefix
|
||||||
|
my $max_content_len = $max_total_line_length - length($line_prefix_with_space);
|
||||||
|
# Ensure max_content_len is somewhat reasonable if pkgname is very long
|
||||||
|
$max_content_len = 10 if $max_content_len < 10;
|
||||||
|
|
||||||
|
my @formatted_lines;
|
||||||
|
$text_content = "" if !defined $text_content; # Ensure defined
|
||||||
|
|
||||||
|
my @segments = split /\n/, $text_content;
|
||||||
|
# If text_content was empty, split results in one empty segment.
|
||||||
|
# If text_content ended with \n, split might produce an extra empty segment.
|
||||||
|
# We want to preserve intentional paragraph breaks (empty segments from \n\n).
|
||||||
|
|
||||||
|
# Special case: if text_content is completely empty, segments will be [""]
|
||||||
|
# and num_target_lines is 1, it should produce one "$pkgname:" line.
|
||||||
|
# If text_content is non-empty but results in no words (e.g. " \n "),
|
||||||
|
# it should also be handled gracefully.
|
||||||
|
|
||||||
|
SEGMENT: foreach my $segment (@segments) {
|
||||||
|
last SEGMENT if scalar(@formatted_lines) >= $num_target_lines;
|
||||||
|
|
||||||
|
# Trim whitespace from segment. If it becomes empty, it's a paragraph break.
|
||||||
|
$segment =~ s/^\s+|\s+$//g;
|
||||||
|
|
||||||
|
if ($segment eq "") {
|
||||||
|
push @formatted_lines, $line_prefix_no_space;
|
||||||
|
next SEGMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
my @words = split /\s+/, $segment;
|
||||||
|
next SEGMENT if !@words; # Should not happen if segment was non-empty after trim
|
||||||
|
|
||||||
|
my $current_line_buffer = ""; # Holds content part of the line
|
||||||
|
|
||||||
|
WORD: foreach my $word (@words) {
|
||||||
|
if (scalar(@formatted_lines) >= $num_target_lines && $current_line_buffer eq "") {
|
||||||
|
# Already filled target lines and current buffer for this segment is empty
|
||||||
|
last SEGMENT;
|
||||||
|
}
|
||||||
|
# Check if a single word itself is too long
|
||||||
|
if (length($word) > $max_content_len) {
|
||||||
|
# If buffer has content, push it first
|
||||||
|
if ($current_line_buffer ne "") {
|
||||||
|
last SEGMENT if scalar(@formatted_lines) >= $num_target_lines;
|
||||||
|
push @formatted_lines, $line_prefix_with_space . $current_line_buffer;
|
||||||
|
$current_line_buffer = "";
|
||||||
|
}
|
||||||
|
# Push the long word, truncated, on its own line
|
||||||
|
last SEGMENT if scalar(@formatted_lines) >= $num_target_lines;
|
||||||
|
push @formatted_lines, $line_prefix_with_space . substr($word, 0, $max_content_len);
|
||||||
|
# The rest of the word is lost, as per typical shell script behavior (often implicit)
|
||||||
|
# Or, decide if $word should become the remainder: $word = substr($word, $max_content_len); and re-evaluate
|
||||||
|
# For now, simply truncating and moving to next word in input.
|
||||||
|
# Given the spec, it's more about fitting, so a very long word will just fill one line.
|
||||||
|
next WORD; # Move to next word, current long word handled.
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($current_line_buffer eq "") {
|
||||||
|
$current_line_buffer = $word;
|
||||||
|
} else {
|
||||||
|
my $potential_line = $current_line_buffer . " " . $word;
|
||||||
|
if (length($potential_line) <= $max_content_len) {
|
||||||
|
$current_line_buffer = $potential_line;
|
||||||
|
} else {
|
||||||
|
last SEGMENT if scalar(@formatted_lines) >= $num_target_lines;
|
||||||
|
push @formatted_lines, $line_prefix_with_space . $current_line_buffer;
|
||||||
|
$current_line_buffer = $word;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}# end WORD loop
|
||||||
|
|
||||||
|
# Push any remaining content in buffer for the current segment
|
||||||
|
if ($current_line_buffer ne "") {
|
||||||
|
last SEGMENT if scalar(@formatted_lines) >= $num_target_lines;
|
||||||
|
push @formatted_lines, $line_prefix_with_space . $current_line_buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
} # end SEGMENT loop
|
||||||
|
|
||||||
|
# Pad with "$pkgname:" or truncate to meet exactly $num_target_lines
|
||||||
|
while (scalar(@formatted_lines) < $num_target_lines) {
|
||||||
|
push @formatted_lines, $line_prefix_no_space;
|
||||||
|
}
|
||||||
|
if (scalar(@formatted_lines) > $num_target_lines) {
|
||||||
|
@formatted_lines = @formatted_lines[0 .. $num_target_lines - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return @formatted_lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub _format_slack_desc {
|
||||||
|
my $this = shift;
|
||||||
|
|
||||||
|
my $pkgname = $this->name() || "unknown"; # Should usually be defined
|
||||||
|
my $summary = $this->summary();
|
||||||
|
my $description = $this->description();
|
||||||
|
my $homepage_url = ""; # Fixed as per requirement
|
||||||
|
|
||||||
|
# Ensure summary is a single, trimmed line
|
||||||
|
$summary = "" if !defined $summary;
|
||||||
|
$summary =~ s/\n.*//s; # Keep only the first line
|
||||||
|
$summary =~ s/^\s+|\s+$//g; # Trim whitespace
|
||||||
|
$summary = "No summary" if $summary eq "";
|
||||||
|
|
||||||
|
|
||||||
|
$description = "" if !defined $description;
|
||||||
|
# Newlines in description are paragraph separators, handled by _format_slack_desc_section
|
||||||
|
|
||||||
|
my $screen_width = 72 + length($pkgname);
|
||||||
|
|
||||||
|
my $ruler_header = "# HOW TO EDIT THIS FILE:\n# The \"handy ruler\" below makes it easier to edit a package description.\n# Line up the first '|' above the ':' following the base package name, and\n# the '|' on the right side marks the last column you can put a character in.\n# You must make exactly 11 lines for the formatting to be correct. It's also\n# customary to leave one space after the ':' except on otherwise blank lines.\n\n";
|
||||||
|
|
||||||
|
my $ruler_gap = ' ' x length($pkgname);
|
||||||
|
my $ruler_base = $ruler_gap . "|-----handy-ruler--";
|
||||||
|
# Screen width is total, ruler includes the final '|', so -1 from screen_width for filling
|
||||||
|
my $ruler_fill_count = $screen_width - 1 - length($ruler_base);
|
||||||
|
$ruler_fill_count = 0 if $ruler_fill_count < 0; # Ensure not negative
|
||||||
|
my $ruler_line = $ruler_base . ('-' x $ruler_fill_count) . '|';
|
||||||
|
|
||||||
|
my $complete_ruler_block = $ruler_header . $ruler_line . "\n";
|
||||||
|
|
||||||
|
# Section 1: Summary (1 line)
|
||||||
|
# The format "$pkgname ($summary)" is part of the text_content for this section
|
||||||
|
my $summary_content_for_section = "$pkgname ($summary)";
|
||||||
|
my @summary_section = _format_slack_desc_section($pkgname, $summary_content_for_section, 1, $screen_width);
|
||||||
|
|
||||||
|
# Section 2: Empty line (1 line)
|
||||||
|
# This is effectively an empty paragraph
|
||||||
|
my @empty_section = _format_slack_desc_section($pkgname, "", 1, $screen_width);
|
||||||
|
# Ensure it's just "$pkgname:" as per spec for empty lines
|
||||||
|
$empty_section[0] = "$pkgname:" if @empty_section;
|
||||||
|
|
||||||
|
|
||||||
|
# Section 3: Description (8 lines)
|
||||||
|
my @description_section = _format_slack_desc_section($pkgname, $description, 8, $screen_width);
|
||||||
|
|
||||||
|
# Section 4: Homepage (1 line)
|
||||||
|
my @homepage_section = _format_slack_desc_section($pkgname, $homepage_url, 1, $screen_width);
|
||||||
|
# Ensure it's just "$pkgname:" if homepage_url is empty
|
||||||
|
if ($homepage_url eq "" && @homepage_section) {
|
||||||
|
$homepage_section[0] = "$pkgname:";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
my $all_content_lines = join("\n", @summary_section, @empty_section, @description_section, @homepage_section);
|
||||||
|
|
||||||
|
return $complete_ruler_block . $all_content_lines . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
=item prep
|
=item prep
|
||||||
|
|
||||||
Adds a populated install directory to the build tree.
|
Adds a populated install directory to the build tree.
|
||||||
@@ -186,16 +426,41 @@ Adds a populated install directory to the build tree.
|
|||||||
sub prep {
|
sub prep {
|
||||||
my $this=shift;
|
my $this=shift;
|
||||||
my $dir=$this->unpacked_tree || die "The package must be unpacked first!";
|
my $dir=$this->unpacked_tree || die "The package must be unpacked first!";
|
||||||
|
my $install_dir = $dir."/install";
|
||||||
my $install_made=0;
|
my $install_made=0;
|
||||||
|
|
||||||
|
# Check if install directory already exists (e.g. from unpacking)
|
||||||
|
if (-d $install_dir) {
|
||||||
|
$install_made = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Generate and write slack-desc if description is meaningful
|
||||||
|
my $description = $this->description();
|
||||||
|
my $summary = $this->summary();
|
||||||
|
if (defined $description && $description =~ /\S/ && $description ne "Converted tgz package" && $description ne $summary) {
|
||||||
|
my $slack_desc_content = $this->_format_slack_desc();
|
||||||
|
if ($slack_desc_content && $slack_desc_content =~ /\S/) {
|
||||||
|
if (!$install_made) {
|
||||||
|
mkdir($install_dir, 0755)
|
||||||
|
|| die "unable to mkdir $install_dir: $!";
|
||||||
|
$install_made=1;
|
||||||
|
}
|
||||||
|
my $slack_desc_path = $install_dir."/slack-desc";
|
||||||
|
open (SLACKDESC, ">$slack_desc_path") || die "Unable to open $slack_desc_path for writing: $!";
|
||||||
|
print SLACKDESC $slack_desc_content;
|
||||||
|
close SLACKDESC;
|
||||||
|
chmod(0644, $slack_desc_path) || $this->warn("Could not chmod $slack_desc_path: $!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->usescripts) {
|
if ($this->usescripts) {
|
||||||
foreach my $script (keys %{scripttrans()}) {
|
foreach my $script (keys %{scripttrans()}) {
|
||||||
my $data=$this->$script();
|
my $data=$this->$script();
|
||||||
my $out=$this->unpacked_tree."/install/".${scripttrans()}{$script};
|
my $out=$install_dir."/".${scripttrans()}{$script};
|
||||||
next if ! defined $data || $data =~ m/^\s*$/;
|
next if ! defined $data || $data =~ m/^\s*$/;
|
||||||
if (!$install_made) {
|
if (!$install_made) {
|
||||||
mkdir($this->unpacked_tree."/install", 0755)
|
mkdir($install_dir, 0755)
|
||||||
|| die "unable to mkdir ".$this->unpacked_tree."/install: $!";
|
|| die "unable to mkdir $install_dir: $!";
|
||||||
$install_made=1;
|
$install_made=1;
|
||||||
}
|
}
|
||||||
open (OUT, ">$out") || die "$out: $!";
|
open (OUT, ">$out") || die "$out: $!";
|
||||||
@@ -214,11 +479,21 @@ Build a tgz.
|
|||||||
|
|
||||||
sub build {
|
sub build {
|
||||||
my $this=shift;
|
my $this=shift;
|
||||||
my $tgz=$this->name."-".$this->version.".tgz";
|
my $arch = Alien::Package::Rpm::arch($this, @_);
|
||||||
|
my $tgz=$this->name."-".$this->version."-".$arch."-1_alien.tgz";
|
||||||
$this->do("cd ".$this->unpacked_tree."; tar czf ../$tgz .")
|
if (-x "/sbin/makepkg") {
|
||||||
or die "Package build failed";
|
my $v=$Alien::Package::verbose;
|
||||||
|
$Alien::Package::verbose=2;
|
||||||
|
$this->do("cd ".$this->unpacked_tree."; makepkg -l y -c n ../$tgz .")
|
||||||
|
or die "Unable to make pkg";
|
||||||
|
$Alien::Package::verbose=$v;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# Fallback to plain tar when makepkg is not available
|
||||||
|
# Use same method as makepkg: strip ./ prefix via sed to match Slackware format
|
||||||
|
$this->do("cd ".$this->unpacked_tree."; find ./ | LC_COLLATE=C sort | sed '2,\$s,^\\./,,' | tar --no-recursion -T - -czf ../$tgz")
|
||||||
|
or die "Package build failed";
|
||||||
|
}
|
||||||
return $tgz;
|
return $tgz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -15,21 +15,15 @@ sub MY::libscan {
|
|||||||
sub MY::postamble {
|
sub MY::postamble {
|
||||||
return q{
|
return q{
|
||||||
|
|
||||||
VER=$(shell perl -e '$$_=<>;print m/\((.*?)\)/'<debian/changelog)
|
VER=$(shell perl -e '$$_=<>;print m/\((.*?)\)/'<ChangeLog)
|
||||||
|
|
||||||
all:: extra_build
|
all:: extra_build
|
||||||
clean:: 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
|
||||||
|
|
||||||
extra_install:
|
|
||||||
install -d $(PREFIX)/share/alien/patches \
|
|
||||||
$(VARPREFIX)/var/lib/alien
|
|
||||||
|
|
||||||
alien:
|
alien:
|
||||||
perl -pe '$$_="" if /use lib/; $$_="our \$$Version=\"$(VER)\";\n" if /VERSION_AUTOREPLACE/' alien.pl > alien
|
perl -pe '$$_="" if /use lib/; $$_="our \$$Version=\"$(VER)\";\n" if /VERSION_AUTOREPLACE/' alien.pl > alien
|
||||||
}
|
}
|
||||||
|
|||||||
4
README
4
README
@@ -51,8 +51,8 @@ Note:
|
|||||||
Programs that use alien:
|
Programs that use alien:
|
||||||
|
|
||||||
I know of one program that acts as a frontend to alien - kpackviewer is a
|
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. Its
|
package viewer that can convert between package formats by using alien. Can
|
||||||
homepage is at http://www.momentus.com.br/users/hook/kpackviewer.html
|
be downloaded from https://download.kde.org/Attic/stable/stable/apps/KDE1.x/utils/kpackviewer-0.70.tar.gz
|
||||||
|
|
||||||
Corel also appears to have (or had) something in Corel linux that
|
Corel also appears to have (or had) something in Corel linux that
|
||||||
uses alien.
|
uses alien.
|
||||||
|
|||||||
14
alien.lsm
Normal file
14
alien.lsm
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
Begin3
|
||||||
|
Title: alien
|
||||||
|
Version: 8.95.2
|
||||||
|
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.95.2.tar.gz
|
||||||
|
Copying-policy: GPL
|
||||||
|
End
|
||||||
22
alien.pl
22
alien.pl
@@ -37,7 +37,7 @@ installed.
|
|||||||
|
|
||||||
=item lsb
|
=item lsb
|
||||||
|
|
||||||
Unlike the other package formats, B<alien> can handle the depenendencies of
|
Unlike the other package formats, B<alien> can handle the dependencies of
|
||||||
lsb packages if the destination package format supports dependencies. Note
|
lsb packages if the destination package format supports dependencies. Note
|
||||||
that this means that the package generated from a lsb package will depend on
|
that this means that the package generated from a lsb package will depend on
|
||||||
a package named "lsb" -- your distribution should provide a package by that
|
a package named "lsb" -- your distribution should provide a package by that
|
||||||
@@ -149,7 +149,7 @@ built.
|
|||||||
=item B<--anypatch>
|
=item B<--anypatch>
|
||||||
|
|
||||||
Be less strict about which patch file is used, perhaps attempting to use a patch
|
Be less strict about which patch file is used, perhaps attempting to use a patch
|
||||||
file for an older verson of the package. This is not guaranteed to always work;
|
file for an older version of the package. This is not guaranteed to always work;
|
||||||
older patches may not necessarily work with newer packages.
|
older patches may not necessarily work with newer packages.
|
||||||
|
|
||||||
=item B<--nopatch>
|
=item B<--nopatch>
|
||||||
@@ -158,12 +158,12 @@ Do not use any patch files.
|
|||||||
|
|
||||||
=item B<--description=>I<desc>
|
=item B<--description=>I<desc>
|
||||||
|
|
||||||
Specifiy a description for the package. This only has an effect when
|
Specify a description for the package. This only has an effect when
|
||||||
converting from the tgz package format, which lacks descriptions.
|
converting from the tgz package format, which lacks descriptions.
|
||||||
|
|
||||||
=item B<--version=>I<version>
|
=item B<--version=>I<version>
|
||||||
|
|
||||||
Specifiy a version for the package. This only has an effect when
|
Specify a version for the package. This only has an effect when
|
||||||
converting from the tgz package format, which may lack version
|
converting from the tgz package format, which may lack version
|
||||||
information.
|
information.
|
||||||
|
|
||||||
@@ -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
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.95.2
|
||||||
|
Release: 1
|
||||||
|
Source: ftp://kitenet.net/pub/code/debian/alien_8.95.2.tar.gz
|
||||||
|
License: GPL
|
||||||
|
Group: Utilities/File
|
||||||
|
Buildroot: /tmp/alien-8.95.2.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.95.2.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
|
||||||
1
debian/compat
vendored
1
debian/compat
vendored
@@ -1 +0,0 @@
|
|||||||
7
|
|
||||||
21
debian/control
vendored
21
debian/control
vendored
@@ -1,21 +0,0 @@
|
|||||||
Source: alien
|
|
||||||
Section: admin
|
|
||||||
Priority: optional
|
|
||||||
Build-Depends: debhelper (>= 7.0.50)
|
|
||||||
Maintainer: Joey Hess <joeyh@debian.org>
|
|
||||||
Standards-Version: 3.9.1
|
|
||||||
Vcs-Git: git://git.kitenet.net/alien
|
|
||||||
Homepage: http://kitenet.net/~joey/code/alien/
|
|
||||||
|
|
||||||
Package: alien
|
|
||||||
Architecture: all
|
|
||||||
Section: admin
|
|
||||||
Depends: debhelper (>= 7), ${misc:Depends}, ${perl:Depends}, rpm (>= 2.4.4-2), dpkg-dev, make, cpio, rpm2cpio
|
|
||||||
Suggests: patch, bzip2, lsb-rpm, lintian, lzma
|
|
||||||
Description: convert and install rpm and other packages
|
|
||||||
Alien allows you to convert LSB, Red Hat, Stampede and Slackware Packages
|
|
||||||
into Debian packages, which can be installed with dpkg.
|
|
||||||
.
|
|
||||||
It can also generate packages of any of the other formats.
|
|
||||||
.
|
|
||||||
This is a tool only suitable for binary packages.
|
|
||||||
35
debian/copyright
vendored
35
debian/copyright
vendored
@@ -1,35 +0,0 @@
|
|||||||
This is a program originally written by Christoph Lameter
|
|
||||||
<clameter@debian.org>.
|
|
||||||
|
|
||||||
Deb to rpm conversion code was taken from the Martian program by
|
|
||||||
Randolph Chung <randolph@tausq.org>.
|
|
||||||
|
|
||||||
The Solaris pkg code was written by Mark A. Hershberger
|
|
||||||
<mah@everybody.org>.
|
|
||||||
|
|
||||||
This program is now maintained by Joey Hess <joeyh@debian.org>.
|
|
||||||
|
|
||||||
Copyright 1996, 1997 Christoph Lameter
|
|
||||||
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.
|
|
||||||
|
|
||||||
2
debian/docs
vendored
2
debian/docs
vendored
@@ -1,2 +0,0 @@
|
|||||||
README
|
|
||||||
gendiff.txt
|
|
||||||
20
debian/rules
vendored
20
debian/rules
vendored
@@ -1,20 +0,0 @@
|
|||||||
#!/usr/bin/make -f
|
|
||||||
%:
|
|
||||||
dh $@
|
|
||||||
|
|
||||||
override_dh_auto_test:
|
|
||||||
# simple smoke test
|
|
||||||
./alien.pl -V
|
|
||||||
|
|
||||||
override_dh_auto_install:
|
|
||||||
$(MAKE) pure_install INSTALLDIRS=vendor \
|
|
||||||
PREFIX=$(shell pwd)/debian/alien/$(shell perl -MConfig -e 'print $$Config{prefix}') \
|
|
||||||
VARPREFIX=$(shell pwd)/debian/alien
|
|
||||||
|
|
||||||
override_dh_auto_clean:
|
|
||||||
# distclean moans about MANIFEST, this is quieter
|
|
||||||
if [ -e Makefile ]; then $(MAKE) realclean; fi
|
|
||||||
|
|
||||||
# Not intended for use by anyone except the author.
|
|
||||||
announcedir:
|
|
||||||
@echo ${HOME}/src/joeywiki/code/alien/news
|
|
||||||
Reference in New Issue
Block a user