Re: [gentoo-portage-dev] [PATCH] show binhosts as repository

2008-05-14 Thread Fabian Groffen
On 14-05-2008 00:45:10 +0200, Marius Mauch wrote:
 On Mon, 12 May 2008 20:53:35 +0200
 Fabian Groffen [EMAIL PROTECTED] wrote:
 
  The following patch shows the url to the binhost in an emerge -av as
  repository name, instead of unknown.  Unfortunately the patch
  doesn't store the binhost url, such that portage can't show where the
  package comes from when unmerged.
 
 Not sure if this is the right thing to do, or if the reponame in those
 cases should be the one from the source repo that was used to generate
 those binary packages. Not saying that the binhost name here is
 useless, quite the opposite, just a bit concerned about mixing
 different things here.

The idea behind it is that the repo_name of the binhost is not
necessarily useful.  In many cases it will contain the default repo_name
value, since people just create binpkgs with a standard Portage install.

I agree it is a hack.  Perhaps a combination of the repo_name and its
url would be the best.


-- 
Fabian Groffen
Gentoo on a different level
-- 
gentoo-portage-dev@lists.gentoo.org mailing list



[gentoo-portage-dev] [PATCH] show binhosts as repository

2008-05-12 Thread Fabian Groffen
The following patch shows the url to the binhost in an emerge -av as
repository name, instead of unknown.  Unfortunately the patch doesn't
store the binhost url, such that portage can't show where the package
comes from when unmerged.

-- 
Fabian Groffen
Gentoo on a different level
--- ../../trunk/pym/_emerge/__init__.py 2008-05-12 19:25:21 +0200
+++ ./pym/_emerge/__init__.py   2008-05-12 17:16:49 +0200
@@ -1117,6 +1126,6 @@
pkg_chost = pkg.metadata.get(CHOST)
if pkg_chost and pkg_chost != pkgsettings[CHOST]:
return False
if not portage.eapi_is_supported(pkg.metadata[EAPI]):
return False
if not pkg.installed and \
@@ -4447,13 +4471,18 @@
pkg = x
metadata = pkg.metadata
ebuild_path = None
-   repo_name = metadata[repository]
+   if pkg_type == binary:
+   repo_name = 
self.roots[myroot].settings.get(PORTAGE_BINHOST)
+   else:
+   repo_name = metadata[repository]
if pkg_type == ebuild:
ebuild_path = portdb.findname(pkg_key)
if not ebuild_path: # shouldn't happen
raise 
portage.exception.PackageNotFound(pkg_key)
repo_path_real = 
os.path.dirname(os.path.dirname(
os.path.dirname(ebuild_path)))
+   elif pkg_type == binary:
+   repo_path_real = repo_name
else:
repo_path_real = 
portdb.getRepositoryPath(repo_name)
pkg_use = metadata[USE].split()
@@ -5422,6 +5451,11 @@
self._repo_paths_real = [ os.path.realpath(repo_path) \
for repo_path in repo_paths ]
 
+   if root_config.settings.get(PORTAGE_BINHOST):
+   binhost = root_config.settings.get(PORTAGE_BINHOST)
+   self._repo_paths.append(binhost)
+   self._repo_paths_real.append(binhost)
+
# pre-allocate index for PORTDIR so that it always has index 0.
for root_config in roots.itervalues():
portdb = root_config.trees[porttree].dbapi