Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Recent decision to make FEATURES=pkgdir-index-trusted is now on by default breaks eclean-invalids feature. #34

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions pym/gentoolkit/eclean/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import stat
import sys
from functools import partial
from inspect import signature
from typing import Optional

import portage
Expand All @@ -16,13 +17,12 @@

import gentoolkit.pprinter as pp
from gentoolkit.eclean.exclude import (
exclDictMatchCP,
exclDictExpand,
exclDictExpandPkgname,
exclDictMatchCP,
exclMatchFilename,
)


# Misc. shortcuts to some portage stuff:
port_settings = portage.settings
pkgdir = port_settings["PKGDIR"]
Expand Down Expand Up @@ -568,7 +568,12 @@ def findPackages(
dead_binpkgs: dict[str, list[str]] = {}
keep_binpkgs = {}

bin_dbapi = portage.binarytree(pkgdir=pkgdir, settings=var_dbapi.settings).dbapi
# FEATURES=pkgdir-index-trusted is now on by default which makes portages inavlids
# inaccessible
settings = var_dbapi.settings
bin_dbapi = portage.binarytree(pkgdir=pkgdir, settings=settings).dbapi
Copy link
Member

@zmedico zmedico Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can instead call bin_dbapi.bintree.populate(force_reindex=True) here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I'll do this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this parameter was added in gentoo/portage@c9fb98b which is not in a portage release yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this parameter was added in gentoo/portage@c9fb98b which is not in a portage release yet.

Ah so there might be a chance that portage wont go forward with that change ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it probably will, but the parameter can't be used unless it's supported. We can used inspect.signature to check if it's supported:

https://docs.python.org/3/library/inspect.html#inspect.signature

Copy link
Contributor Author

@hyprsyd hyprsyd Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it probably will, but the parameter can't be used unless it's supported. We can used inspect.signature to check if it's supported:

https://docs.python.org/3/library/inspect.html#inspect.signature

Ah sorry for earlier that was wrong this works but I'm not so sure if you meant this e4345ee

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks!

if "force_reindex" in signature(bin_dbapi.bintree.populate).parameters:
bin_dbapi.bintree.populate(force_reindex=True)
for cpv in bin_dbapi.cpv_all():
cp = portage.cpv_getkey(cpv)

Expand Down
Loading