On 08/29/11 18:23, Brock Pytlik wrote:
Patch v2:

--- old/src/modules/server/repository.py        Tue Aug 30 15:21:55 2011
+++ new/src/modules/server/repository.py        Tue Aug 30 15:21:55 2011
@@ -1611,9 +1611,13 @@
                                 rmdir(os.path.join(self.manifest_root, name))

                         if self.file_root:
-                                for entry in os.listdir(self.file_root):
-                                        rmdir(os.path.join(self.file_root,
-                                            entry))
+                                try:
+                                        for entry in 
os.listdir(self.file_root):
+                                                rmdir(os.path.join(
+                                                    self.file_root, entry))
+                                except EnvironmentError, e:
+                                        if e.errno != errno.ENOENT:
+                                                raise
                 except EnvironmentError, e:
                         raise apx._convert_error(e)
                 finally:
--- old/src/tests/cli/t_pkgrepo.py      Tue Aug 30 15:21:55 2011
+++ new/src/tests/cli/t_pkgrepo.py      Tue Aug 30 15:21:55 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
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to