summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2024-04-22 18:56:03 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2024-04-22 18:56:03 -0300
commit94c1735f80ed1f5e4c372f2e00141e5a26d36484 (patch)
tree9f757347abbf4e2f9e143ccbe4ad88a1f440dc1b
parenta876d6315a66bb185d5da95a7eaa58f324c73f9a (diff)
parent522813da585389c158c6a84e688bc9f53daea38d (diff)
Update upstream source from tag 'upstream/2.0.12'
Update to upstream version '2.0.12' with Debian dir 8ded00cf606959e9bc04514728f08f7c22251458
-rw-r--r--CMakeLists.txt12
-rw-r--r--hardinfo2/util.c2
-rw-r--r--includes/e2k/processor-platform.h72
-rw-r--r--includes/loongarch64/processor-platform.h2
-rw-r--r--modules/devices/e2k/processor.c420
-rwxr-xr-xtools/create_debian_source.sh38
6 files changed, 51 insertions, 495 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ffa7b08..28182192 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0.0)
cmake_policy(VERSION 3.0.0)
project(hardinfo2)
-set(HARDINFO2_VERSION "2.0.11")
+set(HARDINFO2_VERSION "2.0.12")
option(HARDINFO2_GTK3 "Build for GTK3 (0/off for GTK2)" 1)
option(HARDINFO2_LIBSOUP3 "Build for libsoup-3.0(EXPERIMENTAL) (0/off for libsoup-2.4)" 0)
@@ -134,6 +134,11 @@ else()
endif()
#Put it together
string(REPLACE " " "_" CPACK_PACKAGE_FILE_NAME "hardinfo${PACKAGE_DELIMITER}${PACKAGE_DISTRO}${PACKAGE_ARCHITECTURE}")
+if(${RPM})
+ string(REPLACE " " "_" CPACK_SOURCE_PACKAGE_FILE_NAME "hardinfo${PACKAGE_DELIMITER}${HARDINFO2_VERSION}.src")
+else()
+ string(REPLACE " " "_" CPACK_SOURCE_PACKAGE_FILE_NAME "hardinfo-${HARDINFO2_VERSION}")
+endif()
message("-- Found Package Target ${CPACK_PACKAGE_FILE_NAME}")
message("-- Found Package Version ${CPACK_PACKAGE_VERSION}")
@@ -522,11 +527,16 @@ install(FILES pixmaps/hardinfo2.png
#Please update here for building packages
#keep package name as hardinfo to allow for upgrading in distro
SET(CPACK_PACKAGE_NAME "hardinfo")
+SET(CPACK_SOURCE_PACKAGE_NAME "hardinfo")
SET(CPACK_PACKAGE_HOMEPAGE_URL "https://www.hardinfo2.org")
if(${RPM})
+ SET(CPACK_SOURCE_IGNORE_FILES "/build/;/.git/;/.github/;.gitignore;.gitmodules;*.po.old;*~;*.mo;*.dsc;/debian/")
+ SET(CPACK_SOURCE_GENERATOR "RPM")
SET(CPACK_GENERATOR "RPM")
SET(PACKAGE_GTK2 "libgtk-2-0")
else()
+ SET(CPACK_SOURCE_IGNORE_FILES "/build/;/.git/;/.github/;.gitignore;.gitmodules;*.po.old;*~;*.mo")
+ SET(CPACK_SOURCE_GENERATOR "TGZ")
SET(CPACK_GENERATOR "DEB")
SET(PACKAGE_GTK2 "libgtk2.0-0")
endif()
diff --git a/hardinfo2/util.c b/hardinfo2/util.c
index e573e63e..c3b138c9 100644
--- a/hardinfo2/util.c
+++ b/hardinfo2/util.c
@@ -4,7 +4,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 2.
+ * the Free Software Foundation, version 2 or Later.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/includes/e2k/processor-platform.h b/includes/e2k/processor-platform.h
deleted file mode 100644
index c6361823..00000000
--- a/includes/e2k/processor-platform.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * HardInfo - Displays System Information
- * Copyright (C) 2020 EntityFX <artem.solopiy@gmail.com> and MCST Elbrus Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __PROCESSOR_PLATFORM_H__
-#define __PROCESSOR_PLATFORM_H__
-
-#include "cpu_util.h"
-
-/*
-
-E2K /proc/cpuinfo:
-
-
-processor : 0
-vendor_id : E8C-SWTX
-cpu family : 4
-model : 7
-model name : E8C
-revision : 2
-cpu MHz : 1299.912740
-cache0 : level=1 type=Instruction scope=Private size=128K line_size=256 associativity=4
-cache1 : level=1 type=Data scope=Private size=64K line_size=32 associativity=4
-cache2 : level=2 type=Unified scope=Private size=512K line_size=64 associativity=4
-cache3 : level=3 type=Unified scope=Private size=16384K line_size=64 associativity=16
-bogomips : 2600.68
-
-*/
-
-
-typedef struct _ProcessorCache ProcessorCache;
-
-struct _ProcessorCache {
- gint level;
- gint number_of_sets;
- gint physical_line_partition;
- gint size;
- gchar *type;
- gint ways_of_associativity;
- gint uid; /* uid is unique among caches with the same (type, level) */
- gchar *shared_cpu_list; /* some kernel's don't give a uid, so try shared_cpu_list */
- gint phy_sock;
-};
-
-//e2k processor structure
-struct _Processor {
- gint id;
- gfloat cpu_mhz;
- gchar *model_name;
- gchar *vendor_id;
- gfloat bogomips;
-
- gint model, family, revision;
-
- GSList *cache;
-};
-
-#endif /* __PROCESSOR_PLATFORM_H__ */
diff --git a/includes/loongarch64/processor-platform.h b/includes/loongarch64/processor-platform.h
index 43ba0a26..006b762a 100644
--- a/includes/loongarch64/processor-platform.h
+++ b/includes/loongarch64/processor-platform.h
@@ -4,7 +4,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 2.
+ * the Free Software Foundation, version 2 or Later.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/modules/devices/e2k/processor.c b/modules/devices/e2k/processor.c
deleted file mode 100644
index 74476853..00000000
--- a/modules/devices/e2k/processor.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * HardInfo - Displays System Information
- * Copyright (C) 2020 EntityFX <artem.solopiy@gmail.com> and MCST Elbrus Team
- * modified by Boris Afonot <boris.afonot@gmail.com> (2022)
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "hardinfo.h"
-#include "devices.h"
-#include "cpu_util.h"
-
-static gchar *__cache_get_info_as_string(Processor *processor)
-{
- gchar *result = g_strdup("");
- GSList *cache_list;
- ProcessorCache *cache;
-
- if (!processor->cache) {
- return g_strdup(_("Cache information not available=\n"));
- }
-
- for (cache_list = processor->cache; cache_list; cache_list = cache_list->next) {
- cache = (ProcessorCache *)cache_list->data;
-
- result = h_strdup_cprintf(_("Level %d (%s)=%d-way set-associative, %d sets, %dKB size\n"),
- result,
- cache->level,
- C_("cache-type", cache->type),
- cache->ways_of_associativity,
- cache->number_of_sets,
- cache->size);
- }
-
- return result;
-}
-
-/* This is not used directly, but creates translatable strings for
- * the type string returned from /sys/.../cache */
-static const char* cache_types[] = {
- NC_("cache-type", /*/cache type, as appears in: Level 1 (Data)*/ "Data"),
- NC_("cache-type", /*/cache type, as appears in: Level 1 (Instruction)*/ "Instruction"),
- NC_("cache-type", /*/cache type, as appears in: Level 2 (Unified)*/ "Unified")
-};
-
-static void __cache_obtain_info(Processor *processor)
-{
- ProcessorCache *cache;
- gchar *endpoint, *entry, *index;
- gchar *uref = NULL;
- gint i;
- gint processor_number = processor->id;
-
- endpoint = g_strdup_printf("/sys/devices/system/cpu/cpu%d/cache", processor_number);
-
- for (i = 0; ; i++) {
- cache = g_new0(ProcessorCache, 1);
-
- index = g_strdup_printf("index%d/", i);
-
- entry = g_strconcat(index, "type", NULL);
- cache->type = h_sysfs_read_string(endpoint, entry);
- g_free(entry);
-
- if (!cache->type) {
- g_free(cache);
- g_free(index);
- goto fail;
- }
-
- entry = g_strconcat(index, "level", NULL);
- cache->level = h_sysfs_read_int(endpoint, entry);
- g_free(entry);
-
- entry = g_strconcat(index, "number_of_sets", NULL);
- cache->number_of_sets = h_sysfs_read_int(endpoint, entry);
- g_free(entry);
-
- entry = g_strconcat(index, "physical_line_partition", NULL);
- cache->physical_line_partition = h_sysfs_read_int(endpoint, entry);
- g_free(entry);
-
- entry = g_strconcat(index, "size", NULL);
- cache->size = h_sysfs_read_int(endpoint, entry);
- g_free(entry);
-
- entry = g_strconcat(index, "ways_of_associativity", NULL);
- cache->ways_of_associativity = h_sysfs_read_int(endpoint, entry);
- g_free(entry);
-
- /* unique cache references: id is nice, but share_cpu_list can be
- * used if it is not available. */
- entry = g_strconcat(index, "id", NULL);
- uref = h_sysfs_read_string(endpoint, entry);
- g_free(entry);
- if (uref != NULL && *uref != 0 )
- cache->uid = atoi(uref);
- else
- cache->uid = -1;
- g_free(uref);
- entry = g_strconcat(index, "shared_cpu_list", NULL);
- cache->shared_cpu_list = h_sysfs_read_string(endpoint, entry);
- g_free(entry);
-
- /* reacharound */
- entry = g_strconcat(index, "../../topology/physical_package_id", NULL);
- cache->phy_sock = h_sysfs_read_int(endpoint, entry);
- g_free(entry);
-
- g_free(index);
-
- processor->cache = g_slist_append(processor->cache, cache);
- }
-
-fail:
- g_free(endpoint);
-}
-
-#define cmp_cache_test(f) if (a->f < b->f) return -1; if (a->f > b->f) return 1;
-
-static gint cmp_cache(ProcessorCache *a, ProcessorCache *b) {
- gint i = 0;
- cmp_cache_test(phy_sock);
- i = g_strcmp0(a->type, b->type); if (i!=0) return i;
- cmp_cache_test(level);
- cmp_cache_test(size);
- cmp_cache_test(uid); /* uid is unique among caches with the same (type, level) */
- if (a->uid == -1) {
- /* if id wasn't available, use shared_cpu_list as a unique ref */
- i = g_strcmp0(a->shared_cpu_list, b->shared_cpu_list); if (i!=0)
- return i;
- }
- return 0;
-}
-
-static gint cmp_cache_ignore_id(ProcessorCache *a, ProcessorCache *b) {
- gint i = 0;
- cmp_cache_test(phy_sock);
- i = g_strcmp0(a->type, b->type); if (i!=0) return i;
- cmp_cache_test(level);
- cmp_cache_test(size);
- return 0;
-}
-
-gchar *caches_summary(GSList * processors)
-{
- gchar *ret = g_strdup_printf("[%s]\n", _("Caches"));
- GSList *all_cache = NULL, *uniq_cache = NULL;
- GSList *tmp, *l;
- Processor *p;
- ProcessorCache *c, *cur = NULL;
- gint cur_count = 0, i = 0;
-
- /* create list of all cache references */
- for (l = processors; l; l = l->next) {
- p = (Processor*)l->data;
- if (p->cache) {
- tmp = g_slist_copy(p->cache);
- if (all_cache) {
- all_cache = g_slist_concat(all_cache, tmp);
- } else {
- all_cache = tmp;
- }
- }
- }
-
- if (g_slist_length(all_cache) == 0) {
- ret = h_strdup_cprintf("%s=\n", ret, _("(Not Available)") );
- g_slist_free(all_cache);
- return ret;
- }
-
- /* ignore duplicate references */
- all_cache = g_slist_sort(all_cache, (GCompareFunc)cmp_cache);
- for (l = all_cache; l; l = l->next) {
- c = (ProcessorCache*)l->data;
- if (!cur) {
- cur = c;
- } else {
- if (cmp_cache(cur, c) != 0) {
- uniq_cache = g_slist_prepend(uniq_cache, cur);
- cur = c;
- }
- }
- }
- uniq_cache = g_slist_prepend(uniq_cache, cur);
- uniq_cache = g_slist_reverse(uniq_cache);
- cur = 0, cur_count = 0;
-
- /* count and list caches */
- for (l = uniq_cache; l; l = l->next) {
- c = (ProcessorCache*)l->data;
- if (!cur) {
- cur = c;
- cur_count = 1;
- } else {
- if (cmp_cache_ignore_id(cur, c) != 0) {
- ret = h_strdup_cprintf(_("Level %d (%s)#%d=%dx %dKB (%dKB), %d-way set-associative, %d sets\n"),
- ret,
- cur->level,
- C_("cache-type", cur->type),
- cur->phy_sock,
- cur_count,
- cur->size,
- cur->size * cur_count,
- cur->ways_of_associativity,
- cur->number_of_sets);
- cur = c;
- cur_count = 1;
- } else {
- cur_count++;
- }
- }
- }
- ret = h_strdup_cprintf(_("Level %d (%s)#%d=%dx %dKB (%dKB), %d-way set-associative, %d sets\n"),
- ret,
- cur->level,
- C_("cache-type", cur->type),
- cur->phy_sock,
- cur_count,
- cur->size,
- cur->size * cur_count,
- cur->ways_of_associativity,
- cur->number_of_sets);
-
- g_slist_free(all_cache);
- g_slist_free(uniq_cache);
- return ret;
-}
-
-static gchar *processor_get_full_name(const gchar *model_name)
-{
- if(g_strcmp0(model_name ,"E2S") == 0)
- return "Elbrus-4C";
- else if(g_strcmp0(model_name ,"E1C+") == 0)
- return "Elbrus-1C+";
- else if(g_strcmp0(model_name ,"E2C+DSP") == 0)
- return "Elbrus-2C+";
- else if(g_strcmp0(model_name ,"E8C") == 0)
- return "Elbrus-8C";
- else if(g_strcmp0(model_name ,"E8C2") == 0)
- return "Elbrus-8CB";
- else if(g_strcmp0(model_name ,"E12C") == 0)
- return "Elbrus-12C";
- else if(g_strcmp0(model_name ,"E16C") == 0)
- return "Elbrus-16C";
- else if(g_strcmp0(model_name ,"E2C3") == 0)
- return "Elbrus-2C3";
- else
- return (gchar *)model_name;
-}
-
-GSList *processor_scan(void)
-{
- GSList *procs = NULL, *l = NULL;
- Processor *processor = NULL;
- FILE *cpuinfo;
- gchar buffer[1024];
-
- cpuinfo = fopen(PROC_CPUINFO, "r");
- if (!cpuinfo)
- return NULL;
-
- while (fgets(buffer, 1024, cpuinfo)) {
- gchar **tmp = g_strsplit(buffer, ":", 2);
- if (!tmp[1] || !tmp[0]) {
- g_strfreev(tmp);
- continue;
- }
-
- tmp[0] = g_strstrip(tmp[0]);
- tmp[1] = g_strstrip(tmp[1]);
-
- if (g_str_has_prefix(tmp[0], "processor")) {
- /* finish previous */
- if (processor)
- procs = g_slist_append(procs, processor);
-
- /* start next */
- processor = g_new0(Processor, 1);
- processor->id = atol(tmp[1]);
- g_strfreev(tmp);
- continue;
- }
-
- if (processor) {
- if (g_str_has_prefix(tmp[0], "model name")) {
- const gchar *model_name = processor_get_full_name(tmp[1]);
- processor->model_name = g_strdup(model_name);
- g_strfreev(tmp);
- continue;
- }
-
- get_str("vendor_id", processor->vendor_id);
- get_int("cpu family", processor->family);
- get_int("model", processor->model);
- get_int("revision", processor->revision);
-
- get_float("cpu MHz", processor->cpu_mhz);
- get_float("bogomips", processor->bogomips);
- }
-
- //populate processor structure
- g_strfreev(tmp);
- }
-
- //appent to the list
- if (processor)
- procs = g_slist_append(procs, processor);
-
- for (l = procs; l; l = l->next) {
- processor = (Processor *) l->data;
- __cache_obtain_info(processor);
- }
-
- fclose(cpuinfo);
-
- return procs;
-}
-
-gchar *processor_name(GSList * processors) {
- return processor_name_default(processors);
-}
-
-gchar *processor_describe(GSList * processors) {
- return processor_describe_default(processors);
-}
-
-gchar *
-processor_get_detailed_info(Processor *processor)
-{
- gchar *ret;
- gchar *cache_info;
- cache_info = __cache_get_info_as_string(processor);
-
- ret = g_strdup_printf("[%s]\n"
- "$^$%s=%s\n" /* name */
- "$^$%s=%s\n" /* vendor */
- "%s=%d\n" /* family */
- "%s=%d\n" /* model */
- "%s=%d\n" /* revision */
- "%s=%.2f %s\n" /* frequency */
- "%s=%.2f\n" /* bogomips */
- "%s=%s\n" /* byte order */
- "[%s]\n" /* cache */
- "%s\n",
- _("Processor"),
- _("Name"), processor->model_name,
- _("Vendor"), processor->vendor_id,
- _("Family"), processor->family,
- _("Model"), processor->model,
- _("Revision"), processor->revision,
- _("Frequency"), processor->cpu_mhz, _("MHz"),
- _("BogoMips"), processor->bogomips,
- _("Byte Order"), byte_order_str(),
- _("Cache"), cache_info
- );
- g_free(cache_info);
- return ret;
-}
-
-//prepare processor info for all cpus
-gchar *processor_get_info(GSList * processors)
-{
- Processor *processor;
-
- gchar *ret, *tmp, *hashkey;
- GSList *l;
-
- tmp = g_strdup("");
-
- for (l = processors; l; l = l->next) {
- processor = (Processor *) l->data;
- gchar *model_name = g_strdup_printf("MCST %s", processor->model_name);
-
- /* change vendor id of 8CB processor for correct parse from vendor.ids */
- if (!g_strcmp0(processor->vendor_id, "E8C")) {
- gchar *orig_vendor_id = processor->vendor_id;
- processor->vendor_id = g_strdup_printf("%s-SWTX", orig_vendor_id);
- free(orig_vendor_id);
- }
-
- const Vendor *v = vendor_match(processor->vendor_id, NULL);
- if (v)
- tag_vendor(&model_name, 0, v->name_short ? v->name_short : v->name, v->ansi_color, params.fmt_opts);
-
- tmp = g_strdup_printf("%s$CPU%d$cpu%d=%.2f %s|%s\n",
- tmp, processor->id,
- processor->id,
- processor->cpu_mhz, _("MHz"),
- model_name);
-
- hashkey = g_strdup_printf("CPU%d", processor->id);
- moreinfo_add_with_prefix("DEV", hashkey,
- processor_get_detailed_info(processor));
- g_free(hashkey);
- }
-
- ret = g_strdup_printf("[$ShellParam$]\n"
- "ViewType=1\n"
- "ColumnTitle$TextValue=%s\n"
- "ColumnTitle$Value=%s\n"
- "ColumnTitle$Extra1=%s\n"
- "ShowColumnHeaders=true\n"
- "[Processors]\n"
- "%s", _("Device"), _("Frequency"), _("Model"), tmp);
- g_free(tmp);
-
- return ret;
-}
diff --git a/tools/create_debian_source.sh b/tools/create_debian_source.sh
new file mode 100755
index 00000000..a267d1f9
--- /dev/null
+++ b/tools/create_debian_source.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+VERSION=2.0.12
+cd ..
+rm -rf build
+mkdir build
+cd build
+cmake ..
+make package_source
+tar -xzf hardinfo-$VERSION.tar.gz
+cd hardinfo-$VERSION
+debmake
+tar -czf ../hardinfo-$VERSION.debian.tar.gz debian
+cd ..
+mv hardinfo-$VERSION.tar.gz hardinfo-$VERSION.orig.tar.gz
+
+echo "Format: 3.0 (quilt)
+Source: hardinfo
+Binary: hardinfo
+Architecture: any
+Version: $VERSION
+Maintainer: hwspeedy <hardinfo2@bigbear.dk>
+Homepage: https://hardinfo2.org
+Standards-Version: 4.1.3
+Vcs-Browser: https://salsa.debian.org/hwspeedy/hardinfo2
+Vcs-Git: https://salsa.debian.org/hwspeedy/hardinfo2.git
+Build-Depends: cmake, debhelper (>= 11), libjson-glib-dev, zlib1g-dev, libsoup2.4-dev, libgtk-3-dev
+Package-List:
+ hardinfo deb x11 optional arch=any
+Checksums-Sha1:" >./hardinfo-$VERSION.dsc
+sha1sum hardinfo-$VERSION.*.tar.gz >>./hardinfo-$VERSION.dsc
+echo "Checksums-Sha256:">>./hardinfo-$VERSION.dsc
+sha256sum hardinfo-$VERSION.*.tar.gz >>./hardinfo-$VERSION.dsc
+echo "Files:">>./hardinfo-$VERSION.dsc
+md5sum hardinfo-$VERSION.*.tar.gz >>./hardinfo-$VERSION.dsc
+
+echo "Debian Source Package Files ready in build:"
+ls -l hardinfo-$VERSION.*.tar.gz
+ls -l hardinfo-$VERSION.dsc