[jhbuild] packagedb: remove manifest files on uninstall
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] packagedb: remove manifest files on uninstall
- Date: Sun, 4 Jan 2015 23:22:31 +0000 (UTC)
commit 5dd4fd974b4a3f08896c2567e520bd6a8f422c85
Author: Ryan Lortie <desrt desrt ca>
Date: Sat Jan 3 22:45:48 2015 -0500
packagedb: remove manifest files on uninstall
These have been left dangling. Make sure we delete them.
Add a ensure_unlinked() function to fileutils to help with the job.
https://bugzilla.gnome.org/show_bug.cgi?id=742298
jhbuild/utils/fileutils.py | 7 +++++++
jhbuild/utils/packagedb.py | 4 ++++
2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/jhbuild/utils/fileutils.py b/jhbuild/utils/fileutils.py
index b57d062..95def68 100644
--- a/jhbuild/utils/fileutils.py
+++ b/jhbuild/utils/fileutils.py
@@ -107,3 +107,10 @@ if os.name == 'nt':
rename = _windows_rename
else:
rename = os.rename
+
+def ensure_unlinked(filename):
+ try:
+ os.unlink(filename)
+ except OSError as e:
+ if e.errno != os.errno.ENOENT:
+ raise
diff --git a/jhbuild/utils/packagedb.py b/jhbuild/utils/packagedb.py
index 5b8acd6..29cf1e7 100644
--- a/jhbuild/utils/packagedb.py
+++ b/jhbuild/utils/packagedb.py
@@ -104,6 +104,9 @@ class PackageEntry:
fileutils.rename(os.path.join(self.manifests_dir, self.package + '.tmp'),
os.path.join(self.manifests_dir, self.package))
+ def remove(self):
+ fileutils.ensure_unlinked(os.path.join(self.manifests_dir, self.package))
+
def to_xml(self, doc):
entry_node = ET.Element('entry', {'package': self.package,
'version': self.version})
@@ -273,6 +276,7 @@ class PackageDB:
logging.warn(_("Failed to delete %(file)r: %(msg)s") % { 'file': path,
'msg': error_string})
+ self._entries[package_name].remove()
del self._entries[package_name]
self._write_cache()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]