diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-12-12 01:49:23 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-12-12 01:49:23 +0000 |
commit | fa4db765c94012584b1df3949f68666f4067035e (patch) | |
tree | 83a3b707da62119ab93b7df9ccdbae8fee113969 | |
parent | ab26befd0661dfaaea123d05139edf0394bd97e6 (diff) | |
download | portage-fa4db765c94012584b1df3949f68666f4067035e.tar.gz portage-fa4db765c94012584b1df3949f68666f4067035e.tar.bz2 portage-fa4db765c94012584b1df3949f68666f4067035e.zip |
Fix --getbinpkg to behave as expected with --pretend and --fetchonly.
svn path=/main/trunk/; revision=12212
-rw-r--r-- | pym/_emerge/__init__.py | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index d416bb6b3..dbe00b709 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -3195,7 +3195,7 @@ class Binpkg(CompositeTask): portage.prepare_build_dirs(self.settings["ROOT"], self.settings, 1) fetcher = BinpkgFetcher(background=self.background, logfile=self.settings.get("PORTAGE_LOG_FILE"), pkg=self.pkg, - scheduler=self.scheduler) + pretend=self.opts.pretend, scheduler=self.scheduler) pkg_path = fetcher.pkg_path self._pkg_path = pkg_path @@ -3222,6 +3222,12 @@ class Binpkg(CompositeTask): self.wait() return + if self.opts.pretend: + self._current_task = None + self.returncode = os.EX_OK + self.wait() + return + verifier = None if self._verify: logfile = None @@ -3391,7 +3397,7 @@ class Binpkg(CompositeTask): class BinpkgFetcher(SpawnProcess): - __slots__ = ("pkg", + __slots__ = ("pkg", "pretend", "locked", "pkg_path", "_lock_obj") def __init__(self, **kwargs): @@ -3405,17 +3411,19 @@ class BinpkgFetcher(SpawnProcess): return pkg = self.pkg + pretend = self.pretend bintree = pkg.root_config.trees["bintree"] settings = bintree.settings use_locks = "distlocks" in settings.features pkg_path = self.pkg_path - portage.util.ensure_dirs(os.path.dirname(pkg_path)) - if use_locks: - self.lock() + if not pretend: + portage.util.ensure_dirs(os.path.dirname(pkg_path)) + if use_locks: + self.lock() exists = os.path.exists(pkg_path) resume = exists and os.path.basename(pkg_path) in bintree.invalids - if not resume: + if not (pretend or resume): # Remove existing file or broken symlink. try: os.unlink(pkg_path) @@ -3434,6 +3442,12 @@ class BinpkgFetcher(SpawnProcess): uri = settings["PORTAGE_BINHOST"].rstrip("/") + \ "/" + pkg.pf + ".tbz2" + if pretend: + portage.writemsg_stdout("\n%s\n" % uri, noiselevel=-1) + self.returncode = os.EX_OK + self.wait() + return + protocol = urlparse.urlparse(uri)[0] fcmd_prefix = "FETCHCOMMAND" if resume: |