[jhbuild/desrt/master: 18/22] packagedb: store a separate 'info' file
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild/desrt/master: 18/22] packagedb: store a separate 'info' file
- Date: Mon, 19 Jan 2015 03:37:02 +0000 (UTC)
commit df01e01e3628853b1078f540e6ce85133b5518aa
Author: Ryan Lortie <desrt desrt ca>
Date: Sun Jan 18 10:25:50 2015 -0500
packagedb: store a separate 'info' file
Store a separate XML file for each package in the info/ subdirectory.
This will allow the entire content of a package to be easily turned into
a .tar file (since we don't have to deal with splitting out the separate
information from the packagedb).
https://bugzilla.gnome.org/show_bug.cgi?id=743127
jhbuild/utils/packagedb.py | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/jhbuild/utils/packagedb.py b/jhbuild/utils/packagedb.py
index 0ce956b..964fbba 100644
--- a/jhbuild/utils/packagedb.py
+++ b/jhbuild/utils/packagedb.py
@@ -77,12 +77,24 @@ class PackageEntry:
manifest = property(get_manifest, set_manifest)
def write(self):
+ # write info file
+ fileutils.mkdir_with_parents(os.path.join(self.dirname, 'info'))
+ writer = fileutils.SafeWriter(os.path.join(self.dirname, 'info', self.package))
+ ET.ElementTree(self.to_xml()).write(writer.fp)
+ writer.fp.write('\n')
+ writer.commit()
+
+ # write manifest
fileutils.mkdir_with_parents(os.path.join(self.dirname, 'manifests'))
writer = fileutils.SafeWriter(os.path.join(self.dirname, 'manifests', self.package))
writer.fp.write('\n'.join(self.manifest) + '\n')
writer.commit()
def remove(self):
+ # remove info file
+ fileutils.ensure_unlinked(os.path.join(self.dirname, 'info', self.package))
+
+ # remove manifest
fileutils.ensure_unlinked(os.path.join(self.dirname, 'manifests', self.package))
def to_xml(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]