1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725
|
#!/usr/bin/perl
#
# dh_make - Script to Debianize a source archive
#
use Getopt::Long;
use Cwd;
use strict;
#Getopt::Long::Configure ("bundling");
#Getopt::Long::Configure ("bundling_override");
# Turns off autoabbrev to avoid mistakes with cdbs and copyright options.
$Getopt::Long::autoabbrev = 0;
# Some important parameters
our $DHLIB="/usr/share/debhelper/dh_make";
our $POLICY_VERSION="3.7.3";
our $DH_MAKE_VERSION="0.46";
my %PACKAGE_TYPES = ( 's' => 'Single', 'l' => 'Library', 'm' => 'Multi-Binary',
'k' => 'Kernel Module', 'b' => 'cdbs');
our $DASHLINE="";
our $license="";
our $dpatch="";
our $username="";
our $package_name="";
our $cap_package_name="";
our $version="";
our $fullname = "";
our $source_file="";
our $debian_native = 0;
our $copy_dir_for_orig = 0;
our $package_type="";
our $CHANGELOG="";
our $PRESERVE="";
our $add_missing = 0;
our $custom = "";
our $no_defaults = 0;
our $overlay = "";
our $forced_package_name="";
our @filenames;
our $filename;
our ($email, $date);
sub process_file(@)
{
my ($infile, $outfile) = @_;
my $line;
if ( $main::overlay eq "" )
{
if ( $main::add_missing && -f $outfile) {
print "File $outfile exists, skipping.\n";
return;
}
}
open IN, "<$infile" or die "Unable to open template file $infile for reading: $! \n";
open OUT, ">$outfile" or die "Unable to open file $outfile for writing: $! \n";
while (defined($line = <IN>))
{
$line =~ s/#PACKAGE#/$main::package_name/g;
$line =~ s/#UCPACKAGE#/$main::uc_package_name/g;
$line =~ s/#VERSION#/$main::version/g;
$line =~ s/#EMAIL#/$main::email/g;
$line =~ s/#DATE#/$main::date/g;
$line =~ s/#SHORTDATE#/$main::shortdate/g;
$line =~ s/#YEAR#/$main::year/g;
$line =~ s/#CHANGELOGS#/$main::CHANGELOG/g;
$line =~ s/#PRESERVE#/ $main::PRESERVE/g;
$line =~ s/#CONFIG_STATUS#/$main::CONFIG_STATUS/g;
$line =~ s/#CONFIGURE#/$main::CONFIGURE/g;
$line =~ s/#CONFIGURE_STAMP#/$main::CONFIGURE_STAMP/g;
$line =~ s/#DPKG_ARCH#/$main::DPKG_ARCH/g;
$line =~ s/#INSTALL#/$main::INSTALL/g;
$line =~ s/#CLEAN#/$main::CLEAN/g;
$line =~ s/#USERNAME#/$main::username/g;
$line =~ s/#POLICY#/$main::POLICY_VERSION/g;
$line =~ s/#DASHLINE#/$main::DASHLINE/g;
$line =~ s/#PHONY_CONFIGURE#/$main::PHONY_CONFIGURE/g;
$line =~ s/#CDBS_CLASS#/$main::CDBS_CLASS/g;
$line =~ s/#PATCH_CLASS#/$main::PATCH_CLASS/g;
$line =~ s/#PATCH_CLEAN#/$main::PATCH_CLEAN/g;
$line =~ s/#PATCH_STAMP#/$main::PATCH_STAMP/g;
$line =~ s/#BUILD_DEPS#/$main::BUILD_DEPS/g;
print OUT $line;
}
close IN;
close OUT;
}
sub show_version
{
print "dh_make - Script to Debianize a regular source archive, version $main::DH_MAKE_VERSION\n\n";
print "Copyright (C) 1998-2008 Craig Small <csmall\@debian.org>\n";
print "This is free software; see the source for copying conditions. There is NO\n";
print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
}
sub show_help
{
show_version();
print <<EOF
Usage: dh_make [options]
-c, --copyright <type> use <type> of license in copyright file
(gpl|lgpl|artistic|bsd)
--dpatch using dpatch to maintain patches
-e, --email <address> use <address> as the maintainer e-mail address
-n, --native the program is Debian native, don\'t generate .orig
-f, --file <file> specify file to use as the original source archive
-r, --createorig make a copy for the original source archive
-s, --single set package class to single
-m, --multi set package class to multiple binary
-l, --library set package class to library
-k, --kmod set package class to kernel module
-b, --cdbs set package class to cdbs
-a, --addmissing reprocess package and add missing files
-t, --templates <dir> apply customizing templates in <dir>
-d --defaultless skip the default debian and package class templates
-o, --overlay <dir> reprocess package using template in <dir>
-p, --packagename <name> force package name to be <name>
-h, --help display this help screen and exit
-v, --version show the version and exit
By Craig Small <csmall\@debian.org>
Based on deb-make by Christoph Lameter <clameter\@debian.org>.
Custom template support by Bruce Sass <bmsass\@shaw.ca>.
EOF
}
sub parse_args
{
my ($dohelp,$doversion, $single,$multi,$library, $kmod,$cdbs );
if (GetOptions('copyright|c=s' => \$main::license,
'dpatch' => \$dpatch,
'email|e=s' => \$main::email,
'file|f=s' => \$main::source_file,
'createorig|r' => \$main::copy_dir_for_orig,
'help|h' => \$dohelp,
'version|v' => \$doversion,
'native|n' => \$main::debian_native,
'single|s' => \$single,
'multi|m' => \$multi,
'library|l' => \$library,
'kmod|k' => \$kmod,
'cdbs|b' => \$cdbs,
'addmissing|a' => \$main::add_missing,
'templates|t=s' => \$main::custom,
'defaultless|d' => \$main::no_defaults,
'overlay|o=s' => \$main::overlay,
'packagename|p=s' => \$main::forced_package_name
) == 0)
{
show_help();
exit;
}
# Check for extra options, should be none!
if ($#ARGV != -1)
{
print "Extra parameters on command line\n";
show_help();
exit;
}
if ($doversion)
{
show_version();
exit;
}
if ($dohelp)
{
show_help();
exit;
}
if ($single)
{
$main::package_type = 's';
}
if ($multi)
{
$main::package_type = 'm';
}
if ($library)
{
$main::package_type = 'l';
}
if ($kmod)
{
$main::package_type = 'k';
}
if ($cdbs)
{
$main::package_type = 'b';
}
#if ($defaultless)
#{
# $main::no_defaults = 1;
#}
$main::license = lc $main::license;
if ($main::license ne "" && !($main::license =~ /^(gpl|lgpl|artistic|bsd|blank)$/)) {
print "Copyright type \"$main::license\" is not gpl, lgpl, artistic or bsd\n";
exit;
}
}
sub get_username
{
my $tmpusername = '';
if (exists($ENV{'DEBFULLNAME'})) {
$tmpusername = $ENV{'DEBFULLNAME'};
}
return $tmpusername if ($tmpusername ne "");
if (-x '/usr/bin/getent')
{
$tmpusername = `/usr/bin/getent passwd $ENV{LOGNAME}|awk -F: '\{ print \$5; \}' | cut -f1 -d,`;
}
chomp($tmpusername);
return $tmpusername if ($tmpusername ne "");
$tmpusername =`awk -F: -vUSER=$ENV{LOGNAME} '\$1 == USER \{ print \$5; \}' /etc/passwd | cut -f1 -d,`;
chomp($tmpusername);
return $tmpusername if ($tmpusername ne "");
if (-x '/usr/bin/ypmatch')
{
$tmpusername=`ypmatch $ENV{LOGNAME} passwd.byname|awk -F: '\{ print \$5; \}' | cut -f1 -d,`;
}
chomp($tmpusername);
return $tmpusername if ($tmpusername ne "");
if (-x '/usr/bin/ldapsearch')
{
$tmpusername = [map {/^(?:gecos|cn): (.*)/} `ldapsearch -Q -LLL uid=$ENV{LOGNAME} gecos cn`]->[0];
}
chomp($tmpusername);
return $tmpusername if ($tmpusername ne "");
return "unknown";
}
sub get_email()
{
if ($ENV{DEBEMAIL} )
{
return $ENV{DEBEMAIL};
}
if ($ENV{EMAIL} )
{
return $ENV{EMAIL};
}
if (-x '/usr/bin/ldapsearch')
{
my $mail;
$mail = [map {/^mail: (.*)/ && $1} `ldapsearch -Q -LLL uid=$ENV{LOGNAME} mail`]->[0];
return $mail if $mail;
}
if ($ENV{LOGNAME} )
{
my $mailhost;
if ( -e '/etc/mailname'){
chomp($mailhost = `cat /etc/mailname`);
} else {
$mailhost='unknown';
}
return ($ENV{LOGNAME} . '@' . $mailhost);
}
}
sub get_package
{
my $pwd = $ENV{PWD};
if (( ($main::forced_package_name) &&
($pwd =~ /.*\/($main::forced_package_name)-([0-9][0-9a-zA-Z+.~-]*)$/)
) || (
($pwd =~ /.*\/(.*)-([0-9][0-9a-zA-Z+.~-]*)$/)
))
{
if ($main::forced_package_name) {
$main::package_name = $main::forced_package_name;
} else {
$main::package_name = $1;
}
$main::uc_package_name = uc $main::package_name;
$main::version = $2;
# Fullname stays as the original dir
$main::fullname = $1 . "-" . $2;
} else {
print <<"EOF";
The directory name must be <package>-<version> for dh_make to work!
I cannot understand the directory name or you have an invalid directory name!
Your current directory is $pwd, perhaps you could try going to
directory where the sources are?
Please note that this change is necessary ONLY during the initial
Debianization with dh_make. When building the package, dpkg-source
will gracefully handle almost any upstream tarball.
EOF
exit 1;
}
if (! ($main::package_name =~ /^[a-z0-9+.-]+$/)) {
print <<"EOF";
Package name "$main::package_name" is not in a valid format.
Debian policy manual states:
"Package names must only consist of lower case letters, digits (0-9),
plus (+) or minus (-) signs, and periods (.)"
EOF
exit 1;
}
if ( ($main::package_name =~ /^[a-z0-9+.-]$/)) {
print <<"EOF";
Package name "$main::package_name" is not in a valid format.
You cannot create single-letter package names.
EOF
exit 1;
}
}
sub get_date
{
my $tmpdate;
if (-x "/bin/date")
{
$tmpdate = `/bin/date -R`;
chomp($tmpdate);
return $tmpdate;
} else {
die "Unable to find date program in /bin!\n";
}
}
sub print_confirmation
{
# Print what we have found
print "Maintainer name : $username\n";
print "Email-Address : $email \n";
print "Date : $date\n";
print "Package Name : $package_name\n";
print "Version : $version\n";
print "License : $license";
print 'blank' if $license eq '';
print "\n";
print "Using dpatch : ",($dpatch?"yes":"no"),"\n";
print "Type of Package : ";
if (exists $PACKAGE_TYPES{$package_type})
{
print $PACKAGE_TYPES{$package_type};
} else {
print 'unknown';
}
if ( $custom ne "" )
{
print "\nCustom template : $custom";
}
if ( $overlay ne "" )
{
print " (overlay)";
}
if ( $no_defaults )
{
print "\nDefault debian and package class templates will not be applied.";
}
print "\nHit <enter> to confirm: ";
my $dummy = <STDIN>;
}
$username = get_username();
$email = get_email();
$date = get_date();
our $shortdate = `LC_ALL=C date '+%B %e, %Y'`;
chomp $shortdate;
our $year = `LC_ALL=C date '+%Y'`;
chomp $year;
parse_args();
if ( ! $overlay eq "" )
{
#setup for overlay mode
$no_defaults = 1;
$add_missing = 1;
$custom = $overlay;
}
get_package();
# Generate a line of dashes, which is as long as '#PACKAGE# for Debian'.
for (my $i=0; $i<length("$main::package_name for Debian"); $i++)
{
$DASHLINE = $DASHLINE . '-';
}
if ( ! $no_defaults )
{
while ($package_type eq "")
{
print "\nType of package: single binary, multiple binary, library, kernel module or cdbs?\n [s/m/l/k/b] ";
my $type = <STDIN>;
chomp($type);
print "\n";
$type = lc($type);
$main::package_type = 's' if $type eq 's';
$main::package_type = 'm' if $type eq 'm';
$main::package_type = 'l' if $type eq 'l';
$main::package_type = 'k' if $type eq 'k';
$main::package_type = 'b' if $type eq 'b';
}
}
# Debian native packages default to GPL, but it can be overwritten
if ($debian_native && $main::license eq '')
{
$main::license = 'gpl';
}
print_confirmation;
if (! $debian_native)
{
if ( -f "../$package_name\_$version.orig.tar.gz")
{
print "Skipping creating ../$package_name\_$version.orig.tar.gz because it already exists\n";
} else {
if ($source_file)
{
if (-f $source_file)
{
if ($source_file =~ /gz$/ )
{
system('cp', '-a', "$source_file", "../$package_name\_$version.orig.tar.gz");
} elsif ($source_file =~ /bz2$/ )
{
if ( (-x '/bin/bzip2' or -x '/usr/bin/bzip2') &&
(-x '/bin/gzip' or -x '/usr/bin/gzip'))
{
system("bzip2 -cd $source_file | gzip > ../$package_name\_$version.orig.tar.gz");
} else {
die('Source file is a bz2 but bzip2 or gzip not available');
}
}
} else {
print "Source archive you specified ( $source_file ) was not found!\n";
exit 1;
}
} else {
if (-d "../$fullname.orig")
{
print "Skipping copying to $fullname.orig since $fullname.orig exists.\n";
} else {
if ( -f "../$fullname.orig.tar.gz")
{
print "Skipping copying to $fullname.orig since $fullname.orig.tar.gz exists.\n";
} elsif ($copy_dir_for_orig) {
system('cp', '-a', "../$fullname", "../$fullname.orig");
} else {
print "Could not find $package_name\_$version.orig.tar.gz\n";
print "Either specify an alternate file to use with -f,\n";
print "or add --createorig to create one.\n";
exit 1;
}
}
}
}
}
# Figure out where documentation is
our @DOCS= split / |\n/, `ls -1 N[Ee][Ww][Ss] *[Ff][Aa][Qq]* *.[Tt][Xx][Tt] README* *.README [rR]eadme* *.[rR]eadme [Bb][Uu][Gg][Ss] *[tT][oO][dD][oO]* 2>/dev/null | grep -v '^CMakeList.txt'`;
# What are our info files
our @INFOS= split / |\n/, `find . -regex '.*\\.info\\(-[0-9]+\\)?'`;
# Figure out where is the first changelog, assign other similar files to docs
my @changelogs= split / |\n/, `ls *[cC][hH][aA][nN][gG][eE][lL][oO][gG]* [cC][hH][aA][nN][gG][eE][sS]* 2>/dev/null`;
$CHANGELOG = $changelogs[0] if ($#changelogs != -1);
shift @changelogs;
@DOCS = (@DOCS,@changelogs);
# Are there any .orig files in the upstream sources
my @ORIG= split /[ \n]/, `find . -name '\*.orig'`;
my $orig;
foreach $orig (@ORIG)
{
$PRESERVE="$PRESERVE --exclude $orig";
}
our ($CONFIG_STATUS, $CONFIGURE_STAMP, $PHONY_CONFIGURE, $CONFIGURE, $DPKG_ARCH, $INSTALL, $CLEAN, $CDBS_CLASS );
our $BUILD_DEPS = 'debhelper (>= 7)';
if ($package_type eq "b") {
$BUILD_DEPS = 'cdbs, '.$BUILD_DEPS;
}
our ($PATCH_CLASS,$PATCH_STAMP,$PATCH_CLEAN);
if ($dpatch) {
if ($package_type eq "b") {
$PATCH_CLASS = "include /usr/share/cdbs/1/rules/dpatch.mk";
}
else {
$PATCH_CLASS = "include /usr/share/dpatch/dpatch.make";
$PATCH_STAMP = "patch-stamp";
$PATCH_CLEAN = "unpatch";
$BUILD_DEPS = 'dpatch, '.$BUILD_DEPS;
}
}
# Setup debian/rules
if (-x "./configure" )
{
$CDBS_CLASS="include /usr/share/cdbs/1/class/autotools.mk";
$CONFIG_STATUS="config.status";
$CONFIGURE_STAMP='';
$PHONY_CONFIGURE='';
$CONFIGURE="config.status: configure\n".
"\tdh_testdir\n".
"\t# Add here commands to configure the package.\n".
"ifneq \"\$(wildcard /usr/share/misc/config.sub)\" \"\"\n".
"\tcp -f /usr/share/misc/config.sub config.sub\n".
"endif\n".
"ifneq \"\$(wildcard /usr/share/misc/config.guess)\" \"\"\n".
"\tcp -f /usr/share/misc/config.guess config.guess\n".
"endif\n".
"\t".'./configure $(CROSS) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"'."\n";
$DPKG_ARCH="# These are used for cross-compiling and for saving the configure script\n".
"# from having to guess our platform (since we know it already)\n".
'DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)'."\n".
'DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)'."\n".
'ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))'."\n".
'CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)'."\n".
'else'."\n".
'CROSS= --build $(DEB_BUILD_GNU_TYPE)'."\n".
'endif'."\n";
# If it is automaked, use DESTDIR insteadof prefix
if ( -f 'Makefile.am' ) {
# If it is a library then install into tmp
if ( $package_type eq "l") {
$INSTALL="\$(MAKE) DESTDIR=\$(CURDIR)/debian/tmp install";
} else {
$INSTALL="\$(MAKE) DESTDIR=\$(CURDIR)/debian/$package_name install";
}
} else {
if ( $package_type eq "l") {
$INSTALL="\$(MAKE) prefix=\$(CURDIR)/debian/tmp/usr install";
} else {
$INSTALL="\$(MAKE) prefix=\$(CURDIR)/debian/$package_name/usr install";
}
}
$CLEAN="[ ! -f Makefile ] || \$(MAKE) distclean\n".
"\trm -f config.sub config.guess";
$BUILD_DEPS .= ', autotools-dev';
} else {
if (! -f 'Makefile' && ! -f 'makefile' && ! -f 'GNUmakefile')
{
print "Currently there is no top level Makefile. This may require additional tuning.\n";
}
$CDBS_CLASS="include /usr/share/cdbs/1/class/makefile.mk";
$CONFIGURE_STAMP='configure-stamp';
$CONFIG_STATUS='';
$CONFIGURE="configure: configure-stamp\n".
"configure-stamp:\n".
"\tdh_testdir\n".
"\t# Add here commands to configure the package.\n\n".
"\ttouch configure-stamp\n";
$PHONY_CONFIGURE='configure';
$DPKG_ARCH='';
if ($package_type eq "l") {
$INSTALL="\$(MAKE) DESTDIR=\$(CURDIR)/debian/tmp install";
} else {
$INSTALL="\$(MAKE) DESTDIR=\$(CURDIR)/debian/$package_name install";
}
$CLEAN='$(MAKE) clean';
}
if ($package_type eq "k") {
$BUILD_DEPS .= ', bzip2';
}
# Customize files
if ( $add_missing )
{
if ( ! -d 'debian' )
{
die "--addmissing or --overlay flag used but cannot find debian subdirectory\n";
}
} else {
if ( ! -d 'debian')
{
mkdir 'debian', 0755 or die "Unable to make debian subdirectory: $! \n";
} else {
print "You already have a debian/ subdirectory in the source tree.\n";
print "dh_make will not try to overwrite anything.\n";
exit 1;
}
}
chdir 'debian' or die "Unable to chdir to debian subdirectory: $! \n";
if ( ! -d $DHLIB )
{
die "Unable to find dh_make's template directory: $! \n";
}
if ( ! $no_defaults )
{
# General Files
@filenames= split / |\n/, `(cd $DHLIB/debian && ls)`;
foreach $filename (@filenames)
{
process_file("$DHLIB/debian/$filename", $filename);
}
# Copyright file
if ($license eq '')
{
process_file("$DHLIB/licenses/blank", "copyright");
} else {
if ( -r "$DHLIB/licenses/$license" )
{
process_file("$DHLIB/licenses/$license", "copyright");
} else {
die "Unable to find copyright template file $DHLIB/licenses/$license";
}
}
# Remove the README if a kernel package, we use the specific one
if ( $package_type eq 'k')
{
unlink('README.Debian');
}
# Special Files
@filenames = split / |\n/, `(cd $DHLIB/debian$package_type && ls)`;
foreach $filename (@filenames)
{
process_file("$DHLIB/debian$package_type/$filename", $filename);
}
}
# Custom template
if ( $custom ne "" )
{
if ( -d $custom )
{
@filenames = split /[\n]/, `(cd $custom && ls)`;
foreach $filename (@filenames)
{
process_file("$custom/$filename", $filename);
}
} else {
print "Unable to find the customization directory, $custom\n";
}
}
if ( -f "docs" )
{
print "File docs already exists, skipping.\n";
} else {
my $doc;
open (DOCSFILE,">docs");
foreach $doc (@DOCS)
{
print DOCSFILE "$doc\n";
}
close (DOCSFILE);
}
if ( -f "info" )
{
print "File info already exists, skipping.\n";
} else {
if ($#INFOS > -1 )
{
my $info;
open (INFOFILE,">info");
foreach $info (@INFOS)
{
$info =~ s/^\.\///;
print INFOFILE "$info\n";
}
close (INFOFILE);
}
}
if ( ! $no_defaults )
{
if ($debian_native)
{
@filenames= split / |\n/, `(cd $DHLIB/native;ls)`;
foreach $filename (@filenames)
{
process_file("$DHLIB/native/$filename", $filename);
}
}
}
@filenames = split / |\n/, `ls package* 2>/dev/null`;
if ($#filenames != -1)
{
foreach $filename (@filenames)
{
my $oldname = $filename;
$filename =~ s/^package/$package_name/;
if ( -f $filename)
{
print "File $filename already exists, skipping.\n";
} else {
system('mv', $oldname, $filename);
}
}
}
chmod 0755, 'rules';
if ($CONFIG_STATUS ne "")
{
print "Done. Please edit the files in the debian/ subdirectory now. $package_name\n";
print "uses a configure script, so you probably don't have to edit the Makefiles.\n";
} else {
print "Done. Please edit the files in the debian/ subdirectory now. You should also\n";
print "check that the $package_name Makefiles install into \$DESTDIR and not in / .\n";
}
if ($package_type eq 'l')
{
print "Make sure you change the package name from $package_name"."BROKEN to something\n".
"else, such as $package_name"."1 in the debian/control file.\n";
}
exit 0;
|