[Debpool-commits] [SCM] Debpool Project Repository branch, master, updated. 0.2.3-63-g38a32aa
ceros-guest
ceros-guest at alioth.debian.org
Tue Jun 3 07:06:56 UTC 2008
The following commit has been merged in the master branch:
commit b9c51acd6b8799b169188c0770cb4967d55682dc
Author: ceros-guest <ceros-guest>
Date: Sat Dec 22 05:52:31 2007 +0000
Implemented check for binary only uploads to ensure source information has been uploaded first. Using check from Magnus to check for package with same version in specific architectures.
diff --git a/bin/debpool b/bin/debpool
index d29d36a..f602f9d 100755
--- a/bin/debpool
+++ b/bin/debpool
@@ -385,7 +385,32 @@ foreach $changefile (@changefiles) {
last; # Don't check other files, we already failed
}
}
- }
+ } else { # Assuming a binary only upload
+ # The dsc file should be uploaded
+ my($section) = Guess_Section($changes_data);
+ my($pkg_pooldir) = join('/',
+ ($Options{'pool_dir'}, PoolDir($package, $section),
+ $package));
+ my $dsc_check = "$pkg_pooldir/$dscfile";
+ if ( ! -e $dsc_check ) {
+ Reject_Package($changefile, $changes_data);
+
+ my($msg) = "Attempted to do a binary only upload but the ";
+ $msg .= "source information for this package has not been ";
+ $msg .= "uploaded.";
+ Log_Message($msg, LOG_REJECT, LOG_ERROR);
+
+ $rejected = 1;
+ last; # Don't check other files, we just rejected
+ }
+ foreach $filehr (@{$changes_data->{'Files'}}) {
+ my($file) = $filehr->{'Filename'};
+ if (!(Verify_MD5($file, $filehr->{'MD5Sum'}))) {
+ $valid = undef;
+ last; # Don't check other files, we failed
+ }
+ }
+ } # TODO: Will this work for a binNMU?
next if ($rejected); # Reject message already logged, go to next package.
@@ -420,7 +445,7 @@ foreach $changefile (@changefiles) {
next;
}
- my($allow) = Allow_Version($package, $version, $realdist);
+ my($allow) = Allow_Version($package, $version, $realdist, $changes_data->{'Architecture'});
if (!defined($allow)) {
Log_Message("Version check for $version failed: " .
diff --git a/debian/changelog b/debian/changelog
index 09a3d1e..e028740 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,10 @@ debpool (0.2.4~0unreleased) expiremental; urgency=low
* Fixed problem with binary only uploads. Closes: #322593
+ Also fixed problem with source only uploads and binary only uploads
without binary-all packages.
+ + Packages should be rejected if dsc file is at a different revision for
+ binary only uploads.
+ + Packages should be rejected if an architecture has a package with the
+ same version. Thanks Magnus Holmgren.
* Added fix to keep pool tree minimized. Thanks Magnus Holmgren.
+ Closes: #350503
* Fixed problem with extracting information from wrong deb file.
diff --git a/share/DebPool/DB.pm b/share/DebPool/DB.pm
index 789870a..3ee635e 100644
--- a/share/DebPool/DB.pm
+++ b/share/DebPool/DB.pm
@@ -67,12 +67,13 @@ BEGIN {
&Open_Databases
&Close_Databases
&Get_Version
+ &Get_Archs
&Set_Versions
);
%EXPORT_TAGS = (
'functions' => [qw(&Open_Databases &Close_Databases &Get_Version
- &Set_Versions)],
+ &Get_Archs &Set_Versions)],
'vars' => [qw(%ComponentDB)],
);
}
@@ -181,45 +182,60 @@ sub Close_Databases {
sub Get_Version {
my($dist, $source, $package) = @_;
- my($temp) = $VersionDB{$dist}->{$source};
- if (!defined($temp)) { return undef; }
+ return undef unless defined $VersionDB{$dist}{$source};
+ my($version, $binlist, $archlist) = split(/\|/, $VersionDB{$dist}{$source});
# Versions prior to 0.2.2 had only one entry, which is the source
# version; since this is the same as the binary version on the vast
# majority of packages, fake an answer. This works because hash entries
# are guaranteed to be non-empty.
- if ($temp !~ m/\|/) {
- return $temp;
+ if (!defined $binlist) {
+ return $version;
}
if ('meta' eq $package) {
- $temp =~ s/\|.*//;
- return $temp;
+ return $version;
} elsif ('source' eq $package) {
- return $VersionDB{$dist}->{"source_${source}"};
+ return $VersionDB{$dist}{"source_${source}"};
} else {
- return $VersionDB{$dist}->{"binary_${source}_${package}"};
+ return $VersionDB{$dist}{"binary_${source}_${package}"};
}
}
-# Set_Versions($dist, $source, $file_arrayref
+sub Get_Archs {
+ my($dist, $source) = @_;
+
+ return undef unless defined $VersionDB{$dist}{$source};
+ my($version, $binlist, $archlist) = split(/\|/, $VersionDB{$dist}{$source});
+ return split /,/, $archlist if defined $archlist;
+ return @{$Options{'archs'}};
+}
+
+# Set_Versions($dist, $source, $file_arrayref)
sub Set_Versions {
my($dist, $source, $meta_version, $file_arrayref) = @_;
+ my (%entries, %archs);
+ my($oldversion, $oldbinlist, $archlist) =
+ split(/\|/, $VersionDB{$dist}{$source}) if defined $VersionDB{$dist}{$source};
- my($oldbinlist) = $VersionDB{$dist}->{$source};
- if (defined($oldbinlist) && ($oldbinlist =~ m/\|/)) { # 0.2.2 or later
- $oldbinlist =~ s/.*\|//; # Strip meta version
+ if (defined($oldbinlist)) {
my(@oldbins) = split(/,/,$oldbinlist);
-
- my($oldbin);
- foreach $oldbin (@oldbins) {
- $VersionDB{$dist}->{"binary_${source}_${oldbin}"} = undef;
+ if ($oldversion ne $meta_version) {
+ # 0.2.2 or later
+ foreach my $oldbin (@oldbins) {
+ delete $VersionDB{$dist}{"binary_${source}_${oldbin}"};
+ }
+ delete $VersionDB{$dist}{"source_${source}"};
+ delete $VersionDB{$dist}{"${source}"};
+ }
+ else {
+ $entries{$_} = 1 foreach @oldbins;
+ if (defined $archlist) {
+ $archs{$_} = 1 foreach split /,/, $archlist;
+ }
}
-
- $VersionDB{$dist}->{"source_${source}"} = undef;
- $VersionDB{$dist}->{"${source}"} = undef;
}
# Walk through each file looking for version data. Note that only the
@@ -230,27 +246,27 @@ sub Set_Versions {
# FIXME: Do udeb files have different versions from deb files?
my(@files) = @{$file_arrayref};
- my(@entries) = ();
- my($hashref);
- foreach $hashref (@files) {
+ foreach my $hashref (@files) {
my($filename) = $hashref->{'Filename'};
- if ($filename =~ m/^([^_]+)_([^_]+)_.+\.u?deb/) {
- my($package) = $1;
- my($version) = $2;
+ if ($filename =~ m/^([^_]+)_([^_]+)_(.+)\.u?deb/) {
+ my($package, $version, $arch) = ($1, $2, $3);
$VersionDB{$dist}->{"binary_${source}_${package}"} = $version;
- push(@entries, $package);
+ $entries{$package} = 1;
+ $archs{$arch} = 1;
} elsif ($filename =~ m/^[^_]+_([^_]+)\.dsc/) {
my($version) = $1;
$VersionDB{$dist}->{"source_${source}"} = $version;
- push(@entries, 'source');
+ $archs{source} = 1;
} # else skip
}
- $VersionDB{$dist}->{$source} = "${meta_version}|" . join(',', @entries);
+ $VersionDB{$dist}{$source} = join('|', ${meta_version},
+ join(',', keys %entries),
+ join(',', keys %archs));
}
END {}
diff --git a/share/DebPool/Packages.pm b/share/DebPool/Packages.pm
index 412b841..c722166 100644
--- a/share/DebPool/Packages.pm
+++ b/share/DebPool/Packages.pm
@@ -174,7 +174,7 @@ sub Allow_Version {
use DebPool::DB qw(:functions);
use DebPool::Logging qw(:functions :facility :level);
- my($package, $version, $distribution) = @_;
+ my($package, $version, $distribution, $arch) = @_;
my($old_version) = Get_Version($distribution, $package, 'meta');
# If we permit rollback, any version is valid.
@@ -189,6 +189,26 @@ sub Allow_Version {
return 1;
}
+ if ($version eq $old_version) {
+ my (%count, @duplicate_arches);
+ my @old_archs = Get_Archs($distribution, $package);
+ foreach (@old_archs, @$arch) {
+ if (++$count{$_} > 1) {
+ push @duplicate_arches, $_;
+ }
+ }
+ if (@duplicate_arches) {
+ my($msg) = "Version comparison for '$package': ";
+ $msg .= "proposed version for $distribution ($version) ";
+ $msg .= "is same as current version and the following ";
+ $msg .= "architectures already exist: ";
+ $msg .= join ', ', @duplicate_arches;
+ Log_Message($msg, LOG_GENERAL, LOG_DEBUG);
+ return 0;
+ }
+ return 1;
+ }
+
my($dpkg_bin) = '/usr/bin/dpkg';
my(@args) = ('--compare-versions', $version, 'gt', $old_version);
--
Debpool Project Repository
More information about the Debpool-commits
mailing list