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

Update Softwares/Gentoo.pm #1032

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

anyqov
Copy link

@anyqov anyqov commented Oct 21, 2022

Update Softwares/Gentoo.pm for software data collection to work

Update Softwares/Gentoo.pm for software data collection to work
@@ -20,7 +20,7 @@ sub doInventory {
my $logger = $params{logger};

my $command = _equeryNeedsWildcard() ?
"equery list -i '*'" : "equery list -i";
"equery list -i '*'" : "equery list -i '*'";
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @anyqov
this is wrong, you better need to change _equeryNeedsWildcard() to return true in your case as this what means the ? unary test: if _equeryNeedsWildcard() is true use equery list -i '*' as $command, otherwise use equery list -i.
Your change just breaks compatibility for the case it returns false.

Copy link
Author

@anyqov anyqov Oct 22, 2022

Choose a reason for hiding this comment

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

Thanks for the answer, @g-bougard.
Gentoo release 2.7, 5.15.25-gentoo-dist. Software detection doesn't work. I get:

equery -V:

equery (0.5.1-r1) - Gentoo package query tool

As I understand it, for equery version greater than 0.3 it should return true, but acts like false. What's wrong with _equeryNeedsWildcard()?

equery list -i

List installed packages matching the query pattern

!!! Default action for this module has changed in Gentoolkit 0.3.
!!! Use globbing to simulate the old behavior (see man equery).
!!! Use '' to check all installed packages.
!!! Use 'foo-bar/' to filter by category.

Usage: list [options] pkgspec

options
-h, --help display this help message
-d, --duplicates list only installed duplicate packages
-b, --binpkgs-missing list only installed packages without a corresponding
binary package
-f, --full-regex query is a regular expression
-m, --mask-reason include reason for package mask
-I, --exclude-installed exclude installed packages from output
-o, --overlay-tree list packages in overlays
-p, --portage-tree list packages in the main portage tree
-F, --format=TMPL specify a custom output format
TMPL a format template using (see man page):
$location, $mask, $mask2, $cp, $cpv, $category, $name, $version, $revision, $fullversion, $slot, $repo, $keywords

equery list -i '*'

acct-group/adm-0-r1
acct-group/audio-0-r1
acct-group/cdrom-0-r1
acct-group/cron-0
acct-group/crontab-0
...

In fusioninventory.log:

[Fri Oct 21 15:09:24 2022][debug] Running FusionInventory::Agent::Task::Inventory::Generic::Softwares
[Fri Oct 21 15:09:24 2022][debug] Running FusionInventory::Agent::Task::Inventory::Generic::Softwares::Gentoo
[Fri Oct 21 15:09:24 2022][debug2] executing equery list -i

Copy link
Contributor

Choose a reason for hiding this comment

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

The regexp on l.58 should match on:

equery (0.5.1-r1) - Gentoo package query tool

But it doesn't because of the -r1 suffix.
It should better be to accept anything after the third number:

        pattern => qr/^equery ?\((\d+)\.(\d+)\.\d+/,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants