mirror of
https://github.com/Project-OSS-Revival/alien.git
synced 2026-04-24 14:00:17 +00:00
* Checked into cvs. Added a fixlinks script to generate all symlinks.
* Integrated into my build system for automatic home page updates.
This commit is contained in:
@@ -1,67 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Package for converting from a .deb file.
|
||||
|
||||
# Query a deb file for fields, and return a hash of the fields found.
|
||||
# Pass the filename of the deb file to query.
|
||||
sub GetFields { my $file=shift;
|
||||
my %fields;
|
||||
|
||||
# Extract the control file from the deb file.
|
||||
my @control = `ar p $file control.tar.gz | tar Oxzf - control`;
|
||||
|
||||
# Parse control file and extract fields.
|
||||
my $i=0;
|
||||
while ($i<=$#control) {
|
||||
$_ = $control[$i];
|
||||
chomp;
|
||||
$fields{NAME} = $1 if (/^Package: (.+)/i);
|
||||
$fields{VERSION} = $1 if (/^Version: (.+)/i);
|
||||
$fields{ARCH} = $1 if (/^Architecture: (.+)/i);
|
||||
$fields{MAINTAINER} = $1 if (/^Maintainer: (.+)/i);
|
||||
$fields{DEPENDS} = $1 if (/^Depends: (.+)/i);
|
||||
$fields{REQUIRES} = $1 if (/^Requires: (.+)/i);
|
||||
$fields{GROUP} = $1 if (/^Section: (.+)/i);
|
||||
if (/^Description: (.+)/i) {
|
||||
$fields{SUMMARY} = "$1";
|
||||
$i++;
|
||||
while (($i<=$#control) && ($control[$i])) {
|
||||
$control[$i] =~ s/^ //g; #remove leading space
|
||||
$control[$i] = "\n" if ($control[$i] eq ".\n");
|
||||
$fields{DESCRIPTION}.=$control[$i];
|
||||
$i++;
|
||||
}
|
||||
$i--;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$fields{COPYRIGHT}="see /usr/doc/$fields{NAME}/copyright";
|
||||
$fields{GROUP}="unknown" if (!$fields{GROUP});
|
||||
$fields{DISTRIBUTION}="Debian";
|
||||
if ($fields{VERSION} =~ /(.+)-(.+)/) {
|
||||
$fields{VERSION} = $1;
|
||||
$fields{RELEASE} = $2 + 1;
|
||||
} else {
|
||||
$fields{RELEASE} = '1';
|
||||
}
|
||||
|
||||
# Read in the list of conffiles, if any.
|
||||
$fields{CONFFILES}=`ar p $file control.tar.gz | tar Oxzf - conffiles 2>/dev/null`;
|
||||
|
||||
# Read in the list of all files.
|
||||
# Note that tar doesn't supply a leading `/', so we have to add that.
|
||||
$fields{FILELIST}=undef;
|
||||
foreach $fn (`ar p $file data.tar.gz | tar tzf -`) {
|
||||
$fields{FILELIST}.="/$fn";
|
||||
}
|
||||
|
||||
return %fields;
|
||||
}
|
||||
|
||||
# Handles unpacking of debs.
|
||||
sub Unpack { my ($file)=@_;
|
||||
SafeSystem ("(cd ..;ar p $file data.tar.gz) | tar zxpf -","Error unpacking $file\n");
|
||||
}
|
||||
|
||||
1
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Package for converting from a .rpm file.
|
||||
|
||||
# Query a rpm file for fields, and return a hash of the fields found.
|
||||
# Pass the filename of the rpm file to query.
|
||||
sub GetFields { my $file=shift;
|
||||
my %fields;
|
||||
|
||||
# Use --queryformat to pull out all the fields we need.
|
||||
foreach $field ('NAME','VERSION','RELEASE','ARCH','CHANGELOGTEXT',
|
||||
'SUMMARY','DESCRIPTION','COPYRIGHT') {
|
||||
$_=`rpm -qp $file --queryformat \%{$field}`;
|
||||
$fields{$field}=$_ if $_ ne '(none)';
|
||||
}
|
||||
|
||||
# Get the conffiles list.
|
||||
$fields{CONFFILES}=`rpm -qcp $file`;
|
||||
|
||||
# Include the output of rpm -qi in the copyright file.
|
||||
$fields{COPYRIGHT_EXTRA}=`rpm -qpi $file`;
|
||||
|
||||
# Sanity check fields.
|
||||
if (!$fields{SUMMARY}) {
|
||||
# Older rpms will have no summary, but will have a
|
||||
# description. We'll take the 1st line out of the
|
||||
# description, and use it for the summary.
|
||||
($fields{SUMMARY})=($fields{DESCRIPTION}."\n")=~m/(.*?)\n/m;
|
||||
|
||||
# Fallback.
|
||||
if (!$fields{SUMMARY}) {
|
||||
$fields{SUMMARY}="Converted RPM package";
|
||||
}
|
||||
}
|
||||
if (!$fields{COPYRIGHT}) {
|
||||
$fields{COPYRIGHT}="unknown";
|
||||
}
|
||||
if (!$fields{DESCRIPTION}) {
|
||||
$fields{DESCRIPTION}=$fields{SUMMARY};
|
||||
}
|
||||
|
||||
# Convert ARCH into string, if it isn't already a string.
|
||||
if ($fields{ARCH} eq 1) {
|
||||
$fields{ARCH}='i386';
|
||||
}
|
||||
elsif ($fields{ARCH} eq 2) {
|
||||
$fields{ARCH}='alpha';
|
||||
}
|
||||
elsif ($fields{ARCH} eq 3) {
|
||||
$fields{ARCH}='sparc';
|
||||
}
|
||||
elsif ($fields{ARCH} eq 6) {
|
||||
$fields{ARCH}='m68k';
|
||||
}
|
||||
|
||||
if (!$fields{RELEASE} || !$fields{VERSION} || !$fields{NAME}) {
|
||||
Error("Error querying rpm file.");
|
||||
}
|
||||
|
||||
$fields{RELEASE}=$fields{RELEASE}+1;
|
||||
$fields{DISTRIBUTION}="Red Hat";
|
||||
|
||||
return %fields;
|
||||
}
|
||||
|
||||
# Unpack a rpm file.
|
||||
sub Unpack { my ($file)=@_;
|
||||
SafeSystem("(cd ..;rpm2cpio $file) | cpio --extract --make-directories --no-absolute-filenames",
|
||||
"Error unpacking $file\n");
|
||||
}
|
||||
|
||||
1
|
||||
@@ -1,65 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Package for converting from a tgz file.
|
||||
|
||||
# Query a tgz file for fields, and return a hash of the fields found.
|
||||
# Pass the filename of the tgz file to query.
|
||||
sub GetFields { my $file=shift;
|
||||
my %fields;
|
||||
|
||||
# Get basename of the filename.
|
||||
my ($basename)=('/'.$file)=~m#^/?.*/(.*?)$#;
|
||||
|
||||
# Strip out any tar extentions.
|
||||
$basename=~s/\.(tgz|tar\.gz)$//;
|
||||
|
||||
if ($basename=~m/(.*)-(.*)/ ne undef) {
|
||||
$fields{NAME}=$1;
|
||||
$fields{VERSION}=$2;
|
||||
}
|
||||
else {
|
||||
$fields{NAME}=$basename;
|
||||
$fields{VERSION}=1;
|
||||
}
|
||||
|
||||
$fields{ARCH}='i386';
|
||||
$fields{SUMMARY}='Converted Slackware tgz package';
|
||||
$fields{DESCRIPTION}=$fields{SUMMARY};
|
||||
$fields{COPYRIGHT}="unknown";
|
||||
$fields{RELEASE}=1;
|
||||
$fields{DISTRIBUTION}="Slackware";
|
||||
|
||||
# Now figure out the conffiles. Assume anything in etc/ is a conffile.
|
||||
# It's a little nasty to do it here, but it's much cleaner than waiting
|
||||
# until the tar file is unpacked and then doing it.
|
||||
$fields{CONFFILES}='';
|
||||
open (FILELIST,"tar zvtf $file | grep etc/ |") || Error("Getting filelist: $!");
|
||||
while (<FILELIST>) {
|
||||
# Make sure it's a normal file. This is looking at the
|
||||
# permissions, and making sure the first character is '-'.
|
||||
# Ie: -rw-r--r--
|
||||
if (m:^-:) {
|
||||
# Strip it down to the filename.
|
||||
m/^(.*) (.*)$/;
|
||||
$fields{CONFFILES}.="/$2\n";
|
||||
}
|
||||
}
|
||||
close FILELIST;
|
||||
|
||||
# Now get the whole filelist. We have to add leading /'s to the filenames.
|
||||
$fields{FILELIST}='';
|
||||
open (FILELIST, "tar ztf $file |");
|
||||
while (<FILELIST>) {
|
||||
$fields{FILELIST}.="/$_";
|
||||
}
|
||||
close FILELIST;
|
||||
|
||||
return %fields;
|
||||
}
|
||||
|
||||
# Handles unpacking of tgz's.
|
||||
sub Unpack { my ($file)=@_;
|
||||
SafeSystem ("(cd ..;cat $file) | tar zxpf -","Error unpacking $file\n");
|
||||
}
|
||||
|
||||
1
|
||||
4
lib/test
4
lib/test
@@ -1,4 +0,0 @@
|
||||
use Alien;
|
||||
use Fromslp;
|
||||
|
||||
%fields=From::slp::DecodeFooter(From::slp::GetFooter(shift));
|
||||
@@ -1 +0,0 @@
|
||||
#CONFFILES#
|
||||
@@ -1,54 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
#
|
||||
# This is a special rules files for handling alien or binary packages
|
||||
# Christoph Lameter, October 30, 1996
|
||||
|
||||
package=#NAME#
|
||||
|
||||
debian/build:
|
||||
$(checkdir)
|
||||
touch debian/build
|
||||
|
||||
clean:
|
||||
$(checkdir)
|
||||
-rm -f debian/build
|
||||
-rm -rf *~ debian/tmp debian/*~ debian/files*
|
||||
|
||||
binary-indep: checkroot debian/build
|
||||
$(checkdir)
|
||||
# There are no architecture-independent files to be uploaded
|
||||
# generated by this package. If there were any they would be
|
||||
# made here.
|
||||
|
||||
binary-arch: checkroot debian/build
|
||||
$(checkdir)
|
||||
-rm -rf debian/tmp
|
||||
# Install binary package
|
||||
install -d debian/tmp
|
||||
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
|
||||
#
|
||||
debstd
|
||||
dpkg-gencontrol
|
||||
dpkg --build debian/tmp ..
|
||||
|
||||
define checkdir
|
||||
test -f debian/rules
|
||||
endef
|
||||
|
||||
# Below here is fairly generic really
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
|
||||
build: debian/build
|
||||
|
||||
source diff:
|
||||
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
|
||||
|
||||
checkroot:
|
||||
$(checkdir)
|
||||
test root = "`whoami`"
|
||||
|
||||
.PHONY: binary binary-arch binary-indep clean checkroot
|
||||
86
lib/todeb.pl
86
lib/todeb.pl
@@ -1,86 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Package for converting to .deb file.
|
||||
|
||||
# Create debian/* files, either from a patch, or automatically.
|
||||
sub Convert { my ($workdir,%fields)=@_;
|
||||
if ($generate && !$single) {
|
||||
SafeSystem("cp -fa $workdir $workdir.orig", "Error creating $workdir.orig");
|
||||
}
|
||||
|
||||
# Make sure package name is all lower case.
|
||||
$fields{NAME}=lc($fields{NAME});
|
||||
|
||||
# Fix up the description field to Debian standards (indented at
|
||||
# least one space, no empty lines.)
|
||||
my $description=undef;
|
||||
foreach $line (split(/\n/,$fields{DESCRIPTION})) {
|
||||
$line=~s/\t/ /g; # change tabs to spaces.
|
||||
$line=~s/\s+$//g; # remove trailing whitespace.
|
||||
if (!$line) { # empty lines
|
||||
$line=" .";
|
||||
}
|
||||
else { # normal lines
|
||||
$line=" $line";
|
||||
}
|
||||
$description.=$line."\n";
|
||||
}
|
||||
chomp $description;
|
||||
$fields{DESCRIPTION}=$description."\n";
|
||||
|
||||
# Do the actual conversion here.
|
||||
mkdir "$fields{NAME}-$fields{VERSION}/debian",0755
|
||||
|| Error("Unable to make debian directory");
|
||||
$patchfile=GetPatch($fields{NAME}) if !$patchfile;
|
||||
if ($patchfile) {
|
||||
Patch($patchfile,$workdir);
|
||||
}
|
||||
else {
|
||||
AutoDebianize($workdir,%fields);
|
||||
}
|
||||
chmod 0755,"$workdir/debian/rules";
|
||||
|
||||
# Make the .orig directory if we were instructed to do so.
|
||||
if ($single) {
|
||||
print "Directory $workdir prepared.\n";
|
||||
}
|
||||
elsif ($generate) {
|
||||
print "Directories $workdir and $workdir.orig prepared.\n";
|
||||
}
|
||||
}
|
||||
|
||||
# Fill out templates to create debian/* files.
|
||||
# Pass it the work directory, and the type of package we are debianizing.
|
||||
sub AutoDebianize { my ($workdir,%fields)=@_;
|
||||
Status("Automatic package debianization");
|
||||
|
||||
# Generate some more fields we need.
|
||||
$fields{DATE}=GetDate();
|
||||
$fields{EMAIL}=GetEmail();
|
||||
$fields{USERNAME}=GetUserName();
|
||||
|
||||
# Fill out all the templates.
|
||||
foreach $fn (glob("$libdir/to-$desttype/$filetype/*")) {
|
||||
my $destfn=$fn;
|
||||
$destfn=~s#^$libdir/to-$desttype/$filetype/##;
|
||||
FillOutTemplate($fn,"$workdir/debian/$destfn",%fields);
|
||||
}
|
||||
}
|
||||
|
||||
# Passed the available info about the package in a hash, return the name of
|
||||
# the debian package that will be made.
|
||||
sub GetPackageName { my %fields=@_;
|
||||
return "$fields{NAME}_$fields{VERSION}-$fields{RELEASE}_$fields{ARCH}.deb";
|
||||
}
|
||||
|
||||
# Build the debian package.
|
||||
sub Build {
|
||||
SafeSystem("debian/rules binary","Package build failed.\n");
|
||||
}
|
||||
|
||||
# Install the debian package that is passed.
|
||||
sub Install { my $package=shift;
|
||||
SafeSystem("dpkg -i $package");
|
||||
}
|
||||
|
||||
1
|
||||
72
lib/torpm.pl
72
lib/torpm.pl
@@ -1,72 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Package for converting to .rpm file.
|
||||
|
||||
# Generate the spec file.
|
||||
sub Convert { my ($workdir,%fields)=@_;
|
||||
Status("Automatic spec file generation");
|
||||
|
||||
# Create some more fields we will need.
|
||||
my $pwd=`pwd`;
|
||||
chomp $pwd;
|
||||
$fields{BUILDROOT}="$pwd/$workdir"; # must be absolute filename.
|
||||
|
||||
# Remove directories from the filelist. Place %config in front of files
|
||||
# that are conffiles.
|
||||
my @conffiles=split(/\n/,$fields{CONFFILES});
|
||||
my $filelist;
|
||||
foreach $fn (split(/\n/,$fields{FILELIST})) {
|
||||
if ($fn=~m:/$: eq undef) { # not a directory
|
||||
if (grep(m:^$fn$:,@conffiles)) { # it's a conffile
|
||||
$filelist.="%config $fn\n";
|
||||
}
|
||||
else { # normal file
|
||||
$filelist.="$fn\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$fields{FILELIST}=$filelist;
|
||||
|
||||
FillOutTemplate("$libdir/to-$desttype/$filetype/spec",
|
||||
"$workdir/$fields{NAME}-$fields{VERSION}-$fields{RELEASE}.spec",%fields);
|
||||
|
||||
if ($generate) {
|
||||
print "Directory $workdir prepared.\n";
|
||||
}
|
||||
}
|
||||
|
||||
# Passed the available info about the package in a hash, return the name of
|
||||
# the rpm package that will be made.
|
||||
sub GetPackageName { my %fields=@_;
|
||||
|
||||
# Ask rpm how it's set up. We want to know what architecture it will output,
|
||||
# and where it will place rpms.
|
||||
my $rpmarch, $rpmdir;
|
||||
foreach (`rpm --showrc`) {
|
||||
chomp;
|
||||
if (/^build arch\s+:\s(.*)$/) {
|
||||
$rpmarch=$1;
|
||||
}
|
||||
elsif (/^rpmdir\s+:\s(.*)$/) {
|
||||
$rpmdir=$1;
|
||||
}
|
||||
}
|
||||
if (!$rpmarch || !$rpmdir) {
|
||||
Error("rpm --showrc failed.");
|
||||
}
|
||||
|
||||
return "$rpmdir/$rpmarch/$fields{NAME}-$fields{VERSION}-$fields{RELEASE}.$rpmarch.rpm";
|
||||
}
|
||||
|
||||
# Build a rpm file.
|
||||
sub Build { my (%fields)=@_;
|
||||
SafeSystem("rpm -bb $ENV{RPMBUILDOPT} $fields{NAME}-$fields{VERSION}-$fields{RELEASE}.spec",
|
||||
"Error putting together the RPM package.\n");
|
||||
}
|
||||
|
||||
# Install the passed rpm file.
|
||||
sub Install { my $package=shift;
|
||||
SafeSystem("rpm -ivh $ENV{RPMINSTALLOPT} $package");
|
||||
}
|
||||
|
||||
1
|
||||
27
lib/totgz.pl
27
lib/totgz.pl
@@ -1,27 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Package for converting to .tgz file.
|
||||
|
||||
sub Convert { my ($workdir,%fields)=@_;
|
||||
# Nothing to do.
|
||||
}
|
||||
|
||||
# Passed the available info about the package in a hash, return the name of
|
||||
# the tgz package that will be made.
|
||||
sub GetPackageName { my %fields=@_;
|
||||
return "$fields{NAME}.tgz";
|
||||
}
|
||||
|
||||
# Build a tgz file.
|
||||
sub Build { my (%fields)=@_;
|
||||
SafeSystem("tar czf ../".GetPackageName(%fields)." .");
|
||||
}
|
||||
|
||||
# Install the passed tgz file.
|
||||
sub Install { my $package=shift;
|
||||
# Not yet supported. (I really don't like unpacking tgz files into the
|
||||
# root directory. :-)
|
||||
print STDERR "Sorry, installing generated .tgz files in not yet supported.\n";
|
||||
}
|
||||
|
||||
1
|
||||
Reference in New Issue
Block a user