From: Raphael Hertzog Date: Sun, 24 Feb 2008 21:16:30 +0000 (+0100) Subject: dpkg-source: use the new Dpkg::Source::Package object X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1d42d03488da0653ec712589758a3e37c475534;p=dpkg dpkg-source: use the new Dpkg::Source::Package object * scripts/dpkg-source.pl: Major restructuring of the script. It's now based on the Dpkg::Source::Package object and its derived classes. This was the last big step of cleanup. The script is now less than 500 lines compared to more than 1300 not so long ago... --- diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl index 593370c5..7e8cee37 100755 --- a/scripts/dpkg-source.pl +++ b/scripts/dpkg-source.pl @@ -6,7 +6,6 @@ use warnings; use Dpkg; use Dpkg::Gettext; -use Dpkg::Checksums; use Dpkg::ErrorHandling qw(warning warnerror error failure unknown internerr syserr subprocerr usageerr $warnable_error $quiet_warnings); @@ -14,29 +13,24 @@ use Dpkg::Arch qw(debarch_eq); use Dpkg::Deps qw(@src_dep_fields %dep_field_type); use Dpkg::Fields qw(:list capit); use Dpkg::Compression; -use Dpkg::Cdata; use Dpkg::Control; use Dpkg::Substvars; use Dpkg::Version qw(check_version); use Dpkg::Vars; use Dpkg::Changelog qw(parse_changelog); use Dpkg::Source::Compressor; -use Dpkg::Source::Archive; -use Dpkg::Source::Patch; -use Dpkg::IPC; +use Dpkg::Source::Package; -my @filesinarchive; -my %dirincluded; -my %notfileobject; -my $fn; -my $ur; +use POSIX; +use English; + +textdomain("dpkg-dev"); my $varlistfile; my $controlfile; my $changelogfile; my $changelogformat; -our $diff_ignore_regexp = ''; my $diff_ignore_default_regexp = ' # Ignore general backup files (?:^|/).*~$| @@ -87,178 +81,68 @@ _darcs {arch} ); -my $sourcestyle = 'X'; -my $min_dscformat = 1; -my $max_dscformat = 3; my $def_dscformat = "1.0"; # default format for -b +my %options = ( + # Compression related + compression => 'gzip', + comp_level => 9, + comp_ext => $comp_ext{'gzip'}, + # Ignore files + tar_ignore => [], + diff_ignore_regexp => '', + # Sourcestyle + sourcestyle => 'X', +); -my $expectprefix; - -# Compression -my $compression = 'gzip'; -my $comp_level = '9'; -my $comp_ext = $comp_ext{$compression}; - -# Packages +# Fields to remove/override my %remove; my %override; -# Files -my %checksum; -my %size; - -my @tar_ignore; - my $substvars = Dpkg::Substvars->new(); -use POSIX; -use Fcntl qw(:mode); -use English; -use File::Temp qw(tempfile); - -textdomain("dpkg-dev"); - -my @dsc_fields = (qw(Format Source Binary Architecture Version Origin - Maintainer Uploaders Dm-Upload-Allowed Homepage - Standards-Version Vcs-Browser Vcs-Arch Vcs-Bzr - Vcs-Cvs Vcs-Darcs Vcs-Git Vcs-Hg Vcs-Mtn Vcs-Svn), - @src_dep_fields, - qw(Files)); - - -# Make sure patch doesn't get any funny ideas -delete $ENV{'POSIXLY_CORRECT'}; - -my @exit_handlers = (); -sub exit_handler { - &$_ foreach ( reverse @exit_handlers ); - exit(127); -} -$SIG{'INT'} = \&exit_handler; -$SIG{'HUP'} = \&exit_handler; -$SIG{'QUIT'} = \&exit_handler; - -sub version { - printf _g("Debian %s version %s.\n"), $progname, $version; - - print _g(" -Copyright (C) 1996 Ian Jackson and Klee Dienes."); - - print _g(" -This is free software; see the GNU General Public Licence version 2 or -later for copying conditions. There is NO warranty. -"); -} - -sub usage { - printf _g( -"Usage: %s [