Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 682226 - sci-geosciences/gpsd: generate proper udev rules on non systemd systems
Summary: sci-geosciences/gpsd: generate proper udev rules on non systemd systems
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Sci-geo Project
URL:
Whiteboard:
Keywords: EBUILD
Depends on:
Blocks:
 
Reported: 2019-04-01 14:20 UTC by Vladimir Datsevich
Modified: 2021-08-10 23:52 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Modified gpsd-3.17-r3.ebuild (gpsd-3.17-r3.ebuild,4.61 KB, text/plain)
2019-04-01 14:20 UTC, Vladimir Datsevich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Datsevich 2019-04-01 14:20:29 UTC
Created attachment 571440 [details]
Modified gpsd-3.17-r3.ebuild

Hello,

thank you very much for the gpsd ebuilds in the Portage tree. This is very much appreciated.

I stumbled uppon the following behaviour, which should not occur, when installing on non systemd systems.

The gpsd build system sets the systemd env when it finds the /lib/systemd/system directory on the system. Given, that /lib/systemd/system is present on non systemd systems in Gentoo, this systemd env is set always, rsulting in udev rules for systemd rather then for non systemd systems.

If you look in the SConstruct file in the gpsd sources you'll find the following passages:
http://git.savannah.gnu.org/cgit/gpsd.git/tree/SConstruct?h=release-3.18.1

(this behaviour is regardles of the version)

line 151:

systemd_dir = '/lib/systemd/system'
systemd = os.path.exists(systemd_dir)

this sets the systemd env;

line 1653:

if env['systemd']:
    udevcommand = 'TAG+="systemd", ENV{SYSTEMD_WANTS}="gpsdctl@%k.service"'
else:
    udevcommand = 'RUN+="%s/gpsd.hotplug"' % (env['udevdir'], )

which affects how the 25-gpsd.rules are generated;


Further looking in line 2433 you'll find this:

if env['systemd']:
    hotplug_wrapper_install = []
else:
    hotplug_wrapper_install = [
        'cp $SRCDIR/gpsd.hotplug ' + DESTDIR + env['udevdir'],
        'chmod a+x ' + DESTDIR + env['udevdir'] + '/gpsd.hotplug'
    ]


The behaviour of the gpsd build is to set the systemd env when /lib/systemd/system is found. From then on the build is build for a systemd system.

Solution:
Although one should not use a systemd use flag, I did in my proof of concept ebuild.

1.) add a systemd use flag to IUSE
2.) add $(use_scons systemd) to myesconsargs

Having this generates the 25-gpsd.rules as desired on non systemd system and also installs the gpsd.hotplug script to /lib/udev.

See the attached modified ebuild.

Thank you very much in advance ;)
Comment 1 Techwolf 2019-09-08 22:25:23 UTC
I encounter this bug on my system. Using the supplied modified ebuild fixed it.

Have you created a pull request in github gentoo?
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-08-09 23:49:44 UTC
Hey, is this still an issue?
Comment 3 Vladimir Datsevich 2021-08-10 10:46:58 UTC
@Sam James

yes, it is. The $(use_scons systemd) is still not set in the recent ebuilds.

I have not opened a PR since I was unsure about whether it is allowed to use "systemd" as a "use" argument.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-08-10 23:49:40 UTC
(In reply to Vladimir Datsevich from comment #3)
> @Sam James
> 
> yes, it is. The $(use_scons systemd) is still not set in the recent ebuilds.
> 
> I have not opened a PR since I was unsure about whether it is allowed to use
> "systemd" as a "use" argument.

It's generally OK for stuff like this where it affects the installed files, so let's go with it. On it..
Comment 5 Larry the Git Cow gentoo-dev 2021-08-10 23:52:03 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=82e0c0ea184a60062250520ced7bf6e319a2e609

commit 82e0c0ea184a60062250520ced7bf6e319a2e609
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-08-10 23:50:11 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-08-10 23:50:42 +0000

    sci-geosciences/gpsd: adjust udev rule based on USE=systemd
    
    Closes: https://bugs.gentoo.org/682226
    Signed-off-by: Sam James <sam@gentoo.org>

 sci-geosciences/gpsd/gpsd-3.23.ebuild | 4 ++--
 sci-geosciences/gpsd/gpsd-9999.ebuild | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)