Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 584814 - app-eselect/eselect-cpugov-0.1: eselect frequency/governor cpu control module (new package)
Summary: app-eselect/eselect-cpugov-0.1: eselect frequency/governor cpu control module...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Default Assignee for New Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-02 00:09 UTC by Walter Dnes
Modified: 2016-06-09 13:42 UTC (History)
3 users (show)

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


Attachments
Proposed cpugov.eselect module (cpugov.eselect.gz,2.50 KB, application/gzip)
2016-06-02 00:09 UTC, Walter Dnes
Details
Preliminary eselect-cpugov-0.1.ebuild (eselect-cpugov-0.1.ebuild,404 bytes, text/plain)
2016-06-04 19:35 UTC, Walter Dnes
Details
Latest ebuild (eselect-cpugov-0.1.ebuild,388 bytes, text/plain)
2016-06-08 19:13 UTC, Walter Dnes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Walter Dnes 2016-06-02 00:09:49 UTC
Created attachment 436122 [details]
Proposed cpugov.eselect module

Attached is a proposed cpugov.eselect module for manually selecting governors and/or frequencies for cpus. This will work with modern cpus, including desktops, if frequency scaling support is compiled into the kernel, or as a module. But the obvious target will be laptops, etc.

This will work from the bash commandline, or in a script. psuedo-governors "max" and "min" have been added. Note that some advanced Intel cpus may change frequencies even while in performance or powersave mode. cpugov "max" and "min" prevent that. As usual, root or sudo permission is required to change frequencies/governors.

I'm not a developer, and don't know how to go about doing the ebuild, let alone adding it to the Gentoo tree. But I am willing to be proxy-maintainer for "eselect cpugov". I'll be using it on my machines. Thanks to Ulrich Mueller for helping me get this module into conformance with Gentoo specs.
Comment 1 Mike Gilbert gentoo-dev 2016-06-02 11:25:24 UTC
It sounds like you have re-implemented a subset of sys-apps/cpupower. Why?
Comment 2 Walter Dnes 2016-06-02 18:17:21 UTC
(In reply to Mike Gilbert from comment #1)
> It sounds like you have re-implemented a subset of sys-apps/cpupower. Why?

With "a very small subset" of the required space, too.

[i3][waltdnes][~] emerge -pv cpupower

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] sys-apps/pciutils-3.3.1::gentoo  USE="kmod zlib -dns -static-libs -udev" 385 KiB
[ebuild  N     ] sys-power/cpupower-3.18::gentoo  USE="-cpufreq_bench -debug -nls" 79,038 KiB

Total: 2 packages (2 new), Size of downloads: 79,423 KiB

cpugov.eselect, fully expanded, is 7511 bytes. I'm afraid to ask how much space cpupower consumes once the 79 megabyte tarball is expanded and built. WHY does it need that much stuff???
Comment 3 Mike Gilbert gentoo-dev 2016-06-02 19:11:54 UTC
(In reply to Walter Dnes from comment #2)
> cpugov.eselect, fully expanded, is 7511 bytes. I'm afraid to ask how much
> space cpupower consumes once the 79 megabyte tarball is expanded and built.
> WHY does it need that much stuff???

cpupower is shipped as part of the linux kernel sources, so the 79 MB is a full copy of the linux kernel source code.

The size could be reduced by repacking the source code in a new tarball.
Comment 4 Mike Gilbert gentoo-dev 2016-06-02 19:23:39 UTC
Adding eselect@g.o in case they want to pick this up.
Comment 5 Mike Gilbert gentoo-dev 2016-06-02 20:45:19 UTC
> % emerge -pv1 cpupower
> 
> These are the packages that would be merged, in order:
> 
> Calculating dependencies... done!
> [ebuild   R    ] sys-power/cpupower-4.5.0::gentoo  USE="nls -cpufreq_bench -debug" 67 KiB
> 
> Total: 1 package (1 reinstall), Size of downloads: 67 KiB

That's a bit nicer. ;)
Comment 6 Ulrich Müller gentoo-dev 2016-06-03 14:15:45 UTC
(In reply to Walter Dnes from comment #0)
> I'm not a developer, and don't know how to go about doing the ebuild, let
> alone adding it to the Gentoo tree. But I am willing to be proxy-maintainer
> for "eselect cpugov".

In order that you can proxy maintain it, there needs to be an ebuild first. Which should be easy to write: no eclasses, and only one function, namely src_install() with a single insinto/doins pair. Also there are plenty of examples in the app-eselect category.
Comment 7 Walter Dnes 2016-06-04 19:15:13 UTC
The ebuild process includes downloading the file, which raises the next question... where should I post it? Is there a preferred site like github or dev.gentoo.org? I'll need to set up an account at whatever site I use.
Comment 8 Walter Dnes 2016-06-04 19:35:47 UTC
Created attachment 436480 [details]
Preliminary eselect-cpugov-0.1.ebuild
Comment 9 nvinson234 2016-06-05 00:12:33 UTC
> SRC_URI="https://dev.gentoo.org/~xxxxxx/distfiles/${P}.gz"
Probably better to put this on a source hosting site like github.com or gitlab.com instead of expecting a developer to keep sources in personal dev space.

Also the eselect module appears to have been gzipped twice.  Was that intentional?
Comment 10 Mike Gilbert gentoo-dev 2016-06-05 00:53:47 UTC
(In reply to nvinson234 from comment #9)
> Also the eselect module appears to have been gzipped twice.  Was that
> intentional?

That's a bug in your web browser. Fetch it with wget and it will only be compressed once. 

Of course, there was no need to compress a 7k file in the first place.
Comment 11 nvinson234 2016-06-05 01:54:48 UTC
(In reply to Mike Gilbert from comment #10)
> 
> That's a bug in your web browser. Fetch it with wget and it will only be
> compressed once. 

so it is.  Thanks for the heads up.  I retract my question.
Comment 12 Walter Dnes 2016-06-08 19:13:49 UTC
Created attachment 436906 [details]
Latest ebuild
Comment 13 Walter Dnes 2016-06-08 19:18:43 UTC
I hate this. I had a long comment, added an attachment, and only the attachment came through. Ugh. Anyhow, IANAD (I Am Not A Developer). I wanted to test the latest ebuild, but something is not properly set up in my local overlay. I think I followed the wiki instructions fully. Anyhow, here's what happens when I tried "emerge eselect-cpugov-0.1.ebuild digest"

*** emerging by path is broken and may not always work!!!

Calculating dependencies / * Manifest not found for '/usr/local/portage/app-eselect/eselect-cpugov/eselect-cpugov-0.1.ebuild'

*** You are emerging a masked package. It is MUCH better to use
*** /etc/portage/package.* to accomplish this. See portage(5) man
*** page for details.
>>> Waiting 10 seconds before starting...
>>> (Control-C to abort)...
Continuing... in: 10 9 8 7 6 5 4 3 2 1
... done!
Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/emerge", line 50, in <module>
    retval = emerge_main()
  File "/usr/lib64/python2.7/site-packages/_emerge/main.py", line 1185, in emerge_main
    return run_action(emerge_config)
  File "/usr/lib64/python2.7/site-packages/_emerge/actions.py", line 3236, in run_action
    emerge_config.args, spinner)
  File "/usr/lib64/python2.7/site-packages/_emerge/actions.py", line 324, in action_build
    settings, trees, myopts, myparams, myaction, myfiles, spinner)
  File "/usr/lib64/python2.7/site-packages/_emerge/depgraph.py", line 9196, in backtrack_depgraph
    myaction, myfiles, spinner)
  File "/usr/lib64/python2.7/site-packages/_emerge/depgraph.py", line 9233, in _backtrack_depgraph
    success, favorites = mydepgraph.select_files(myfiles)
  File "/usr/lib64/python2.7/site-packages/_emerge/depgraph.py", line 3583, in select_files
    return self._select_files(args)
  File "/usr/lib64/python2.7/site-packages/_emerge/depgraph.py", line 3685, in _select_files
    os.path.dirname(os.path.dirname(os.path.dirname(ebuild_path)))))
  File "/usr/lib64/python2.7/site-packages/_emerge/depgraph.py", line 6532, in _pkg
    raise portage.exception.PackageNotFound(cpv)
