diff options
-rw-r--r-- | .SRCINFO | 28 | ||||
-rw-r--r-- | 0001-fix-option-string.patch | 115 | ||||
-rw-r--r-- | PKGBUILD | 53 | ||||
-rw-r--r-- | htop-temperature-rpi.patch | 261 |
4 files changed, 457 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..cdaaf5ea9db1 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,28 @@ +pkgbase = htop-temperature-rpi + pkgdesc = Interactive process viewer with added support for CPU temperature. Version for gathering Raspberry Pi CPU temperature from vcgencmd + pkgver = 2.2.0 + pkgrel = 1 + url = http://hisham.hm/htop/ + arch = i686 + arch = x86_64 + arch = aarch64 + arch = armv7h + arch = armv6h + license = GPL + makedepends = python + depends = ncurses + depends = libnl + optdepends = lsof: show files opened by a process + optdepends = strace: attach to a running process + provides = htop + conflicts = htop + options = !emptydirs + source = http://hisham.hm/htop/releases/2.2.0/htop-2.2.0.tar.gz + source = htop-temperature-rpi.patch + source = 0001-fix-option-string.patch + sha256sums = d9d6826f10ce3887950d709b53ee1d8c1849a70fa38e91d5896ad8cbc6ba3c57 + sha256sums = 933e8b41668282ccfc0e3e82ca9559022360e803c8c42a2ddee223ba31198338 + sha256sums = 550c2806ccae779203ec610b73d2c5b977df3f963ad79675a611da48accf6e0d + +pkgname = htop-temperature-rpi + diff --git a/0001-fix-option-string.patch b/0001-fix-option-string.patch new file mode 100644 index 000000000000..ee3b22bfd5c5 --- /dev/null +++ b/0001-fix-option-string.patch @@ -0,0 +1,115 @@ +<!DOCTYPE html> +<html lang='en'> +<head> +<title>0001-fix-option-string.patch\trunk - svntogit/packages.git - Git clone of the 'packages' repository +</title> +<meta name='generator' content='cgit v0.12'/> +<meta name='robots' content='index, nofollow'/> +<link rel='stylesheet' type='text/css' href='/cgit.css'/> +<link rel='shortcut icon' href='/favicon.ico'/> +<link rel='alternate' title='Atom feed' href='https://git.archlinux.org/svntogit/packages.git/atom/trunk/0001-fix-option-string.patch?h=packages/htop' type='application/atom+xml'/> +<link rel='vcs-git' href='https://git.archlinux.org/svntogit/packages.git' title='svntogit/packages.git Git repository'/> +<link rel='vcs-git' href='git://git.archlinux.org/svntogit/packages.git' title='svntogit/packages.git Git repository'/> +<link rel='vcs-git' href='ssh://git.archlinux.org/srv/git/svntogit/packages.git' title='svntogit/packages.git Git repository'/> +</head> +<body> + <div id="archnavbar"><!-- Arch Linux global navigation bar --> + <div id="archnavbarlogo"> + <p><a href="http://www.archlinux.org/" title="Arch news, packages, projects and more"></a></p> + </div> + <div id="archnavbarmenu"> + <ul id="archnavbarlist"> + <li id="anb-home"><a href="http://www.archlinux.org/" title="Arch news, packages, projects and more">Home</a></li> + <li id="anb-packages"><a href="http://www.archlinux.org/packages/" title="Arch Package Database">Packages</a></li> + <li id="anb-forums"><a href="https://bbs.archlinux.org/" title="Community forums">Forums</a></li> + <li id="anb-wiki"><a href="https://wiki.archlinux.org/" title="Community documentation">Wiki</a></li> + <li id="anb-bugs"><a href="https://bugs.archlinux.org/" title="Report and follow bugs">Bugs</a></li> + <li id="anb-sec"><a href="https://security.archlinux.org/" title="Security Tracker">Security</a></li> + <li id="anb-aur"><a href="https://aur.archlinux.org/" title="Arch Linux User Repository">AUR</a></li> + <li id="anb-download"><a href="http://www.archlinux.org/download/" title="Get Arch Linux">Download</a></li> + </ul> + </div> + </div><!-- #archnavbar --> +<div id='cgit'><table id='header'> +<tr> +<td class='main'><a href='/'>index</a> : <a title='svntogit/packages.git' href='/svntogit/packages.git/'>svntogit/packages.git</a></td></tr> +<tr><td class='sub'>Git clone of the 'packages' repository +</td><td class='sub right'></td></tr></table> +<table class='tabs'><tr><td> +<a href='/svntogit/packages.git/?h=packages/htop'>summary</a><a href='/svntogit/packages.git/refs/?h=packages/htop&id=e1359571e24850f3ac08f8bd463aaa921751a71b'>refs</a><a href='/svntogit/packages.git/log/trunk/0001-fix-option-string.patch?h=packages/htop'>log</a><a class='active' href='/svntogit/packages.git/tree/trunk/0001-fix-option-string.patch?h=packages/htop&id=e1359571e24850f3ac08f8bd463aaa921751a71b'>tree</a><a href='/svntogit/packages.git/commit/trunk/0001-fix-option-string.patch?h=packages/htop&id=e1359571e24850f3ac08f8bd463aaa921751a71b'>commit</a><a href='/svntogit/packages.git/diff/trunk/0001-fix-option-string.patch?h=packages/htop&id=e1359571e24850f3ac08f8bd463aaa921751a71b'>diff</a><a href='/svntogit/packages.git/stats/trunk/0001-fix-option-string.patch?h=packages/htop'>stats</a></td><td class='form'><form class='right' method='get' action='/svntogit/packages.git/log/trunk/0001-fix-option-string.patch'> +<input type='hidden' name='h' value='packages/htop'/><input type='hidden' name='id' value='e1359571e24850f3ac08f8bd463aaa921751a71b'/><select name='qt'> +<option value='grep'>log msg</option> +<option value='author'>author</option> +<option value='committer'>committer</option> +<option value='range'>range</option> +</select> +<input class='txt' type='text' size='10' name='q' value=''/> +<input type='submit' value='search'/> +</form> +</td></tr></table> +<div class='path'>path: <a href='/svntogit/packages.git/tree/?h=packages/htop&id=e1359571e24850f3ac08f8bd463aaa921751a71b'>root</a>/<a href='/svntogit/packages.git/tree/trunk?h=packages/htop&id=e1359571e24850f3ac08f8bd463aaa921751a71b'>trunk</a>/<a href='/svntogit/packages.git/tree/trunk/0001-fix-option-string.patch?h=packages/htop&id=e1359571e24850f3ac08f8bd463aaa921751a71b'>0001-fix-option-string.patch</a></div><div class='content'>blob: d877e03ef91bed57c04f13a7367d2f70250ebf68 (<a href='/svntogit/packages.git/plain/trunk/0001-fix-option-string.patch?h=packages/htop&id=e1359571e24850f3ac08f8bd463aaa921751a71b'>plain</a>) +<table summary='blob content' class='blob'> +<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a> +<a id='n2' href='#n2'>2</a> +<a id='n3' href='#n3'>3</a> +<a id='n4' href='#n4'>4</a> +<a id='n5' href='#n5'>5</a> +<a id='n6' href='#n6'>6</a> +<a id='n7' href='#n7'>7</a> +<a id='n8' href='#n8'>8</a> +<a id='n9' href='#n9'>9</a> +<a id='n10' href='#n10'>10</a> +<a id='n11' href='#n11'>11</a> +<a id='n12' href='#n12'>12</a> +<a id='n13' href='#n13'>13</a> +<a id='n14' href='#n14'>14</a> +<a id='n15' href='#n15'>15</a> +<a id='n16' href='#n16'>16</a> +<a id='n17' href='#n17'>17</a> +<a id='n18' href='#n18'>18</a> +<a id='n19' href='#n19'>19</a> +<a id='n20' href='#n20'>20</a> +<a id='n21' href='#n21'>21</a> +<a id='n22' href='#n22'>22</a> +<a id='n23' href='#n23'>23</a> +<a id='n24' href='#n24'>24</a> +<a id='n25' href='#n25'>25</a> +</pre></td> +<td class='lines'><pre><code>From 731acc8bced18c90fbe0e18381c32f007f71e0d9 Mon Sep 17 00:00:00 2001 +From: Christian Hesse <mail@eworm.de> +Date: Tue, 10 Apr 2018 16:21:46 +0200 +Subject: [PATCH 1/1] fix option string + +This broke with commit db05ba61065f64b59d0014518be0786b5439e54c. + +Signed-off-by: Christian Hesse <mail@eworm.de> +<span class="hl kwb">---</span> + htop.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/htop.c b/htop.c +index 6db81dd..678a3b8 100644 +<span class="hl kwb">--- a/htop.c</span> +<span class="hl kwa">+++ b/htop.c</span> +@@ -93,7 +93,7 @@ static CommandLineSettings parseArguments(int argc, char** argv) { + + int opt, opti=0; + /* Parse arguments */ +<span class="hl kwb">- while ((opt = getopt_long(argc, argv, "hvCst::d:u:p:i", long_opts, &opti))) {</span> +<span class="hl kwa">+ while ((opt = getopt_long(argc, argv, "hvCs:td:u:p:i", long_opts, &opti))) {</span> + if (opt == EOF) break; + switch (opt) { + case 'h': +</code></pre></td></tr></table> +</div> <!-- class=content --> +<div class="foot" style="padding-left:1em;padding-right:1em;"> +<p>Copyright © 2002-2017 <a href="mailto:jvinet@zeroflux.org" +title="contact Judd Vinet">Judd Vinet</a> and <a href="mailto:aaron@archlinux.org" +title="contact Aaron Griffin">Aaron Griffin</a>. The Arch Linux name and logo +are recognized trademarks. Some rights reserved. The registered trademark +Linux® is used pursuant to a sublicense from LMI, the exclusive licensee +of Linus Torvalds, owner of the mark on a world-wide basis.</p> +</div> +</div> <!-- id=cgit --> +</body> +</html> diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..cafbbd8cf22d --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,53 @@ +# Maintainer: Maxim Kurnosenko <asusx2@mail.ru> +# Contributor: Blair Bonnett <blair.bonnett at gmail dot com> + +_pkgname=htop +pkgname=htop-temperature-rpi +pkgver=2.2.0 +pkgrel=1 +pkgdesc="Interactive process viewer with added support for CPU temperature. Version for gathering Raspberry Pi CPU temperature from vcgencmd" +arch=('i686' 'x86_64' 'aarch64' 'armv7h' 'armv6h') +url="http://hisham.hm/htop/" +license=('GPL') +depends=('ncurses' 'libnl') +makedepends=('python') +optdepends=('lsof: show files opened by a process' + 'strace: attach to a running process') +provides=($_pkgname) +conflicts=($_pkgname) +options=('!emptydirs') +source=("http://hisham.hm/$_pkgname/releases/$pkgver/$_pkgname-$pkgver.tar.gz" + "htop-temperature-rpi.patch" + "0001-fix-option-string.patch") +sha256sums=('d9d6826f10ce3887950d709b53ee1d8c1849a70fa38e91d5896ad8cbc6ba3c57' + '933e8b41668282ccfc0e3e82ca9559022360e803c8c42a2ddee223ba31198338' + '550c2806ccae779203ec610b73d2c5b977df3f963ad79675a611da48accf6e0d') + +prepare() { + cd "$_pkgname-$pkgver" + + patch -Np1 < "$srcdir"/0001-fix-option-string.patch + + # Add CPU temperature patch. + patch -Np1 < "$srcdir"/htop-temperature-rpi.patch +} + +build() { + cd "$_pkgname-$pkgver" + + ./autogen.sh + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --enable-cgroup \ + --enable-delayacct \ + --enable-openvz \ + --enable-unicode \ + --enable-vserver + + make $MAKEFLAGS +} + +package() { + make -C "$_pkgname-$pkgver" DESTDIR="$pkgdir" install +} diff --git a/htop-temperature-rpi.patch b/htop-temperature-rpi.patch new file mode 100644 index 000000000000..ab500e6cad82 --- /dev/null +++ b/htop-temperature-rpi.patch @@ -0,0 +1,261 @@ +diff --git a/CRT.c b/CRT.c +index 0d51698..4eab74d 100644 +--- a/CRT.c ++++ b/CRT.c +@@ -78,6 +78,9 @@ typedef enum ColorElements_ { + UPTIME, + BATTERY, + TASKS_RUNNING, ++ TEMPERATURE_COOL, ++ TEMPERATURE_MEDIUM, ++ TEMPERATURE_HOT, + SWAP, + PROCESS, + PROCESS_SHADOW, +@@ -182,6 +185,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = { + [METER_VALUE] = A_BOLD | ColorPair(Cyan,Black), + [LED_COLOR] = ColorPair(Green,Black), + [TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black), ++ [TEMPERATURE_COOL] = A_DIM | ColorPair(Green,Black), ++ [TEMPERATURE_MEDIUM] = A_NORMAL | ColorPair(Yellow,Black), ++ [TEMPERATURE_HOT] = A_BOLD | ColorPair(Red,Black), + [PROCESS] = A_NORMAL, + [PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Black), + [PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Black), +@@ -241,6 +247,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = { + [METER_VALUE] = A_BOLD, + [LED_COLOR] = A_NORMAL, + [TASKS_RUNNING] = A_BOLD, ++ [TEMPERATURE_COOL] = A_DIM, ++ [TEMPERATURE_MEDIUM] = A_NORMAL, ++ [TEMPERATURE_HOT] = A_BOLD, + [PROCESS] = A_NORMAL, + [PROCESS_SHADOW] = A_DIM, + [PROCESS_TAG] = A_BOLD, +@@ -300,6 +309,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = { + [METER_VALUE] = ColorPair(Black,White), + [LED_COLOR] = ColorPair(Green,White), + [TASKS_RUNNING] = ColorPair(Green,White), ++ [TEMPERATURE_COOL] = ColorPair(Green,White), ++ [TEMPERATURE_MEDIUM] = ColorPair(Yellow,White), ++ [TEMPERATURE_HOT] = ColorPair(Red,White), + [PROCESS] = ColorPair(Black,White), + [PROCESS_SHADOW] = A_BOLD | ColorPair(Black,White), + [PROCESS_TAG] = ColorPair(White,Blue), +@@ -359,6 +371,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = { + [METER_VALUE] = ColorPair(Black,Black), + [LED_COLOR] = ColorPair(Green,Black), + [TASKS_RUNNING] = ColorPair(Green,Black), ++ [TEMPERATURE_COOL] = ColorPair(Green,Black), ++ [TEMPERATURE_MEDIUM] = ColorPair(Yellow,Black), ++ [TEMPERATURE_HOT] = ColorPair(Red,Black), + [PROCESS] = ColorPair(Black,Black), + [PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Black), + [PROCESS_TAG] = ColorPair(White,Blue), +@@ -418,6 +433,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = { + [METER_VALUE] = A_BOLD | ColorPair(Cyan,Blue), + [LED_COLOR] = ColorPair(Green,Blue), + [TASKS_RUNNING] = A_BOLD | ColorPair(Green,Blue), ++ [TEMPERATURE_COOL] = A_DIM | ColorPair(Green,Blue), ++ [TEMPERATURE_MEDIUM] = A_NORMAL | ColorPair(Yellow,Blue), ++ [TEMPERATURE_HOT] = A_BOLD | ColorPair(Red,Blue), + [PROCESS] = ColorPair(White,Blue), + [PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Blue), + [PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Blue), +@@ -477,6 +495,9 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = { + [METER_VALUE] = ColorPair(Green,Black), + [LED_COLOR] = ColorPair(Green,Black), + [TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black), ++ [TEMPERATURE_COOL] = A_DIM | ColorPair(Green,Black), ++ [TEMPERATURE_MEDIUM] = A_NORMAL | ColorPair(Yellow,Black), ++ [TEMPERATURE_HOT] = A_BOLD | ColorPair(Red,Black), + [PROCESS] = ColorPair(Cyan,Black), + [PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Black), + [PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Black), +diff --git a/CRT.h b/CRT.h +index fb82413..bda5318 100644 +--- a/CRT.h ++++ b/CRT.h +@@ -68,6 +68,9 @@ typedef enum ColorElements_ { + UPTIME, + BATTERY, + TASKS_RUNNING, ++ TEMPERATURE_COOL, ++ TEMPERATURE_MEDIUM, ++ TEMPERATURE_HOT, + SWAP, + PROCESS, + PROCESS_SHADOW, +diff --git a/TemperatureMeter.c b/TemperatureMeter.c +new file mode 100644 +index 0000000..9ee9185 +--- /dev/null ++++ b/TemperatureMeter.c +@@ -0,0 +1,100 @@ ++/* ++htop - TemperatureMeter.c ++(C) 2013 Ralf Stemmer ++(C) 2014 Blair Bonnett ++Released under the GNU GPL, see the COPYING file ++in the source distribution for its full text. ++*/ ++ ++#include "TemperatureMeter.h" ++ ++#include "ProcessList.h" ++#include "CRT.h" ++ ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include <limits.h> ++ ++/*{ ++#include "Meter.h" ++}*/ ++ ++int TemperatureMeter_attributes[] = { ++ TEMPERATURE_COOL, ++ TEMPERATURE_MEDIUM, ++ TEMPERATURE_HOT, ++}; ++ ++static void TemperatureMeter_setValues(Meter* this, char* buffer, int len) { ++ ProcessList* pl = this->pl; ++ this->total = pl->totalTasks; ++ this->values[0] = pl->runningTasks; ++ snprintf(buffer, len, "%d/%d", (int) this->values[0], (int) this->total); ++} ++ ++static void TemperatureMeter_display(Object* cast, RichString* out) { ++ FILE *p; ++ p = popen("/opt/vc/bin/vcgencmd measure_temp", "r"); ++ if(p == NULL) return 1; ++ ++ int textColor = CRT_colors[METER_TEXT]; ++ int coolColor = CRT_colors[TEMPERATURE_COOL]; ++ int mediumColor = CRT_colors[TEMPERATURE_MEDIUM]; ++ int hotColor = CRT_colors[TEMPERATURE_HOT]; ++ ++ size_t read, len; ++ char *line = NULL; ++ char *entry = NULL; ++ char *tstart = NULL, *tend = NULL; ++ int temperature; ++ while ((read = getline(&line, &len, p)) != -1) { ++ // contains this line a core-temperature? ++ entry = strstr(line, "temp"); ++ if (entry == NULL) continue; ++ ++ // find the begin of the temperature value ++ tstart = strchr(entry, '='); // no negative temperatures expected :) ++ if (tstart == NULL) continue; ++ tstart++; // jump over the '+' ++ ++ // find the end of the temperature. Remember, it can be above 99°C ;) ++ tend = strchr(tstart, '.'); // just the integer ++ if (tend == NULL) continue; ++ ++ // convert the string into an integer, this is necessary for further steps ++ temperature = strtol(tstart, &tend, 10); ++ if (temperature == LONG_MAX || temperature == LONG_MIN) continue; ++ if (tstart == tend) continue; ++ ++ // choose the color for the temperature ++ int tempColor; ++ if (temperature < 60) tempColor = coolColor; ++ else if (temperature >= 60 && temperature < 75) tempColor = mediumColor; ++ else tempColor = hotColor; ++ ++ // output the temperature ++ char buffer[20]; ++ sprintf(buffer, "%d", temperature); ++ RichString_append(out, tempColor, buffer); ++ RichString_append(out, textColor, "°C "); ++ } ++ ++ free(line); ++ pclose(p); ++} ++ ++MeterClass TemperatureMeter_class = { ++ .super = { ++ .extends = Class(Meter), ++ .display = TemperatureMeter_display, ++ .delete = Meter_delete, ++ }, ++ .updateValues = TemperatureMeter_setValues, ++ .defaultMode = TEXT_METERMODE, ++ .total = 100.0, ++ .attributes = TemperatureMeter_attributes, ++ .name = "Temperature", ++ .uiName = "Temperature Sensors", ++ .caption = "Temperature: " ++}; +diff --git a/TemperatureMeter.h b/TemperatureMeter.h +new file mode 100644 +index 0000000..b86ddd8 +--- /dev/null ++++ b/TemperatureMeter.h +@@ -0,0 +1,19 @@ ++/* Do not edit this file. It was automatically generated. */ ++ ++#ifndef HEADER_TemperatureMeter ++#define HEADER_TemperatureMeter ++/* ++htop - TemperatureMeter.h ++(C) 2013 Ralf Stemmer ++(C) 2014 Blair Bonnett ++Released under the GNU GPL, see the COPYING file ++in the source distribution for its full text. ++*/ ++ ++#include "Meter.h" ++ ++extern int TemperatureMeter_attributes[]; ++ ++extern MeterClass TemperatureMeter_class; ++ ++#endif +diff --git a/linux/Platform.c b/linux/Platform.c +index de7bb84..a8e8a6f 100644 +--- a/linux/Platform.c ++++ b/linux/Platform.c +@@ -22,6 +22,7 @@ in the source distribution for its full text. + #include "ClockMeter.h" + #include "HostnameMeter.h" + #include "LinuxProcess.h" ++#include "TemperatureMeter.h" + + #include <math.h> + #include <assert.h> +@@ -116,6 +117,7 @@ MeterClass* Platform_meterTypes[] = { + &MemoryMeter_class, + &SwapMeter_class, + &TasksMeter_class, ++ &TemperatureMeter_class, + &UptimeMeter_class, + &BatteryMeter_class, + &HostnameMeter_class, +diff --git a/Makefile.am b/Makefile.am +index cd5209c..c700e34 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -48,14 +48,15 @@ linux_platform_headers = \ + linux/LinuxProcess.h \ + linux/LinuxProcessList.h \ + linux/LinuxCRT.h \ +- linux/Battery.h ++ linux/Battery.h \ ++ TemperatureMeter.h + + all_platform_headers += $(linux_platform_headers) + + if HTOP_LINUX + AM_CFLAGS += -rdynamic + myhtopplatsources = linux/Platform.c linux/IOPriorityPanel.c linux/IOPriority.c \ +-linux/LinuxProcess.c linux/LinuxProcessList.c linux/LinuxCRT.c linux/Battery.c ++linux/LinuxProcess.c linux/LinuxProcessList.c linux/LinuxCRT.c linux/Battery.c TemperatureMeter.c + + myhtopplatheaders = $(linux_platform_headers) + endif |