I was able to upload binary only uploads with success starting with
debpool-0.2.3. The problem I received however is that whenever I
uploaded for one arch, that arch would get their package entries added
in the appropriate Packages file and all other archs' Packages file
would get their entries deleted. This made it seem as though empty
Packages files were being generated.

I've attached a patch that has debpool use package files named
"*_$arch.package" instead of just "*.package". I've had to change the
log message when a packages file was not found whenever an arch
doesn't contain a package yet. I plan on fixing the logging issue
later. There's other changes in this patch but the relevant changes to
fix this bug are with hunks 2, 3, 4, and 6.
--- ../debpool_released/share/DebPool/Packages.pm	2007-12-03 14:10:49.000000000 -0500
+++ share/DebPool/Packages.pm	2007-12-04 02:54:52.000000000 -0500
@@ -488,7 +488,7 @@
 
     for $count (0..$#dsc) {
         if ($found) {
-            if ($dsc[$count] =~ m/^\s*$/) { # Blank line
+            if ($dsc[$count] =~ m/^(\s*$|\S)/) { # End of Files entry
                 $found = 0; # No longer in Files
             } elsif ($dsc[$count] =~ m/\s*([[:xdigit:]]+)\s+(\d+)\s+(\S+)/) {
                 my($md5, $size, $file) = ($1, $2, $3);
@@ -567,13 +567,13 @@
                 ($Options{'pool_dir'}, PoolDir($source, $section), $source));
             my($version) = Get_Version($distribution, $source, 'meta');
             my($target) = "$pool/${source}_" . Strip_Epoch($version);
-            $target .= '.package';
+            $target .= "_$arch\.package";
 
             if (!open(PKG, '<', "$target")) {
-                my($msg) = "Skipping package entry for all packages from ";
-                $msg .= "${source}: couldn't open '$target' for reading: $!";
+                my($msg) = "No package entry for ";
+                $msg .= "${source} on '$arch' architecture found.";
 
-                Log_Message($msg, LOG_GENERAL, LOG_ERROR);
+                Log_Message($msg, LOG_GENERAL, LOG_INFO);
                 next;
             }
 
@@ -624,6 +624,16 @@
     my($pkg_name) = $chg_hashref->{'Source'};
     my($pkg_ver) = $chg_hashref->{'Version'};
 
+    # determine arch for packages being installed based on set archs from
+    # options
+    my($options_archs);
+    my($pkg_arch);
+    foreach $options_archs (@{$Options{'archs'}}) {
+        if ($changes =~ m/.*\Q_${options_archs}.changes\E/) {
+              $pkg_arch = $options_archs;
+        }
+    }
+
     my($guess_section) = Guess_Section($chg_hashref);
     my($pkg_dir) = join('/',
         ($pool_dir, PoolDir($pkg_name, $guess_section), $pkg_name));
@@ -668,7 +678,7 @@
         return undef;
     }
 
-    my($target) = "$pkg_dir/${pkg_name}_" . Strip_Epoch($pkg_ver) . '.package';
+    my($target) = "$pkg_dir/${pkg_name}_" . Strip_Epoch($pkg_ver) . "_$pkg_arch" . '.package';
 
     if (!Move_File($pkg_file, $target, $Options{'pool_file_mode'})) {
         $Error = "Failed to move '$pkg_file' to '$target': ";
@@ -719,6 +729,9 @@
             $chg_hashref->{'Files'});
         $ComponentDB{$distribution}->{$pkg_name} = $component;
     }
+    if ( $section eq 'debian-installer' ) {
+        $component .= '/debian-installer';
+    }
 
     return 1;
 }
@@ -872,7 +885,7 @@
             $bin_package = $1;
             $version = $2;
             $deb = 1;
-        } elsif ($file =~ m/^([^_]+)_([^_]+)\.package$/) { # package metadata
+        } elsif ($file =~ m/^([^_]+)_([^_]+)_.+\.package$/) { # package metadata
             $bin_package = $1;
             $version = $2;
         } elsif ($file =~ m/^([^_]+)_([^_]+)\.source$/) { # source metadata
@@ -981,8 +994,7 @@
             # without the epoch" -- it is more or less arbitrary, as long
             # as it is a well-formed version number).
 
-            my($filepat) = "${package}_.*_${arch}\\.deb";
-            $filepat =~ s/\+/\\\+/;
+            my($filepat) = qr/^\Q${package}_\E.*\Q_${arch}.\Eu?deb/;
 
             my($section) = Guess_Section($changes_data);
             my($pool) = join('/', (PoolDir($source, $section), $source));
@@ -1054,9 +1066,9 @@
             print $tmpfile_handle "MD5sum: $files[$marker]->{'MD5Sum'}\n";
         
             print $tmpfile_handle "Description: $info->{'Description'}";
-        }
 
-        print $tmpfile_handle "\n";
+            print $tmpfile_handle "\n";
+        }
     }
 
     # All done
@@ -1117,7 +1129,8 @@
     print $tmpfile_handle 'Architecture: ';
     print $tmpfile_handle join(' ', @{$dsc_data->{'Architecture'}}) . "\n";
 
-    print $tmpfile_handle "Standards-Version: $dsc_data->{'Standards-Version'}\n";
+    print $tmpfile_handle "Standards-Version: $dsc_data->{'Standards-Version'}\n"
+      if  exists $dsc_data->{'Standards-Version'};
     print $tmpfile_handle "Format: $dsc_data->{'Format'}\n";
     print $tmpfile_handle "Directory: " .  join('/',
         (PoolBasePath(), PoolDir($source, $section), $source)) . "\n";

Reply via email to