PackageNotFound: app-eselect/eselect-cpugov-0.1
Comment 14 Walter Dnes 2016-06-08 19:20:52 UTC
Oh, I forgot to mention the Github location...
https://github.com/walterdnes/cpugov/blob/master/cpugov.eselect
Comment 15 Ulrich Müller gentoo-dev 2016-06-09 11:11:12 UTC
(In reply to Walter Dnes from comment #12)
> Created attachment 436906 [details]
> Latest ebuild

> # Copyright 2016 Gentoo Foundation
> # Distributed under the terms of the GNU General Public License v2
> # $Id$

Please use the standard header from header.txt.

>
> EAPI=5

Why not EAPI 6?

>
> DESCRIPTION="Manages cpu governor and frequency selection"
> HOMEPAGE="https://www.gentoo.org"

https://wiki.gentoo.org/wiki/No_homepage would be a better choice here.

> SRC_URI="https://github.com/walterdnes/${P}"

This cannot be unpacked automatically. You need a tarball and/or compression there, otherwise an explicit src_unpack function would be needed. (But see below.)

>
> LICENSE="GPL-2"

Should be GPL-2+ because the license is GPL v2 or later.

> SLOT="0"
> KEYWORDS="amd64 x86"

Don't start with stable keywords.

> IUSE=""

Not needed.

There should be an RDEPEND on app-admin/eselect.

>
> src_install() {
> 	insinto /usr/share/eselect/modules
> 	doins cpugov.eselect
> }


(In reply to Walter Dnes from comment #14)
> Oh, I forgot to mention the Github location...
> https://github.com/walterdnes/cpugov/blob/master/cpugov.eselect

I guess you should make a release there, in order to create a distfile that can be automatically unpacked.
Comment 16 nvinson234 2016-06-09 13:42:14 UTC
(In reply to Walter Dnes from comment #13)
> I hate this. I had a long comment, added an attachment, and only the
> attachment came through. Ugh. Anyhow, IANAD (I Am Not A Developer). I wanted
> to test the latest ebuild, but something is not properly set up in my local
> overlay. I think I followed the wiki instructions fully. Anyhow, here's what
> happens when I tried "emerge eselect-cpugov-0.1.ebuild digest"
> 
> *** emerging by path is broken and may not always work!!!
> 
> Calculating dependencies / * Manifest not found for
> '/usr/local/portage/app-eselect/eselect-cpugov/eselect-cpugov-0.1.ebuild'
> 
> *** You are emerging a masked package. It is MUCH better to use
> *** /etc/portage/package.* to accomplish this. See portage(5) man
> *** page for details.
> >>> Waiting 10 seconds before starting...
> >>> (Control-C to abort)...
> Continuing... in: 10 9 8 7 6 5 4 3 2 1
> ... done!
> Traceback (most recent call last):

To update the manifest: ebuild eselect-cpugov-0.1.ebuild manifest.

That said, you might consider joining the IRC channel #gentoo-proxy-maint or the IRC channel #gentoo-dev-help for help in crafting and testing the ebuild.  Both channels are on freenode's IRC network (irc.freenode.net).