renamed a method, plus, building now fully works for deb's

This commit is contained in:
joey
2000-04-21 06:40:08 +00:00
parent eae03ee44d
commit aa4c9a8b71
4 changed files with 47 additions and 13 deletions

View File

@@ -160,7 +160,8 @@ sub init {}
=item install
Simply installs the package. This has to be overridden in child classes.
Simply installs a package file. The filename is passed on standard input.
This has to be overridden in child classes.
=cut
@@ -168,7 +169,7 @@ sub install {
my $this=shift;
}
=item read_file
=item scan
This method looks at the actual package file the package represents, and
populates all the fields it can from that package file. The filename field
@@ -179,7 +180,7 @@ something.)
=cut
sub read_file {
sub scan {
my $this=shift;
my $file=$this->filename;
@@ -221,6 +222,18 @@ to produce a suitable build tree.
sub prep {}
=item build
This method takes a prepped build tree, and simply builds a package from
it. It should put the package in the current directory, and should return
the filename of the generated package.
(This is just a stub method that all child classes should override.)
=cut
sub build {}
=item DESTROY
When an object is destroyed, it cleans some stuff up. In particular, if the

View File

@@ -52,24 +52,25 @@ sub init {
=item install
Install a deb with dpkg.
Install a deb with dpkg. Pass in the filename of the deb to install.
=cut
sub install {
my $this=shift;
my $deb=shift;
system("dpkg --no-force-overwrite -i ".$this->filename) &&
system("dpkg --no-force-overwrite -i $deb") &&
die "Unable to install: $!";
}
=item read_file
=item scan
Implement the read_file method to read a deb file.
Implement the scan method to read a deb file.
=cut
sub read_file {
sub scan {
my $this=shift;
$this->SUPER::read_file(@_);
my $file=$this->filename;
@@ -196,7 +197,7 @@ file.
sub prep {
my $this=shift;
my $dir=$this->unpacked_tree;
my $dir=$this->unpacked_tree || die "The package must be unpacked first!";
mkdir "$dir/debian", 0755 ||
die "mkdir $dir/debian failed: $!";
@@ -239,7 +240,7 @@ sub prep {
print OUT "Depends: \${shlibs:Depends}\n";
print OUT "Description: ".$this->summary."\n";
print OUT $this->description."\n";
print OUT ".\n"
print OUT ".\n";
print OUT " (Converted from a .".$this->origformat." package by alien.)\n";
close OUT;
@@ -322,6 +323,22 @@ EOF
}
}
=item build
Build a .deb
=cut
sub build {
my $this=shift;
chdir $this->unpacked_tree;
system("debian/rules binary") && die "package build failed: $!";
chdir "..";
return $this->name."_".$this->version."-".$this->release."_".$this->arch.".deb";
}
=item package
Set/get package name.
@@ -498,9 +515,11 @@ sub username {
$username=~s/,.*//g;
# The ultimate fallback.
if (!$username) {
if ($username eq '') {
$username=$login;
}
return $username;
}
=head1 AUTHOR

View File

@@ -37,8 +37,9 @@ it are passed to rpm on its command line.
sub install {
my $this=shift;
my $rpm=shift;
system("rpm -ivh $ENV{RPMINSTALLOPT} ".$this->filename) &&
system("rpm -ivh $ENV{RPMINSTALLOPT} $rpm") &&
die "Unable to install: $!";
}

3
debian/changelog vendored
View File

@@ -10,7 +10,7 @@ alien (6.99) unstable; urgency=low
one:
perl -e 'use Alien::Package::Deb; use Alien::Package::Rpm; \
$p=Alien::Package::Rpm->new(filename => shift);
$p->read_file; $p->unpack;
$p->scan; $p->unpack;
bless($p, "Alien::Package::Deb");
$p->prep; $p->build;'
* Almost every line of code has been rewritten.
@@ -19,6 +19,7 @@ alien (6.99) unstable; urgency=low
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.
* Usernames are now looked up the way POSIX intended.
-- Joey Hess <joeyh@debian.org> Thu, 20 Apr 2000 18:52:41 -0700