tags 820466 patch

Hello,

I finally came up with a debdiff that fixes this issue and enable
golang-github-shirou-gopsutil to build fine on ppc64el arch.

I cherry picked 3 patches from upstream (1 of those I neeeded to create), and
now the tests are all passing on ppc64el.

Let me know if you want me to NMU it.

Thanks,
Breno
diff -Nru golang-github-shirou-gopsutil-2.1/debian/changelog golang-github-shirou-gopsutil-2.1/debian/changelog
--- golang-github-shirou-gopsutil-2.1/debian/changelog	2016-07-14 03:23:30.000000000 -0400
+++ golang-github-shirou-gopsutil-2.1/debian/changelog	2016-10-26 08:25:56.000000000 -0400
@@ -1,3 +1,9 @@
+golang-github-shirou-gopsutil (2.1-3) UNRELEASED; urgency=medium
+
+  * Fix FTBFS and add support for ppc64el. (Closes: #820466)
+
+ -- Breno Leitao <breno.lei...@gmail.com>  Wed, 26 Oct 2016 08:25:56 -0400
+
 golang-github-shirou-gopsutil (2.1-2) unstable; urgency=medium
 
   * Extend "01-Disable_failing_tests.patch" to disable failing
diff -Nru golang-github-shirou-gopsutil-2.1/debian/patches/0001-Improve-CPU-identification-for-POWER-processors.patch golang-github-shirou-gopsutil-2.1/debian/patches/0001-Improve-CPU-identification-for-POWER-processors.patch
--- golang-github-shirou-gopsutil-2.1/debian/patches/0001-Improve-CPU-identification-for-POWER-processors.patch	1969-12-31 19:00:00.000000000 -0500
+++ golang-github-shirou-gopsutil-2.1/debian/patches/0001-Improve-CPU-identification-for-POWER-processors.patch	2016-10-26 08:19:08.000000000 -0400
@@ -0,0 +1,47 @@
+From 286927a039eb369b9ef12a0578df7bd4bdf91a12 Mon Sep 17 00:00:00 2001
+From: Breno Leitao <breno.lei...@gmail.com>
+Date: Mon, 24 Oct 2016 14:00:37 -0400
+Subject: [PATCH] Improve CPU identification for POWER processors
+
+Currently gopsutils fails to indentify the POWER processors family,
+returning an almost empty Info() structure.
+
+This patch improves the POWER identification without changing what is
+available for x86.
+---
+ cpu/cpu_linux.go | 18 +++++++++++++++---
+ 1 file changed, 15 insertions(+), 3 deletions(-)
+
+diff --git a/cpu/cpu_linux.go b/cpu/cpu_linux.go
+index 3537b2d..1979ebc 100644
+--- a/cpu/cpu_linux.go
++++ b/cpu/cpu_linux.go
+@@ -144,10 +144,22 @@ func Info() ([]InfoStat, error) {
+ 			c.Family = value
+ 		case "model":
+ 			c.Model = value
+-		case "model name":
++		case "model name", "cpu":
+ 			c.ModelName = value
+-		case "stepping":
+-			t, err := strconv.ParseInt(value, 10, 64)
++			if strings.Contains(value, "POWER8") ||
++			   strings.Contains(value, "POWER7") {
++				c.Model = strings.Split(value, " ")[0]
++				c.Family = "POWER"
++				c.VendorID = "IBM"
++			}
++		case "stepping", "revision":
++			val := value
++
++			if key == "revision" {
++				val = strings.Split(value, ".")[0]
++			}
++
++			t, err := strconv.ParseInt(val, 10, 64)
+ 			if err != nil {
+ 				return ret, err
+ 			}
+-- 
+2.9.3
+
diff -Nru golang-github-shirou-gopsutil-2.1/debian/patches/0001-process-determine-page-sizes-via-function.patch golang-github-shirou-gopsutil-2.1/debian/patches/0001-process-determine-page-sizes-via-function.patch
--- golang-github-shirou-gopsutil-2.1/debian/patches/0001-process-determine-page-sizes-via-function.patch	1969-12-31 19:00:00.000000000 -0500
+++ golang-github-shirou-gopsutil-2.1/debian/patches/0001-process-determine-page-sizes-via-function.patch	2016-10-26 08:13:17.000000000 -0400
@@ -0,0 +1,86 @@
+From eb4a57117f5b734246226c9b6d6b1f9edca2e4f2 Mon Sep 17 00:00:00 2001
+From: Thomas Hipp <th...@suse.de>
+Date: Fri, 16 Sep 2016 09:04:52 +0200
+Subject: [PATCH] process: determine page sizes via function
+
+Instead of hard-coding the page size for linux systems, use Go's
+`Getpagesize` function.
+
+This resolves #258.
+
+Signed-off-by: Thomas Hipp <th...@suse.de>
+---
+ process/process_linux.go       | 5 ++++-
+ process/process_linux_386.go   | 3 +--
+ process/process_linux_amd64.go | 3 +--
+ process/process_linux_arm.go   | 3 +--
+ process/process_linux_arm64.go | 3 +--
+ 5 files changed, 8 insertions(+), 9 deletions(-)
+
+diff --git a/process/process_linux.go b/process/process_linux.go
+index 158cb04..9eb4f44 100644
+--- a/process/process_linux.go
++++ b/process/process_linux.go
+@@ -20,7 +20,10 @@ import (
+ 	"github.com/shirou/gopsutil/net"
+ )
+ 
+-var ErrorNoChildren = errors.New("process does not have children")
++var (
++	ErrorNoChildren = errors.New("process does not have children")
++	PageSize        = uint64(os.Getpagesize())
++)
+ 
+ const (
+ 	PrioProcess = 0 // linux/resource.h
+diff --git a/process/process_linux_386.go b/process/process_linux_386.go
+index 541b854..c4df213 100644
+--- a/process/process_linux_386.go
++++ b/process/process_linux_386.go
+@@ -4,6 +4,5 @@
+ package process
+ 
+ const (
+-	ClockTicks = 100  // C.sysconf(C._SC_CLK_TCK)
+-	PageSize   = 4096 // C.sysconf(C._SC_PAGE_SIZE)
++	ClockTicks = 100 // C.sysconf(C._SC_CLK_TCK)
+ )
+diff --git a/process/process_linux_amd64.go b/process/process_linux_amd64.go
+index b4a4ce8..99b6659 100644
+--- a/process/process_linux_amd64.go
++++ b/process/process_linux_amd64.go
+@@ -4,6 +4,5 @@
+ package process
+ 
+ const (
+-	ClockTicks = 100  // C.sysconf(C._SC_CLK_TCK)
+-	PageSize   = 4096 // C.sysconf(C._SC_PAGE_SIZE)
++	ClockTicks = 100 // C.sysconf(C._SC_CLK_TCK)
+ )
+diff --git a/process/process_linux_arm.go b/process/process_linux_arm.go
+index c6123a4..8aef44c 100644
+--- a/process/process_linux_arm.go
++++ b/process/process_linux_arm.go
+@@ -4,6 +4,5 @@
+ package process
+ 
+ const (
+-	ClockTicks = 100  // C.sysconf(C._SC_CLK_TCK)
+-	PageSize   = 4096 // C.sysconf(C._SC_PAGE_SIZE)
++	ClockTicks = 100 // C.sysconf(C._SC_CLK_TCK)
+ )
+diff --git a/process/process_linux_arm64.go b/process/process_linux_arm64.go
+index 529aeaa..493197c 100644
+--- a/process/process_linux_arm64.go
++++ b/process/process_linux_arm64.go
+@@ -4,6 +4,5 @@
+ package process
+ 
+ const (
+-	ClockTicks = 100  // C.sysconf(C._SC_CLK_TCK)
+-	PageSize   = 4096 // C.sysconf(C._SC_PAGE_SIZE)
++	ClockTicks = 100 // C.sysconf(C._SC_CLK_TCK)
+ )
+-- 
+2.9.3
+
diff -Nru golang-github-shirou-gopsutil-2.1/debian/patches/0001-process-make-ClockTicks-arch-independent.patch golang-github-shirou-gopsutil-2.1/debian/patches/0001-process-make-ClockTicks-arch-independent.patch
--- golang-github-shirou-gopsutil-2.1/debian/patches/0001-process-make-ClockTicks-arch-independent.patch	1969-12-31 19:00:00.000000000 -0500
+++ golang-github-shirou-gopsutil-2.1/debian/patches/0001-process-make-ClockTicks-arch-independent.patch	2016-10-26 08:17:40.000000000 -0400
@@ -0,0 +1,97 @@
+From 68ad8d603c624c5f4dc986b333303da565570aa3 Mon Sep 17 00:00:00 2001
+From: Thomas Hipp <thomash...@gmail.com>
+Date: Sat, 17 Sep 2016 18:06:07 +0200
+Subject: [PATCH] process: make `ClockTicks` arch-independent
+
+The value for `ClockTicks` is defined as `100` by the Linux kernel for
+all currently supported architectures in Go. Therefore, there is no need
+to define this constant for each architecture separately.
+
+This fixes #260.
+
+Signed-off-by: Thomas Hipp <thomash...@gmail.com>
+---
+ process/process_linux.go       | 3 ++-
+ process/process_linux_386.go   | 8 --------
+ process/process_linux_amd64.go | 8 --------
+ process/process_linux_arm.go   | 8 --------
+ process/process_linux_arm64.go | 8 --------
+ 5 files changed, 2 insertions(+), 33 deletions(-)
+ delete mode 100644 process/process_linux_386.go
+ delete mode 100644 process/process_linux_amd64.go
+ delete mode 100644 process/process_linux_arm.go
+ delete mode 100644 process/process_linux_arm64.go
+
+diff --git a/process/process_linux.go b/process/process_linux.go
+index 9eb4f44..19c6655 100644
+--- a/process/process_linux.go
++++ b/process/process_linux.go
+@@ -26,7 +26,8 @@ var (
+ )
+ 
+ const (
+-	PrioProcess = 0 // linux/resource.h
++	PrioProcess = 0   // linux/resource.h
++	ClockTicks  = 100 // C.sysconf(C._SC_CLK_TCK)
+ )
+ 
+ // MemoryInfoExStat is different between OSes
+diff --git a/process/process_linux_386.go b/process/process_linux_386.go
+deleted file mode 100644
+index c4df213..0000000
+--- a/process/process_linux_386.go
++++ /dev/null
+@@ -1,8 +0,0 @@
+-// +build linux
+-// +build 386
+-
+-package process
+-
+-const (
+-	ClockTicks = 100 // C.sysconf(C._SC_CLK_TCK)
+-)
+diff --git a/process/process_linux_amd64.go b/process/process_linux_amd64.go
+deleted file mode 100644
+index 99b6659..0000000
+--- a/process/process_linux_amd64.go
++++ /dev/null
+@@ -1,8 +0,0 @@
+-// +build linux
+-// +build amd64
+-
+-package process
+-
+-const (
+-	ClockTicks = 100 // C.sysconf(C._SC_CLK_TCK)
+-)
+diff --git a/process/process_linux_arm.go b/process/process_linux_arm.go
+deleted file mode 100644
+index 8aef44c..0000000
+--- a/process/process_linux_arm.go
++++ /dev/null
+@@ -1,8 +0,0 @@
+-// +build linux
+-// +build arm
+-
+-package process
+-
+-const (
+-	ClockTicks = 100 // C.sysconf(C._SC_CLK_TCK)
+-)
+diff --git a/process/process_linux_arm64.go b/process/process_linux_arm64.go
+deleted file mode 100644
+index 493197c..0000000
+--- a/process/process_linux_arm64.go
++++ /dev/null
+@@ -1,8 +0,0 @@
+-// +build linux
+-// +build arm64
+-
+-package process
+-
+-const (
+-	ClockTicks = 100 // C.sysconf(C._SC_CLK_TCK)
+-)
+-- 
+2.9.3
+
diff -Nru golang-github-shirou-gopsutil-2.1/debian/patches/series golang-github-shirou-gopsutil-2.1/debian/patches/series
--- golang-github-shirou-gopsutil-2.1/debian/patches/series	2016-06-19 23:21:58.000000000 -0400
+++ golang-github-shirou-gopsutil-2.1/debian/patches/series	2016-10-26 08:19:08.000000000 -0400
@@ -1 +1,4 @@
 01-Disable_failing_tests.patch
+0001-process-determine-page-sizes-via-function.patch
+0001-process-make-ClockTicks-arch-independent.patch
+0001-Improve-CPU-identification-for-POWER-processors.patch
_______________________________________________
Pkg-go-maintainers mailing list
Pkg-go-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-go-maintainers

Reply via email to