[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:07:13 UTC 2008
The following commit has been merged in the master branch:
commit 53486079e870318861e9b297c9da4e5ec8d2af3d
Author: ceros-guest <ceros-guest>
Date: Thu Jan 17 01:08:22 2008 +0000
* Applying several patches from Alexei Chetroi.
+ Moved config parsing from bin/debpool to share/DebPool/Config.pm, making
code more readable and maintainable.
+ Fixed problem when uploading packages to an unconfigured distribution.
+ Fixed problem when uploading packages to an unconfigured architecture.
+ Thanks Alexei Chetroi.
diff --git a/bin/debpool b/bin/debpool
index d768510..6c18208 100755
--- a/bin/debpool
+++ b/bin/debpool
@@ -43,45 +43,7 @@ use warnings;
use POSIX; # This gets us strftime.
-# First things first - figure out how we need to be configured.
-
-use Getopt::Long qw(:config pass_through);
-use DebPool::Config qw(:functions :vars);
-
-# First, grab --config and --nodefault options if they exist. We
-# don't want these in the %Options hash, and they affect what we do when
-# loading it.
-
-my(@config_files);
-my($default);
-
-GetOptions('config=s' => \@config_files, 'default!' => \$default);
-
-# Call Load_Default_Configs if we're loading default values, or
-# Load_Minimal_Configs if we're not (we still need the OptionDefs hash to
-# be populated).
-
-if (!defined($default) || $default) {
- Load_Default_Configs();
-} else {
- Load_Minimal_Configs();
-}
-
-# Load any config files we were given.
-
-my($config);
-
-foreach $config (@config_files) {
- Load_File_Configs($config);
-}
-
-# And finally, pull in any other command line options.
-
-GetOptions(\%Options, values(%OptionDefs));
-
-# Run the cleanup stuff on %Options.
-
-Clean_Options();
+use DebPool::Config qw(:vars);
# Okay. We're more or less ready to go. First, load some modules that we
# know we'll be calling.
@@ -412,6 +374,24 @@ foreach $changefile (@changefiles) {
next;
}
+ # Go through each arch in .changes file and check if the repository
+ # is configured for that arch.
+
+ $rejected = undef;
+ my @chg_archs = grep(!/^(source|all)$/, @{$changes_data->{'Architecture'}});
+
+ foreach my $chg_arch (@chg_archs) {
+ unless ( grep /^\Q$chg_arch\E$/, @{$Options{'archs'}} ) {
+ Reject_Package($changefile, $changes_data);
+ my($msg) = "The archive isn't configured for '$chg_arch' type packages.";
+ Log_Message($msg, LOG_REJECT, LOG_ERROR);
+ $rejected = 1;
+ last;
+ }
+ }
+
+ next if ($rejected); # Reject message already logged, go to next package.
+
# Go through each distribution in the changes file, and decide whether
# the package is valid for that distribution.
@@ -419,14 +399,14 @@ foreach $changefile (@changefiles) {
my(@valid_dists);
foreach $distribution (@{$changes_data->{'Distribution'}}) {
- $realdist = $distribution;
+ $realdist = undef;
- if (defined($Options{'virtual_dists'}->{$realdist})) {
- $realdist = $Options{'virtual_dists'}->{$realdist};
+ if (defined($Options{'virtual_dists'}->{$distribution})) {
+ $realdist = $Options{'virtual_dists'}->{$distribution};
}
- if (defined($Options{'dists'}->{$realdist})) {
- $realdist = $Options{'dists'}->{$realdist};
+ if (defined($Options{'dists'}->{$distribution})) {
+ $realdist = $Options{'dists'}->{$distribution};
}
if (!defined($realdist)) {
diff --git a/debian/changelog b/debian/changelog
index 04b9376..8e9ae5f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -76,6 +76,12 @@ debpool (0.2.4~unreleased0) experimental; urgency=low
+ Temp::File used to automatically unlink in case of any errors.
+ Thanks Magnus Holmgren.
* Update example Config.pm.
+ * Applying several patches from Alexei Chetroi.
+ + Moved config parsing from bin/debpool to share/DebPool/Config.pm, making
+ code more readable and maintainable.
+ + Fixed problem when uploading packages to an unconfigured distribution.
+ + Fixed problem when uploading packages to an unconfigured architecture.
+ + Thanks Alexei Chetroi.
-- Andres Mejia <mcitadel at gmail.com> Thu, 10 Jan 2008 01:26:13 -0500
diff --git a/share/DebPool/Config.pm b/share/DebPool/Config.pm
index 7007cee..198146d 100644
--- a/share/DebPool/Config.pm
+++ b/share/DebPool/Config.pm
@@ -134,6 +134,48 @@ our($Error);
# None
+### Module Init
+
+# First things first - figure out how we need to be configured.
+
+use Getopt::Long qw(:config pass_through);
+
+# First, grab --config and --nodefault options if they exist. We
+# don't want these in the %Options hash, and they affect what we do when
+# loading it.
+
+my(@config_files);
+my($default);
+
+GetOptions('config=s' => \@config_files, 'default!' => \$default);
+
+# Call Load_Default_Configs if we're loading default values, or
+# Load_Minimal_Configs if we're not (we still need the OptionDefs hash to
+# be populated).
+
+if (!defined($default) || $default) {
+ Load_Default_Configs();
+} else {
+ Load_Minimal_Configs();
+}
+
+# Load any config files we were given.
+
+my($config);
+
+foreach $config (@config_files) {
+ Load_File_Configs($config);
+}
+
+# And finally, pull in any other command line options.
+
+GetOptions(\%Options, values(%OptionDefs));
+
+# Run the cleanup stuff on %Options.
+
+Clean_Options();
+
+
### Meaningful functions
# Load_Default_Configs
--
Debpool Project Repository
More information about the Debpool-commits
mailing list