Skip to content

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

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.

2 participants