191
Adds a populated debian directory the unpacked package tree, making it
192
ready for building. This can either be done automatically, or via a patch
199
my $dir=$this->unpacked_tree;
201
mkdir "$dir/debian", 0755 ||
202
die "mkdir $dir/debian failed: $!";
204
# Use a patch file to debianize?
205
if (defined $this->patchfile) {
206
# The -f passed to zcat makes it pass uncompressed files
207
# through without error.
208
system("zcat -f ".$this->patchfile." | (cd $dir; patch -p1)") ||
209
die "patch error: $!";
210
# Look for .rej files.
211
die "patch failed with .rej files; giving up"
212
if `find $dir -name "*.rej"`;
213
system('find . -name \'*.orig\' -exec rm {} \\;');
214
chmod 0755,"$dir/debian/rules";
218
# Automatic debianization.
220
open (OUT, ">$dir/debian/changelog") || die "$dir/debian/changelog: $!";
221
print OUT $this->name." (".$this->version."-".$this->release.") experimental; urgency=low\n";
223
print OUT " * Converted from .".$this->origformat." format to .deb\n";
225
print OUT " -- ".$this->username." <".$this->email."> ".$this->date."\n";
227
print OUT $this->changelogtext."\n";
231
open (OUT, ">$dir/debian/control") || die "$dir/debian/control: $!";
232
print OUT "Source: ".$this->name."\n";
233
print OUT "Section: alien\n";
234
print OUT "Priority: extra\n";
235
print OUT "Maintainer: ".$this->username." <".$this->email.">\n";
237
print OUT "Package: ".$this->name."\n";
238
print OUT "Architecture: ".$this->arch."\n";
239
print OUT "Depends: \${shlibs:Depends}\n";
240
print OUT "Description: ".$this->summary."\n";
241
print OUT $this->description."\n";
243
print OUT " (Converted from a .".$this->origformat." package by alien.)\n";
247
open (OUT, ">$dir/debian/copyright") || die "$dir/debian/copyright: $!";
248
print OUT "This package was debianized by the alien program by converting\n";
249
print OUT "a binary .".$this->origformat." package on ".$this->date."\n";
251
print OUT "Copyright: ".$this->copyright."\n";
253
print OUT "Information from the binary package:\n";
254
print OUT $this->binary_info."\n";
258
my @conffiles=@{$this->conffiles};
260
open (OUT, ">$dir/debian/conffiles") || die "$dir/debian/conffiles: $!";
261
print OUT join("\n", @conffiles)."\n";
265
# A minimal rules file.
266
open (OUT, ">$dir/debian/rules") || die "$dir/debian/rules: $!";
269
# debian/rules for alien
271
# Uncomment this to turn on verbose mode.
289
cp -a `ls |grep -v debian` debian/tmp
291
# If you need to move files around in debian/tmp or do some
292
# binary patching ... Insert it here
307
binary: binary-indep binary-arch
308
.PHONY: build clean binary-indep binary-arch binary
311
chmod 0755,"$dir/debian/rules";
314
foreach my $script (qw{postinst postrm preinst prerm}) {
315
my $data=$this->$script();
316
next unless defined $data;
317
next if $data =~ m/^\s*$/;
318
open (OUT,">$dir/debian/$script") ||
319
die "$dir/debian/$script: $!";
189
327
Set/get package name.
445
Returns the date, in rfc822 format.
455
die "822-date did not return a valid result. You probably need to install the dpkg-dev debian package";
463
Returns an email address for the current user.
470
return $ENV{EMAIL} if exists $ENV{EMAIL};
472
my $login = getlogin || (getpwuid($<))[0] || $ENV{USER};
473
open (MAILNAME,"</etc/mailname");
474
my $mailname=<MAILNAME>;
478
$mailname=`hostname -f`;
481
return "$login\@$mailname";
486
Returns the user name of the real uid.
494
my $login = getlogin || (getpwuid($<))[0] || $ENV{USER};
495
(undef, undef, undef, undef, undef, undef, $username) = getpwnam($login);
497
# Remove GECOS fields from username.
500
# The ultimate fallback.
307
508
Joey Hess <joey@kitenet.net>