z***@osuosl.org
2013-11-28 09:47:05 UTC
ChangeLog | 8 ++++++++
createrepo.spec | 2 +-
createrepo/__init__.py | 22 ++++++++++++++++++++--
genpkgmetadata.py | 6 ++++++
4 files changed, 35 insertions(+), 3 deletions(-)
New commits:
commit 7d4b50a941f7ba935b53e1b5ee3f9c9de63b84ac
Author: Zdenek Pavlas <***@redhat.com>
Date: Fri Oct 25 16:04:41 2013 +0200
mark as 0.10.1
diff --git a/ChangeLog b/ChangeLog
index 7006fc1..f3ae966 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-11-28 Zdenek Pavlas <***@redhat.com>
+
+ * Removing the workers=1 default breaks API users, put it back.
+ * Make sure the "packages" attribute is always correct.
+ * Clean up tempdir on failures.
+ * Close lock file before unlink()
+ * mark as 0.10.1
+
2013-10-18 Zdenek Pavlas <***@redhat.org>
* mark as 0.10
diff --git a/createrepo.spec b/createrepo.spec
index 5eda613..f73f0ff 100644
--- a/createrepo.spec
+++ b/createrepo.spec
@@ -14,7 +14,7 @@ BuildRequires: bash-completion
Summary: Creates a common metadata repository
Name: createrepo
-Version: 0.10
+Version: 0.10.1
Release: 1
License: GPL
Group: System Environment/Base
commit c5a292f58aa81ab2d8c5485455adfd3d0ac65aea
Author: Masahiro Matsuya <***@redhat.com>
Date: Thu Nov 28 10:40:01 2013 +0100
Close lock file before unlink(). BZ 1035588
This is needed on CIFS shares.
diff --git a/createrepo/__init__.py b/createrepo/__init__.py
index 452a3ac..5ede16c 100644
--- a/createrepo/__init__.py
+++ b/createrepo/__init__.py
@@ -230,6 +230,7 @@ class MetaDataGenerator:
except (OSError, IOError), e:
raise MDError, _("Could not create exclusive lock in %s and sqlite database generation enabled. Is this path on nfs? Is your lockd running?") % direc
else:
+ f.close()
os.unlink(direc + '/locktest')
if self.conf.deltas:
commit f49cdb7e99d98f06a9080dd4b5dc3fcd020bf1ab
Author: Zdenek Pavlas <***@redhat.com>
Date: Wed Oct 23 14:58:30 2013 +0200
Clean up tempdir on failures. BZ 1022515
diff --git a/genpkgmetadata.py b/genpkgmetadata.py
index 1c175b8..946f6b6 100755
--- a/genpkgmetadata.py
+++ b/genpkgmetadata.py
@@ -287,6 +287,12 @@ def main(args):
except MDError, errormsg:
errorprint(_('%s') % errormsg)
+ # cleanup
+ tmp = os.path.join(conf.outputdir, conf.tempdir)
+ if os.path.exists(tmp):
+ for name in os.listdir(tmp):
+ os.unlink(os.path.join(tmp, name))
+ os.rmdir(tmp)
sys.exit(1)
commit 84a237f6a2e661879147e1ee5f9a2be984267991
Author: Zdenek Pavlas <***@redhat.com>
Date: Wed Oct 23 11:42:02 2013 +0200
Make sure the "packages" attribute is always correct. BZ 1022001
We create XML files in one pass and the package count is stored
first. We need the count to be correct, so when a package is
being skipped, it must be a fatal error.
diff --git a/createrepo/__init__.py b/createrepo/__init__.py
index dfdc8ab..452a3ac 100644
--- a/createrepo/__init__.py
+++ b/createrepo/__init__.py
@@ -399,7 +399,17 @@ class MetaDataGenerator:
self._setup_old_metadata_lookup()
# rpms we're going to be dealing with
if self.conf.pkglist:
- packages = self.conf.pkglist
+ packages = []
+ for pkg in self.conf.pkglist:
+ if '://' in pkg: # remote
+ packages.append(pkg)
+ continue
+ path = os.path.join(self.conf.basedir, self.conf.directory, pkg)
+ if os.access(path, os.R_OK):
+ packages.append(pkg)
+ continue
+ # not fatal, yet
+ self.callback.errorlog('Cannot read file: %s' % path)
else:
packages = self.getFileList(self.package_dir, '.rpm')
@@ -670,6 +680,8 @@ class MetaDataGenerator:
return # EOF, EOF
if stream is job.stdout:
if line.startswith('*** '):
+ if line == '*** \n':
+ return True
# get data, save to local files
for out, size in zip(files, line[4:].split()):
out.write(stream.read(int(size)))
@@ -678,12 +690,14 @@ class MetaDataGenerator:
else:
self.callback.errorlog('Worker %s: %s' % (num, line.rstrip()))
+ err = 0
for i, pkg in enumerate(pkgfiles):
# insert cached packages
save_keptpkgs(pkg)
# save output to local files
- log_messages(i % self.conf.workers)
+ if log_messages(i % self.conf.workers):
+ err += 1
for (num, job) in worker_jobs.items():
# process remaining messages on stderr
@@ -697,6 +711,9 @@ class MetaDataGenerator:
if not self.conf.quiet:
self.callback.log("Workers Finished")
+ if err:
+ raise MDError, "Failed to process %d package(s)." % err
+
for pkgfile in pkgfiles:
if self.conf.deltas:
try:
createrepo.spec | 2 +-
createrepo/__init__.py | 22 ++++++++++++++++++++--
genpkgmetadata.py | 6 ++++++
4 files changed, 35 insertions(+), 3 deletions(-)
New commits:
commit 7d4b50a941f7ba935b53e1b5ee3f9c9de63b84ac
Author: Zdenek Pavlas <***@redhat.com>
Date: Fri Oct 25 16:04:41 2013 +0200
mark as 0.10.1
diff --git a/ChangeLog b/ChangeLog
index 7006fc1..f3ae966 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-11-28 Zdenek Pavlas <***@redhat.com>
+
+ * Removing the workers=1 default breaks API users, put it back.
+ * Make sure the "packages" attribute is always correct.
+ * Clean up tempdir on failures.
+ * Close lock file before unlink()
+ * mark as 0.10.1
+
2013-10-18 Zdenek Pavlas <***@redhat.org>
* mark as 0.10
diff --git a/createrepo.spec b/createrepo.spec
index 5eda613..f73f0ff 100644
--- a/createrepo.spec
+++ b/createrepo.spec
@@ -14,7 +14,7 @@ BuildRequires: bash-completion
Summary: Creates a common metadata repository
Name: createrepo
-Version: 0.10
+Version: 0.10.1
Release: 1
License: GPL
Group: System Environment/Base
commit c5a292f58aa81ab2d8c5485455adfd3d0ac65aea
Author: Masahiro Matsuya <***@redhat.com>
Date: Thu Nov 28 10:40:01 2013 +0100
Close lock file before unlink(). BZ 1035588
This is needed on CIFS shares.
diff --git a/createrepo/__init__.py b/createrepo/__init__.py
index 452a3ac..5ede16c 100644
--- a/createrepo/__init__.py
+++ b/createrepo/__init__.py
@@ -230,6 +230,7 @@ class MetaDataGenerator:
except (OSError, IOError), e:
raise MDError, _("Could not create exclusive lock in %s and sqlite database generation enabled. Is this path on nfs? Is your lockd running?") % direc
else:
+ f.close()
os.unlink(direc + '/locktest')
if self.conf.deltas:
commit f49cdb7e99d98f06a9080dd4b5dc3fcd020bf1ab
Author: Zdenek Pavlas <***@redhat.com>
Date: Wed Oct 23 14:58:30 2013 +0200
Clean up tempdir on failures. BZ 1022515
diff --git a/genpkgmetadata.py b/genpkgmetadata.py
index 1c175b8..946f6b6 100755
--- a/genpkgmetadata.py
+++ b/genpkgmetadata.py
@@ -287,6 +287,12 @@ def main(args):
except MDError, errormsg:
errorprint(_('%s') % errormsg)
+ # cleanup
+ tmp = os.path.join(conf.outputdir, conf.tempdir)
+ if os.path.exists(tmp):
+ for name in os.listdir(tmp):
+ os.unlink(os.path.join(tmp, name))
+ os.rmdir(tmp)
sys.exit(1)
commit 84a237f6a2e661879147e1ee5f9a2be984267991
Author: Zdenek Pavlas <***@redhat.com>
Date: Wed Oct 23 11:42:02 2013 +0200
Make sure the "packages" attribute is always correct. BZ 1022001
We create XML files in one pass and the package count is stored
first. We need the count to be correct, so when a package is
being skipped, it must be a fatal error.
diff --git a/createrepo/__init__.py b/createrepo/__init__.py
index dfdc8ab..452a3ac 100644
--- a/createrepo/__init__.py
+++ b/createrepo/__init__.py
@@ -399,7 +399,17 @@ class MetaDataGenerator:
self._setup_old_metadata_lookup()
# rpms we're going to be dealing with
if self.conf.pkglist:
- packages = self.conf.pkglist
+ packages = []
+ for pkg in self.conf.pkglist:
+ if '://' in pkg: # remote
+ packages.append(pkg)
+ continue
+ path = os.path.join(self.conf.basedir, self.conf.directory, pkg)
+ if os.access(path, os.R_OK):
+ packages.append(pkg)
+ continue
+ # not fatal, yet
+ self.callback.errorlog('Cannot read file: %s' % path)
else:
packages = self.getFileList(self.package_dir, '.rpm')
@@ -670,6 +680,8 @@ class MetaDataGenerator:
return # EOF, EOF
if stream is job.stdout:
if line.startswith('*** '):
+ if line == '*** \n':
+ return True
# get data, save to local files
for out, size in zip(files, line[4:].split()):
out.write(stream.read(int(size)))
@@ -678,12 +690,14 @@ class MetaDataGenerator:
else:
self.callback.errorlog('Worker %s: %s' % (num, line.rstrip()))
+ err = 0
for i, pkg in enumerate(pkgfiles):
# insert cached packages
save_keptpkgs(pkg)
# save output to local files
- log_messages(i % self.conf.workers)
+ if log_messages(i % self.conf.workers):
+ err += 1
for (num, job) in worker_jobs.items():
# process remaining messages on stderr
@@ -697,6 +711,9 @@ class MetaDataGenerator:
if not self.conf.quiet:
self.callback.log("Workers Finished")
+ if err:
+ raise MDError, "Failed to process %d package(s)." % err
+
for pkgfile in pkgfiles:
if self.conf.deltas:
try: