Blame SOURCES/BZ-1022028-wrong-package-count.patch

164e0b
diff --git a/createrepo/__init__.py b/createrepo/__init__.py
164e0b
index dfdc8ab..452a3ac 100644
164e0b
--- a/createrepo/__init__.py
164e0b
+++ b/createrepo/__init__.py
164e0b
@@ -399,7 +399,17 @@ class MetaDataGenerator:
164e0b
             self._setup_old_metadata_lookup()
164e0b
         # rpms we're going to be dealing with
164e0b
         if self.conf.pkglist:
164e0b
-            packages = self.conf.pkglist
164e0b
+            packages = []
164e0b
+            for pkg in self.conf.pkglist:
164e0b
+                if '://' in pkg: # remote
164e0b
+                    packages.append(pkg)
164e0b
+                    continue
164e0b
+                path = os.path.join(self.conf.basedir, self.conf.directory, pkg)
164e0b
+                if os.access(path, os.R_OK):
164e0b
+                    packages.append(pkg)
164e0b
+                    continue
164e0b
+                # not fatal, yet
164e0b
+                self.callback.errorlog('Cannot read file: %s' % path)
164e0b
         else:
164e0b
             packages = self.getFileList(self.package_dir, '.rpm')
164e0b
 
164e0b
@@ -670,6 +680,8 @@ class MetaDataGenerator:
164e0b
                         return # EOF, EOF
164e0b
                     if stream is job.stdout:
164e0b
                         if line.startswith('*** '):
164e0b
+                            if line == '*** \n':
164e0b
+                                return True
164e0b
                             # get data, save to local files
164e0b
                             for out, size in zip(files, line[4:].split()):
164e0b
                                 out.write(stream.read(int(size)))
164e0b
@@ -678,12 +690,14 @@ class MetaDataGenerator:
164e0b
                     else:
164e0b
                         self.callback.errorlog('Worker %s: %s' % (num, line.rstrip()))
164e0b
 
164e0b
+            err = 0
164e0b
             for i, pkg in enumerate(pkgfiles):
164e0b
                 # insert cached packages
164e0b
                 save_keptpkgs(pkg)
164e0b
 
164e0b
                 # save output to local files
164e0b
-                log_messages(i % self.conf.workers)
164e0b
+                if log_messages(i % self.conf.workers):
164e0b
+                    err += 1
164e0b
 
164e0b
             for (num, job) in worker_jobs.items():
164e0b
                 # process remaining messages on stderr
164e0b
@@ -697,6 +711,9 @@ class MetaDataGenerator:
164e0b
             if not self.conf.quiet:
164e0b
                 self.callback.log("Workers Finished")
164e0b
                     
164e0b
+            if err:
164e0b
+                raise MDError, "Failed to process %d package(s)." % err
164e0b
+
164e0b
             for pkgfile in pkgfiles:
164e0b
                 if self.conf.deltas:
164e0b
                     try: