From 5e9a685edb4cc9914521aa90e8017b1e0d5d41a7 Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Wed, 6 Feb 2008 12:23:37 +0000 Subject: [PATCH] pisi can read metadata and files of pisi files on the fly with no need to first extract them to some place. --- pisi/operations/build.py | 4 ++-- pisi/package.py | 21 +++------------------ 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/pisi/operations/build.py b/pisi/operations/build.py index 371263ee..25961464 100644 --- a/pisi/operations/build.py +++ b/pisi/operations/build.py @@ -697,7 +697,7 @@ class Builder: if pisi.util.is_package_name(os.path.basename(old_package_fn), package_name): try: old_pkg = pisi.package.Package(old_package_fn, 'r') - old_pkg.read(pisi.util.join_path(ctx.config.tmp_dir(), 'oldpkg')) + old_pkg.read() ctx.ui.info(_('(found old version %s)') % old_package_fn) if str(old_pkg.metadata.package.name) != package_name: ctx.ui.warning(_('Skipping %s with wrong pkg name ') % @@ -733,7 +733,7 @@ class Builder: # compare old files.xml with the new one.. old_pkg = pisi.package.Package(old_package_fn, 'r') - old_pkg.read(pisi.util.join_path(ctx.config.tmp_dir(), 'oldpkg')) + old_pkg.read() changed = False fnew = self.files.list diff --git a/pisi/package.py b/pisi/package.py index 34b1e017..c34fe328 100644 --- a/pisi/package.py +++ b/pisi/package.py @@ -121,24 +121,9 @@ class Package: files.parse(self.impl.read_file(ctx.const.files_xml)) return files - def read(self, outdir = None): - if not outdir: - outdir = ctx.config.tmp_dir() - - # extract control files - self.extract_pisi_files(outdir) - - self.metadata = pisi.metadata.MetaData() - self.metadata.read( os.path.join(outdir, ctx.const.metadata_xml) ) - errs = self.metadata.errors() - if errs: - util.print_errors(errs) - raise Error, _("MetaData format wrong") - - self.files = pisi.files.Files() - self.files.read( os.path.join(outdir, ctx.const.files_xml) ) - if self.files.errors(): - raise Error, _("Invalid %s") % ctx.const.files_xml + def read(self): + self.files = self.get_files() + self.metadata = self.get_metadata() def pkg_dir(self): packageDir = self.metadata.package.name + '-' \