~ubuntu-branches/ubuntu/saucy/devscripts/saucy

« back to all changes in this revision

Viewing changes to scripts/uscan.pl

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2009-11-04 22:52:32 UTC
  • mfrom: (10.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20091104225232-0gd38o908lsuqiap
Tags: 2.10.55ubuntu1
* Resynchronise with Debian. Remaining changes:
  - Drop universe packages from Recommends to Suggests:
    + libcrypt-ssleay-perl: only needed for a corner case (uscan on SSL
      download sites), wasn't installed by default in previous releases
      either, and seems quite dead upstream
    + libsoap-lite-perl: only needed for one less common command ("select")
      for bts, which isn't useful for Ubuntu itself, and pulls in a lot of
      other universe Perl libraries
    + debian-{keyring,maintainers}: not useful enough in Ubuntu
    + equivs: too much of a hack to install by default
    + libyaml-syck-perl: transition-check is fairly Debian-specific
  - scripts/debchange.pl:
    + Adjust --security template for Ubuntu.
    + Add -U/--upstream flag that forces original "just increment
      the end" behaviour; Ubuntu is upstream for some pieces of software.
    + Add --distributor= to override lsb_release output.
    + Default to "karmic" as distribution.
    + Add "ubuntu1" to version string for new versions, with tweaks for
      special cases.
    + Add -R/--rebuild flag for Ubuntu's no-change rebuilds.
    + Don't use the last distribution in debian/changelog when doing
      "dch -r" on Ubuntu. "Just because it was last uploaded to jaunty
      doesn't mean that's the right thing to do now." Thanks to Colin
      Watson. (LP: #429288)
  - scripts/debsign.{sh,1}: Implement DEBSIGN_ALWAYS_RESIGN variable to skip
    the "Would you like to use the current signature?" question. (Debian
    #447955)
  - scripts/debuild.pl: Enforce Ubuntu merge policy.
  - scripts/dscverify.pl: Add Ubuntu keyrings.
  - scripts/rmadison.pl: Change default URL parameter to ubuntu.
  - scripts/uupdate.{sh,1}: Use -0ubuntu1 default revision on Ubuntu.
  - Add test/debchange.pl, test/Makefile: debchange test suite; call it
    during build in debian/rules. Also add lsb-release build dependency for
    this, so that debchange uses Ubuntu mode.

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
                   Specify the version which the upstream release must
120
120
                   match in order to be considered, rather than using the
121
121
                   release with the highest version
 
122
    --download-current-version
 
123
                   Download the currently packaged version
122
124
    --package PACKAGE
123
125
                   Specify the package name rather than examining
124
126
                   debian/changelog; must use --upstream-version and
262
264
my ($opt_package, $opt_uversion, $opt_watchfile, $opt_dehs, $opt_timeout);
263
265
my $opt_download_version;
264
266
my $opt_user_agent;
 
267
my $opt_download_current_version;
265
268
 
266
269
GetOptions("help" => \$opt_h,
267
270
           "version" => \$opt_v,
289
292
           "useragent=s" => \$opt_user_agent,
290
293
           "noconf" => \$opt_noconf,
291
294
           "no-conf" => \$opt_noconf,
 
295
           "download-current-version" => \$opt_download_current_version,
292
296
           )
293
297
    or die "Usage: $progname [options] [directories]\nRun $progname --help for more details\n";
294
298
 
820
824
        $pattern = "(?:(?:$site)?" . quotemeta($basedir) . ")?$filepattern";
821
825
    }
822
826
 
 
827
    if (! $lastversion or $lastversion eq 'debian') {
 
828
        if (defined $pkg_version) {
 
829
            $lastversion=$pkg_version;
 
830
        } else {
 
831
            warn "$progname warning: Unable to determine current version\n  in $watchfile, skipping:\n  $line\n";
 
832
            return 1;
 
833
        }
 
834
    }
 
835
    # And mangle it if requested
 
836
    my $mangled_lastversion;
 
837
    $mangled_lastversion = $lastversion;
 
838
    foreach my $pat (@{$options{'dversionmangle'}}) {
 
839
        if (! safe_replace(\$mangled_lastversion, $pat)) {
 
840
            warn "$progname: In $watchfile, potentially"
 
841
              . " unsafe or malformed dversionmangle"
 
842
              . " pattern:\n  '$pat'"
 
843
              . " found. Skipping watchline\n"
 
844
              . "  $line\n";
 
845
            return 1;
 
846
        }
 
847
    }
 
848
    if($opt_download_current_version) {
 
849
        $download_version = $mangled_lastversion;
 
850
        $force_download = 1;
 
851
    }
 
852
 
823
853
    # Check all's OK
824
854
    if ($pattern !~ /\(.*\)/) {
825
855
        warn "$progname warning: Filename pattern missing version delimiters ()\n  in $watchfile, skipping:\n  $line\n";
912
942
                        foreach my $pat (@{$options{'uversionmangle'}}) {
913
943
                            if (! safe_replace(\$mangled_version, $pat)) {
914
944
                                warn "$progname: In $watchfile, potentially"
915
 
                                  . " unsafe or malformed uversionmangle"
 
945
                                 . " unsafe or malformed uversionmangle"
916
946
                                  . " pattern:\n  '$pat'"
917
947
                                  . " found. Skipping watchline\n"
918
948
                                  . "  $line\n";
1086
1116
            $newfile_base = "$pkg-$newversion.download";
1087
1117
        }
1088
1118
    }
1089
 
    if (! $lastversion or $lastversion eq 'debian') {
1090
 
        if (defined $pkg_version) {
1091
 
            $lastversion=$pkg_version;
1092
 
        } else {
1093
 
            warn "$progname warning: Unable to determine current version\n  in $watchfile, skipping:\n  $line\n";
1094
 
            return 1;
1095
 
        }
1096
 
    }
1097
 
    # And mangle it if requested
1098
 
    my $mangled_lastversion = $lastversion;
1099
 
    foreach my $pat (@{$options{'dversionmangle'}}) {
1100
 
        if (! safe_replace(\$mangled_lastversion, $pat)) {
1101
 
            warn "$progname: In $watchfile, potentially"
1102
 
              . " unsafe or malformed dversionmangle"
1103
 
              . " pattern:\n  '$pat'"
1104
 
              . " found. Skipping watchline\n"
1105
 
              . "  $line\n";
1106
 
            return 1;
1107
 
        }
1108
 
    }
1109
 
 
 
1119
    
1110
1120
    # So what have we got to report now?
1111
1121
    my $upstream_url;
1112
1122
    # Upstream URL?  Copying code from below - ugh.
1217
1227
    # We use dpkg's rules to determine whether our current version
1218
1228
    # is newer or older than the remote version.
1219
1229
    if (!defined $download_version) {
1220
 
        if (system("dpkg", "--compare-versions", "'$mangled_lastversion'", "gt", "'$newversion'") == 0) {
 
1230
        if (system("dpkg", "--compare-versions", "'$mangled_lastversion'", "gt", "'$newversion'") == 0) {
1221
1231
            if ($verbose) {
1222
1232
                print " => remote site does not even have current version\n";
1223
1233
            } elsif ($dehs) {
1340
1350
        $newfile_base = $newfile_base_gz;
1341
1351
    }
1342
1352
 
 
1353
    if ($repack and $newfile_base =~ /^(.*)\.(tar\.lzma|tlzma?)$/) {
 
1354
        print "-- Repacking from lzma to gzip\n" if $verbose;
 
1355
        my $newfile_base_gz = "$1.tar.gz";
 
1356
        system("lzma -cd $destdir/$newfile_base | gzip -n -9 > $destdir/$newfile_base_gz") == 0
 
1357
          or die "repacking from lzma to gzip failed\n";
 
1358
        unlink "$destdir/$newfile_base";
 
1359
        $newfile_base = $newfile_base_gz;
 
1360
    }
 
1361
 
1343
1362
    if ($repack and $newfile_base =~ /^(.*)\.zip$/) {
1344
1363
        print "-- Repacking from zip to .tar.gz\n" if $verbose;
1345
1364
 
1944
1963
            # Actually do the replacement
1945
1964
            substr $$in, $first, $last - $first, $replacement;
1946
1965
            # Update position
1947
 
            $pos += length($replacement)- ($last - $first);
 
1966
            $pos += length($replacement) - ($last - $first);
1948
1967
 
1949
1968
            if ($global) {
1950
1969
                $replacement = $orig_replacement;