From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- sys-power/phctool/Manifest | 10 +++ .../phctool-0.5.2.2_all_paths_tool_no_sudo.patch | 17 +++++ .../phctool-0.5.2.2_all_paths_tool_sudo.patch | 18 +++++ .../files/phctool-0.5.2.2_all_paths_tray.patch | 32 +++++++++ .../files/phctool-0.5.2.2_gui_kernel_2.6.38.patch | 21 ++++++ .../files/phctool-0.5.2.2_kernel_2.6.36.patch | 79 ++++++++++++++++++++ sys-power/phctool/metadata.xml | 11 +++ sys-power/phctool/phctool-0.5.2.2-r3.ebuild | 84 ++++++++++++++++++++++ 8 files changed, 272 insertions(+) create mode 100644 sys-power/phctool/Manifest create mode 100644 sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_no_sudo.patch create mode 100644 sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_sudo.patch create mode 100644 sys-power/phctool/files/phctool-0.5.2.2_all_paths_tray.patch create mode 100644 sys-power/phctool/files/phctool-0.5.2.2_gui_kernel_2.6.38.patch create mode 100644 sys-power/phctool/files/phctool-0.5.2.2_kernel_2.6.36.patch create mode 100644 sys-power/phctool/metadata.xml create mode 100644 sys-power/phctool/phctool-0.5.2.2-r3.ebuild (limited to 'sys-power/phctool') diff --git a/sys-power/phctool/Manifest b/sys-power/phctool/Manifest new file mode 100644 index 000000000000..d5addc0995dc --- /dev/null +++ b/sys-power/phctool/Manifest @@ -0,0 +1,10 @@ +AUX phctool-0.5.2.2_all_paths_tool_no_sudo.patch 534 SHA256 dcc9a6b1549994ba3471d7cf5eab02af8fc9ec24818626fff6b08d638267bc7d SHA512 344da8cf2f6533650e731e2297ec15bba09c859de342f920300be82fbac4d82ad9786c28dbc3504ab36a6909c2588eacdffb41c86dd2c0462ad8c44d5bca6a5d WHIRLPOOL 48a02139b85aec1855439c42e37130e728ec33d74eaec764d56acb2c0075bcadc0d5c4b24ddb8d6ccd82a9bd16dbe6a946c7edf2294f5e7ce2d6166a51faad50 +AUX phctool-0.5.2.2_all_paths_tool_sudo.patch 547 SHA256 38d617e165846cc349aefd7b658a42fb12a3aa6eba626258b225479572d616e2 SHA512 ab21747a1ef55bff373871ec33b8edd98bd565f9a81b8d2e32248c0ccbeea9f454236f691714e06409e9524b5108c636112460d8839e1aee3879eca6430189f4 WHIRLPOOL d450f7a48eef00035850fc966c61f5166e02c86aae981d81b01a3e1c7c4e7860465af091661e58126468c479329a649d19acafc39c49248e2f72620e3d0cb139 +AUX phctool-0.5.2.2_all_paths_tray.patch 1043 SHA256 9f70b06ca68190829b128273bf64101600100628fa2519fecec7a57368f84ac8 SHA512 92585e64d70e3a8daf8dfa7f950edc2dfd50b50e39169ea68e0eea53a17779855e9f912452f6d82965add041a6d35d746a13d17749010aa8671b55c386e86aa2 WHIRLPOOL 34b14fd2f22feb59bf407c2c2dd2b14acae438e4a8147ab0dd51e0343d3c26ed6200a0d8fe091cf4273fc9901b598638b91f834304e77d9647afa483474d2053 +AUX phctool-0.5.2.2_gui_kernel_2.6.38.patch 879 SHA256 069ea00f62aab1d1c61652d6d095412f72e9506971998ce103d454d7d91cde57 SHA512 9a45ee7a506e5520fa155336915fed2e149d5c7f033024d13391bf750424e47ed43c6a7820e599b45aaed5b5fbf466409fdeff505857087c124f0862259c22a1 WHIRLPOOL 53d4cff55a762bea6e8c485d87973beb6fb9780c7381e6a60fc62a14f8fa9555aba6f61a6af9bc24c9cf36ea18085a2b1281d90e23d0e460af229701160d9b10 +AUX phctool-0.5.2.2_kernel_2.6.36.patch 3527 SHA256 bfd1e0c5c1a061562c6ca01d6bc8ebc2b2fb04e2e796d23fc13daba8eb48e235 SHA512 61407bb85f8d552ee6aa448e473e627a55a23b882fdaf5c99808b8ba6f71418f0d9e9142d5e3931d184994ff983a6d222843d5b6590d9eee8965a8bfefe5a930 WHIRLPOOL 495d91cbfc4713de673af368071a1a89776f9333a11bf378e5efae37fc07054c9a896dc30fdd0a04a62269e8aca4433990450361d99e4d890ddda657331e9023 +DIST phctool-0.5.2.2.tar.gz 941587 SHA256 ef60b13a74e7a123008a93d02759e99537a58c40091774a7e70e3e1d5960fa4a SHA512 50beafb8d96b070563f4fcef93f1a07285b4347a05df70aee06aeac9b7c80642d8f967321b499d733c1734d36c7ebda6379094f5eb9a5bee648d7aa1f6c23053 WHIRLPOOL 09f463d327a29890eae838c90dcfdaeca27b5e506d2f9bf476c0d452b5ef08edb979a0dc716f7118028cfc1af2167897eb565ff70de39b9884769c70844a3c62 +EBUILD phctool-0.5.2.2-r3.ebuild 2094 SHA256 195fe72eb7c4ea91dee60b3d1dd1a7b45af7a0936929c64851e65ea60f0fa142 SHA512 68dab3a399da8023536ef56267ab7c384671d4be41d791d9e766aa6a8da5e8ea5797fc8e42e055bb57ace9c1279eefd0e525fcb30c8681546a47f1c8b9545fa5 WHIRLPOOL b4e5ac2b84a48eadd165c8a74868f8ca8bceeb287b333fac2ffcf6cc4e1419b6dc39558fe217363c544e630947cfbf9b59f5b7614f147341355c5bf84bb6dc93 +MISC ChangeLog 2499 SHA256 e0fb91ad4625259203081516011f0ce070763933b48dad0db9952416369e2399 SHA512 c004cc413d6b4e7498d3a17fd135d6edfa2315edc73801d3855e1f54655faa0290aaaf290763416e24fa60a60cabe4d83175a834e8b72edda188dad7891118cf WHIRLPOOL 028cbcd39a9789e82fe2c659eac1d1e396c5a93a759a19889e6591cc6640e1af21d75f7c6346e9b7d69789a60c9948b03221d7ffd1f30f30a82755f6fa85b68d +MISC ChangeLog-2015 1537 SHA256 c6d13834424c43bd71176804c866b181131ee74231a03976f20247c7eb49d6bd SHA512 15a13125d2271935de60aa481340404fa7db888a989ea29e69238b365a7b17c1ffd135e0c8b6421504be9d6b13513cb46e777445c9bb2f4ee5a7ea5f972e9208 WHIRLPOOL 6c09f5c8d42361f2dbf0bebb1f6bfaac545e98a3585dfc63791ad8f823a98bc335c47c7ba409bda530c8befa81bd28b2697f9acae24807e6fb5224911726524a +MISC metadata.xml 331 SHA256 a5ee536034f3a7742a62796d039ef566a5bd80a5715636ea692d20a77625009e SHA512 29e807bda7452cd13c7f6ed65d0f6fa7ed467fe7ba3408d8fb394909e02e7b68507e3122dcddbd54d715843d63741c16ed3fce5562610aa17d41cb98efc8cdba WHIRLPOOL 2f8cce0642fa4d5e7d48a5f032e77d73c71b60def954fbf2c020aab9b12355b39e389bcebb3f776c0ef046d5cd7e6cdb302b13f3960f0181fde9b2efa180196a diff --git a/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_no_sudo.patch b/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_no_sudo.patch new file mode 100644 index 000000000000..316e538abe0d --- /dev/null +++ b/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_no_sudo.patch @@ -0,0 +1,17 @@ +--- a/phctool.sh 2007-10-27 22:32:35.000000000 +0200 ++++ b/phctool.sh 2009-09-05 23:20:18.000000000 +0200 +@@ -1,10 +1,7 @@ + #!/bin/sh +-#this shellscript is just a wrapper to subphctool.sh +-#but necessary to run phctool with sudo even from the tray icon +-PROGPATH=`dirname "$0"` +-cd $PROGPATH +-if test -e /usr/bin/gksu +- then gksu ./subphctool.sh $1 +- else sudo ./subphctool.sh $1 +-fi ++#this shellscript is just a wrapper to phctool.py ++#but necessary to run phctool from another directory ++ ++cd /usr/share/phctool ++./phctool.py $1 diff --git a/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_sudo.patch b/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_sudo.patch new file mode 100644 index 000000000000..11b64c3bab07 --- /dev/null +++ b/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tool_sudo.patch @@ -0,0 +1,18 @@ +--- a/phctool.sh 2007-10-27 22:32:35.000000000 +0200 ++++ b/phctool.sh 2009-09-05 23:20:18.000000000 +0200 +@@ -1,10 +1,7 @@ + #!/bin/sh +-#this shellscript is just a wrapper to subphctool.sh +-#but necessary to run phctool with sudo even from the tray icon +-PROGPATH=`dirname "$0"` +-cd $PROGPATH +-if test -e /usr/bin/gksu +- then gksu ./subphctool.sh $1 +- else sudo ./subphctool.sh $1 +-fi ++#this shellscript is just a wrapper to subphctool.py ++#but necessary to run phctool from another directory ++ ++cd /usr/share/phctool ++sudo ./subphctool.sh $1 + diff --git a/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tray.patch b/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tray.patch new file mode 100644 index 000000000000..1d2053a9c4b7 --- /dev/null +++ b/sys-power/phctool/files/phctool-0.5.2.2_all_paths_tray.patch @@ -0,0 +1,32 @@ +--- a/phctray.sh 2007-09-08 08:29:31.000000000 +0200 ++++ b/phctray.sh 2009-09-05 23:16:54.000000000 +0200 +@@ -2,6 +2,5 @@ + #this shellscript is just a wrapper to phctray.py + #but necessary to run phctray from another directory + +-PROGPATH=`dirname "$0"` +-cd $PROGPATH ++cd /usr/share/phctool + ./phctray.py +--- a/phctray.py 2009-09-08 12:17:11.000000000 +0200 ++++ b/phctray.py 2009-09-08 12:17:33.000000000 +0200 +@@ -61,7 +61,7 @@ + t.show_all() + + ##call phctool without GUI to set stored values +-cmd=[sys.path[0]+"/phctool.sh","background"] ##command ++cmd=["/usr/bin/phctool","background"] ##command + subprocess.Popen(cmd, shell=False) ##call the affinated programm + + gtk.main() +--- a/phctray.py 2009-09-08 12:22:28.000000000 +0200 ++++ b/phctray.py 2009-09-08 12:23:44.000000000 +0200 +@@ -11,7 +11,7 @@ + return; + + def run_phctool( *args ): +- cmd=[sys.path[0]+"/phctool.sh"] ##command ++ cmd=["/usr/bin/phctool"] ##command + subprocess.Popen(cmd, shell=False) ##call the affinated programm + + def applet_face_click( window, event, *data ): diff --git a/sys-power/phctool/files/phctool-0.5.2.2_gui_kernel_2.6.38.patch b/sys-power/phctool/files/phctool-0.5.2.2_gui_kernel_2.6.38.patch new file mode 100644 index 000000000000..db33396e3d17 --- /dev/null +++ b/sys-power/phctool/files/phctool-0.5.2.2_gui_kernel_2.6.38.patch @@ -0,0 +1,21 @@ +--- phctool/inc/libs/cpuinfo.py ++++ phctool/inc/libs/cpuinfo.py +@@ -1,6 +1,7 @@ + #cpuinfo.py + #This is a function library to get + #informations about CPUs and its PHC data ++#Modified by Fabio Veronese fveronese85*at*gmail.com 22 Mar 2011 + + + import os, string +@@ -30,6 +31,10 @@ + if os.path.exists('/proc/acpi/processor/CPU'+cpunr): + ##remember ACPI Pathname + self.data[cpunr]['acpi']['acpiname']='/proc/acpi/processor/CPU'+cpunr ++ elif os.path.exists('/sys/devices/system/cpu/cpu'+cpunr+'/thermal_throttle'): ++ ##here some throttling infos for 2.6.38 and maybe laters ++ #self.data[cpunr]['acpi']['acpiname']='/sys/devices/system/cpu/cpu'+cpunr+'/thermal_throttle' ++ self.data[cpunr]['acpi']['acpiname']='' + else: + self.data[cpunr]['acpi']['exist']=False + # For some reason we have to fallback on the old function... diff --git a/sys-power/phctool/files/phctool-0.5.2.2_kernel_2.6.36.patch b/sys-power/phctool/files/phctool-0.5.2.2_kernel_2.6.36.patch new file mode 100644 index 000000000000..c3a2432aea2d --- /dev/null +++ b/sys-power/phctool/files/phctool-0.5.2.2_kernel_2.6.36.patch @@ -0,0 +1,79 @@ +--- phctool/inc/libs/cpuinfo.py ++++ phctool/inc/libs/cpuinfo.py +@@ -14,33 +14,49 @@ + + + def _get_acpi_cpus(self): +- ##count number of CPUs on this system using acpi proc interface +- ##since we need acpi this i a good way to count CPUs +- ##we also will remember the Directory-Name because on single CPU +- ##systems the Dir may be named CPU while on Multicores they are indexed (CPU0, CPU1) .. +- directory="/proc/acpi/processor/" +- for f in os.listdir(directory): ##iterate the directory +- pathname = os.path.join(directory, f) ## +- if os.path.isdir(pathname): ##is the object we found really a (sub-)directory? +- ##We open the info-file to get the ID to this CPU, +- ##i don't know if this really could happen but the ID may differ from +- ##from the Path iterator (maybe one CPU is supported and another isn't) +- if os.path.exists(pathname+'/info'): +- file = open(pathname+'/info', 'r'); +- for line in file: +- if string.find(line,":"): +- content = line.split(":"); +- if len(content)>1: +- info_ident=content[0].strip(); +- info_value=content[1].strip(); +- if info_ident == "processor id": +- cpunr=info_value +- self.data[cpunr]={} +- self.data[cpunr]['acpi']={} +- self.data[cpunr]['acpi']['exist']=True +- self.data[cpunr]['acpi']['acpiname']=f ##remember ACPI Pathname +- else: +- self.data[cpunr]['acpi']['exist']=False ++ # We need to ignore /proc/acpi/processor as it's becoming deprecated ++ # A good solution might be a look in online cpus, but it doesn't mean they are surely ACPI-supported ++ if os.path.exists('/sys/devices/system/cpu/online'): ++ file = open('/sys/devices/system/cpu/online', 'r'); ++ for line in file: ++ if string.find(line,"-"): ++ content = line.split("-"); ++ for val in content: ++ cpunr=val.strip(); ++ self.data[cpunr]={} ++ self.data[cpunr]['acpi']={} ++ self.data[cpunr]['acpi']['exist']=True ++ # This sounds useful just for throttling, which is managed better by other stuff... I'll keep just for compatibility ++ if os.path.exists('/proc/acpi/processor/CPU'+cpunr): ++ ##remember ACPI Pathname ++ self.data[cpunr]['acpi']['acpiname']='/proc/acpi/processor/CPU'+cpunr ++ else: ++ self.data[cpunr]['acpi']['exist']=False ++ # For some reason we have to fallback on the old function... ++ else: ++ directory="/proc/acpi/processor/" ++ for f in os.listdir(directory): ##iterate the directory ++ pathname = os.path.join(directory, f) ## ++ if os.path.isdir(pathname): ##is the object we found really a (sub-)directory? ++ ##We open the info-file to get the ID to this CPU, ++ ##i don't know if this really could happen but the ID may differ from ++ ##from the Path iterator (maybe one CPU is supported and another isn't) ++ if os.path.exists(pathname+'/info'): ++ file = open(pathname+'/info', 'r'); ++ for line in file: ++ if string.find(line,":"): ++ content = line.split(":"); ++ if len(content)>1: ++ info_ident=content[0].strip(); ++ info_value=content[1].strip(); ++ if info_ident == "processor id": ++ cpunr=info_value ++ self.data[cpunr]={} ++ self.data[cpunr]['acpi']={} ++ self.data[cpunr]['acpi']['exist']=True ++ self.data[cpunr]['acpi']['acpiname']=f ##remember ACPI Pathname ++ else: ++ self.data[cpunr]['acpi']['exist']=False + + + def _get_cpuinfos(self): diff --git a/sys-power/phctool/metadata.xml b/sys-power/phctool/metadata.xml new file mode 100644 index 000000000000..9148655f78bf --- /dev/null +++ b/sys-power/phctool/metadata.xml @@ -0,0 +1,11 @@ + + + + +xmw@gentoo.org +Michael Weber + + + Enable support for sudo to run gui from non-root user + + diff --git a/sys-power/phctool/phctool-0.5.2.2-r3.ebuild b/sys-power/phctool/phctool-0.5.2.2-r3.ebuild new file mode 100644 index 000000000000..c33953a060fe --- /dev/null +++ b/sys-power/phctool/phctool-0.5.2.2-r3.ebuild @@ -0,0 +1,84 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python2_7 ) +inherit python-single-r1 user + +DESCRIPTION="Processor Hardware Control userland configuration tool" +HOMEPAGE="http://www.linux-phc.org/" +SRC_URI="http://www.linux-phc.org/forum/download/file.php?id=50 -> ${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="doc sudo" + +DEPEND="${PYTHON_DEPS} + dev-python/egg-python[${PYTHON_USEDEP}] + dev-python/pygtk:2[${PYTHON_USEDEP}]" +RDEPEND="${DEPEND} + sudo? ( app-admin/sudo )" + +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +S="${WORKDIR}/${PV%.*}-${PV##*.}/${PN}" + +pkg_setup() { + MY_PROGDIR="/usr/share/${PN}" + if use sudo ; then + MY_GROUPNAME="phcusers" + enewgroup ${MY_GROUPNAME} + fi + python-single-r1_pkg_setup +} + +src_prepare() { + eapply "${FILESDIR}"/${P}_all_paths_tray.patch + if use sudo ; then + eapply "${FILESDIR}"/${P}_all_paths_tool_sudo.patch + else + eapply "${FILESDIR}"/${P}_all_paths_tool_no_sudo.patch + fi + eapply "${FILESDIR}"/${P}_kernel_2.6.36.patch + eapply "${FILESDIR}"/${P}_gui_kernel_2.6.38.patch + eapply_user + find . -name "*.pyc" -delete || die + python_fix_shebang . +} + +src_install() { + newbin phctool.sh phctool + newbin phctray.sh phctray + + exeinto ${MY_PROGDIR} + doexe phc{tool,tray}.py subphctool.sh + python_moduleinto ${MY_PROGDIR} + python_domodule inc + + if use sudo ; then + fowners -R ":${MY_GROUPNAME}" "${MY_PROGDIR}" + fperms g+rX "${MY_PROGDIR}" + dodir /etc/sudoers.d + echo "#%${MY_GROUPNAME} ALL=(root) NOPASSWD:${MY_PROGDIR}/subphctool.sh" \ + > "${ED}"/etc/sudoers.d/${PN} || die + fperms a-w,o-r /etc/sudoers.d/${PN} + fi + + dodoc CHANGELOG + if use doc; then + docinto html + dodoc -r doc/docfiles doc/index.htm + fi +} + +pkg_postinst() { + if use sudo; then + einfo "You have to add a line to /etc/sudoers to get access to" + einfo "/sys/devices/system/cpu/cpu1/cpufreq/phc_controls from the phctool/phctray" + einfo "Please check and uncomment the content of /etc/sudoers.d/${PN}" + else + einfo "Group not automatically added. Please run phctool as root." + fi +} -- cgit v1.2.3