changeset 2624:92612114d1ce

Patch to fix COPR build This patch updates the spec file to build a dependent Java file required by the previous patch (Windows CPU agent) A syntax change is also added.
author Simon Tooke <stooke@redhat.com>
date Fri, 14 Apr 2017 02:45:12 -0400
parents 65fcc9af086c
children dbe52d6f8c7e
files common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableHost.java common/portability/src/main/java/com/redhat/thermostat/common/portability/internal/windows/WindowsHelperImpl.java distribution/packaging/fedora/thermostat.spec
diffstat 3 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableHost.java	Thu Apr 13 23:25:41 2017 -0400
+++ b/common/portability/src/main/java/com/redhat/thermostat/common/portability/PortableHost.java	Fri Apr 14 02:45:12 2017 -0400
@@ -54,7 +54,8 @@
 
     PortableMemoryStat getMemoryStat();
 
-    static final int CPU_TIMES_SIZE = 3;
+    // represents size of array with idle, system and user ticks or percentages
+    int CPU_TIMES_SIZE = 3;
 
     // returns an array (one row per CPU) of an array of ints (idle, system and user ticks)
     long[][] getCPUUsageTicks();
--- a/common/portability/src/main/java/com/redhat/thermostat/common/portability/internal/windows/WindowsHelperImpl.java	Thu Apr 13 23:25:41 2017 -0400
+++ b/common/portability/src/main/java/com/redhat/thermostat/common/portability/internal/windows/WindowsHelperImpl.java	Fri Apr 14 02:45:12 2017 -0400
@@ -37,6 +37,7 @@
 package com.redhat.thermostat.common.portability.internal.windows;
 
 import com.redhat.thermostat.common.portability.internal.PortableNativeLibraryLoader;
+import com.redhat.thermostat.common.portability.PortableHost;
 import com.redhat.thermostat.shared.config.OS;
 
 import java.nio.ByteBuffer;
@@ -44,7 +45,6 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import static com.redhat.thermostat.common.portability.PortableHost.CPU_TIMES_SIZE;
 
 /**
  * Utility class to access Windows native code
@@ -267,7 +267,7 @@
      * @return long[3] array of idle, system and user times (in ticks)
      */
     long[] getSystemTimes() {
-        final long times[] = new long[CPU_TIMES_SIZE];
+        final long times[] = new long[PortableHost.CPU_TIMES_SIZE];
         getSystemTimes0(times);
         return times;
     }
@@ -280,7 +280,7 @@
         final int numProcessors = getCPUCount();
         final int[][] procs = new int[numProcessors][];
         for (int i=0; i<numProcessors; i++) {
-            final int times[] = new int[CPU_TIMES_SIZE];
+            final int times[] = new int[PortableHost.CPU_TIMES_SIZE];
             procs[i] = times;
         }
         getCPUUsagePercent0(procs);
--- a/distribution/packaging/fedora/thermostat.spec	Thu Apr 13 23:25:41 2017 -0400
+++ b/distribution/packaging/fedora/thermostat.spec	Fri Apr 14 02:45:12 2017 -0400
@@ -699,6 +699,7 @@
   javac -cp ../../config/target/classes:../../annotations/target/classes:../../common/core/target/classes \
         -d target/classes \
          src/main/java/com/redhat/thermostat/common/portability/HostName.java \
+         src/main/java/com/redhat/thermostat/common/portability/PortableHost.java \
          src/main/java/com/redhat/thermostat/common/portability/UserNameUtil.java \
          src/main/java/com/redhat/thermostat/common/portability/UserNameLookupException.java \
          src/main/java/com/redhat/thermostat/common/portability/internal/PortableNativeLibraryLoader.java \