diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-07-12 19:11:53 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-07-12 19:11:53 +0200 |
| commit | 5505821c0d13ff66e5943b610705f1c9b202d7fa (patch) | |
| tree | 0333b1a13e4cff83f7a3de88143ae88132457a5a | |
| parent | 5b489a994d009771d7f4d5beec45bbbb5468cd58 (diff) | |
| download | python-apt-5505821c0d13ff66e5943b610705f1c9b202d7fa.tar.gz | |
apt/package.py: Adjust AcquireFile() usage to future changes.
The underlying C++ objects of the AcquireFile() objects are currently
immortal. This should change at a later stage, to match the behavior of
the C++ class. But AcquireItems needs to be fixed first to not segfault
anymore.
| -rw-r--r-- | apt/package.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/apt/package.py b/apt/package.py index 072e86ca..0ce2da3a 100644 --- a/apt/package.py +++ b/apt/package.py @@ -454,13 +454,13 @@ class Version(object): print 'Ignoring already existing file:', destfile return acq = apt_pkg.Acquire(progress or apt.progress.TextFetchProgress()) - apt_pkg.AcquireFile(acq, self.uri, self._records.md5_hash, self.size, - base, destfile=destfile) + acqfile = apt_pkg.AcquireFile(acq, self.uri, self._records.md5_hash, + self.size, base, destfile=destfile) acq.run() - for item in acq.items: - if item.status != item.stat_done: - raise FetchError("The item %r could not be fetched: %s" % - (item.destfile, item.error_text)) + + if acqfile.status != acqfile.stat_done: + raise FetchError("The item %r could not be fetched: %s" % + (acqfile.destfile, acqfile.error_text)) return os.path.abspath(destfile) def fetch_source(self, destdir="", progress=None, unpack=True): @@ -489,6 +489,7 @@ class Version(object): src.lookup(self.package.name) except AttributeError: raise ValueError("No source for %r" % self) + files = list() for md5, size, path, type_ in src.files: base = os.path.basename(path) destfile = os.path.join(destdir, base) @@ -497,8 +498,8 @@ class Version(object): if _file_is_same(destfile, size, md5): print 'Ignoring already existing file:', destfile continue - apt_pkg.AcquireFile(acq, src.index.archive_uri(path), md5, size, - base, destfile=destfile) + files.append(apt_pkg.AcquireFile(acq, src.index.archive_uri(path), + md5, size, base, destfile=destfile)) acq.run() for item in acq.items: |
