[arch-commits] Commit in conky/trunk (PKGBUILD fix_hwmon_for_2.6.31.patch)

Giovanni Scafora giovanni at archlinux.org
Mon Oct 19 19:48:18 UTC 2009


    Date: Monday, October 19, 2009 @ 15:48:18
  Author: giovanni
Revision: 56120

upgpkg: conky 1.7.2-5
    Fixed FS16584

Added:
  conky/trunk/fix_hwmon_for_2.6.31.patch
Modified:
  conky/trunk/PKGBUILD

----------------------------+
 PKGBUILD                   |   10 ++++-
 fix_hwmon_for_2.6.31.patch |   72 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2009-10-19 19:34:52 UTC (rev 56119)
+++ PKGBUILD	2009-10-19 19:48:18 UTC (rev 56120)
@@ -5,7 +5,7 @@
 
 pkgname=conky
 pkgver=1.7.2
-pkgrel=4
+pkgrel=5
 pkgdesc="An advanced, highly configurable system monitor for X based on torsmo"
 arch=('i686' 'x86_64')
 url="http://conky.sourceforge.net/"
@@ -14,11 +14,15 @@
 depends=('alsa-lib' 'libxml2' 'curl' 'wireless_tools' 'libxft' 'glib2' 'libxdamage' 'imlib2')
 makedepends=('pkgconfig')
 backup=(etc/conky/conky.conf etc/conky/conky_no_x11.conf)
-source=(http://downloads.sourceforge.net/project/${pkgname}/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.bz2)
-md5sums=('cf6f5d45d42ad68c618c00271813b80d')
+source=(http://downloads.sourceforge.net/project/${pkgname}/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.bz2
+        fix_hwmon_for_2.6.31.patch)
+md5sums=('cf6f5d45d42ad68c618c00271813b80d'
+         '679475fc92700a90c0f38c393532ba1d')
 
 build() {
   cd ${srcdir}/${pkgname}-${pkgver}
+  #  FS#16584
+  patch -Np1 -i ${srcdir}/fix_hwmon_for_2.6.31.patch || return 1
   ./configure --prefix=/usr \
               --sysconfdir=/etc \
               --enable-wlan \

Added: fix_hwmon_for_2.6.31.patch
===================================================================
--- fix_hwmon_for_2.6.31.patch	                        (rev 0)
+++ fix_hwmon_for_2.6.31.patch	2009-10-19 19:48:18 UTC (rev 56120)
@@ -0,0 +1,72 @@
+This should make conky compatible with the karmic kernel (2.6.31) and maintain
+also compatibility with older kernels.
+See LP #435571.
+
+Index: conky-1.7.2/src/linux.c
+===================================================================
+--- conky-1.7.2.orig/src/linux.c	2009-08-08 22:05:55.000000000 +0200
++++ conky-1.7.2/src/linux.c	2009-10-15 18:33:30.000000000 +0200
+@@ -858,23 +858,16 @@
+ 	}
+ 
+ 	if (strcmp(dir, "/sys/class/hwmon/") == 0) {
+-		if (*buf) {
+-			/* buf holds result from get_first_file_in_a_directory() above,
+-			 * e.g. "hwmon0" -- append "/device" */
+-			strcat(buf, "/device");
+-		} else {
+-			/* dev holds device number N as a string,
+-			 * e.g. "0", -- convert to "hwmon0/device" */
+-			sprintf(buf, "hwmon%s/device", dev);
+-			dev = buf;
+-		}
+-	}
+-
+-	/* At least the acpitz hwmon doesn't have a 'device' subdir,
+-	 * so check it's existence and strip it from buf otherwise. */
+-	snprintf(path, 255, "%s%s", dir, dev);
+-	if (stat(path, &st)) {
+-		buf[strlen(buf) - 7] = 0;
++	  if (*buf) {
++	    /* buf holds result from get_first_file_in_a_directory() above,
++	     * e.g. "hwmon0" -- append "/device" */
++	    strcat(buf, "/device");
++	  } else {
++	    /* dev holds device number N as a string,
++	     * e.g. "0", -- convert to "hwmon0/device" */
++	    sprintf(buf, "hwmon%s/device", dev);
++	    dev = buf;
++	  }
+ 	}
+ 
+ 	/* change vol to in, tempf to temp */
+@@ -884,16 +877,25 @@
+ 		type = "temp";
+ 	}
+ 
++	/* construct path */
+ 	snprintf(path, 255, "%s%s/%s%d_input", dir, dev, type, n);
+-	strncpy(devtype, path, 255);
+ 
+-	/* open file */
++	/* first, attempt to open file in /device */
+ 	fd = open(path, O_RDONLY);
+ 	if (fd < 0) {
+-		CRIT_ERR(NULL, NULL, "can't open '%s': %s\nplease check your device or remove this "
+-			"var from "PACKAGE_NAME, path, strerror(errno));
++
++	  /* if it fails, strip the /device from dev and attempt again */
++	  buf[strlen(buf) - 7] = 0;
++	  snprintf(path, 255, "%s%s/%s%d_input", dir, dev, type, n);
++	  fd = open(path, O_RDONLY);
++	  if (fd < 0) {
++	    CRIT_ERR(NULL, NULL, "can't open '%s': %s\nplease check your device or remove this "
++		     "var from "PACKAGE_NAME, path, strerror(errno));
++	  }
+ 	}
+ 
++	strncpy(devtype, path, 255);
++
+ 	if (strcmp(type, "in") == 0 || strcmp(type, "temp") == 0
+ 			|| strcmp(type, "tempf") == 0) {
+ 		*divisor = 1;




More information about the arch-commits mailing list