Patch:

--- old/src/modules/server/repository.py        Mon Aug 29 18:21:31 2011
+++ new/src/modules/server/repository.py        Mon Aug 29 18:21:31 2011
@@ -1610,7 +1610,7 @@
                             for f in packages):
                                 rmdir(os.path.join(self.manifest_root, name))

-                        if self.file_root:
+                        if self.file_root and os.path.isdir(self.file_root):
                                 for entry in os.listdir(self.file_root):
                                         rmdir(os.path.join(self.file_root,
                                             entry))
--- old/src/tests/cli/t_pkgrepo.py      Mon Aug 29 18:21:31 2011
+++ new/src/tests/cli/t_pkgrepo.py      Mon Aug 29 18:21:31 2011
@@ -1201,9 +1201,20 @@
                 # Create a repository and then copy it somewhere for testing
                 # to make it easy to restore the original as needed.
                 src_repo = os.path.join(self.test_root, "remove-repo")
+
                 self.create_repo(src_repo)
+                self.pkgrepo("set -s %s publisher/prefix=test" % src_repo)

+                # Test that removing a package when no files have been 
published
+                # works (bug 18424).
+                published = self.pkgsend_bulk(src_repo, self.zoo10)
+                self.pkgrepo("remove -s %s zoo" % src_repo)
+
+                # Reset the src_repo for the rest of the test.
+                shutil.rmtree(src_repo)
+                self.create_repo(src_repo)
                 self.pkgrepo("set -s %s publisher/prefix=test" % src_repo)
+
                 published = self.pkgsend_bulk(src_repo, (self.tree10,
                     self.amber10, self.amber20, self.truck10, self.truck20,
                     self.zoo10))
@@ -1211,6 +1222,7 @@
                 published += self.pkgsend_bulk(src_repo, (self.tree10,
                     self.zoo10))

+                # Restore repository for next test.
                 dest_repo = os.path.join(self.test_root, "test-repo")
                 shutil.copytree(src_repo, dest_repo)



Bug:
18424 pkgrepo remove stacktrace when there are no files in the repo

I've included the change here since there's only 1 real line of code change.

Brock
_______________________________________________
pkg-discuss mailing list
pkg-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to