Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package powerstat for openSUSE:Factory checked in at 2024-03-13 22:18:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/powerstat (Old) and /work/SRC/openSUSE:Factory/.powerstat.new.1770 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "powerstat" Wed Mar 13 22:18:08 2024 rev:17 rq:1157083 version:0.04.03 Changes: -------- --- /work/SRC/openSUSE:Factory/powerstat/powerstat.changes 2023-06-13 16:09:43.362960691 +0200 +++ /work/SRC/openSUSE:Factory/.powerstat.new.1770/powerstat.changes 2024-03-13 22:19:04.469368087 +0100 @@ -1,0 +2,8 @@ +Mon Mar 11 08:45:29 UTC 2024 - Andrea Manzini <andrea.manz...@suse.com> + +- Update to version 0.04.03: + * Re-use last ujoules setting if current value is invalid + * Ignore power readings that are zero + * Minor copyright updates and optimization flag setting changes + +------------------------------------------------------------------- Old: ---- V0.03.03.tar.gz New: ---- V0.04.03.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ powerstat.spec ++++++ --- /var/tmp/diff_new_pack.gAzJkZ/_old 2024-03-13 22:19:05.101391386 +0100 +++ /var/tmp/diff_new_pack.gAzJkZ/_new 2024-03-13 22:19:05.101391386 +0100 @@ -1,7 +1,7 @@ # # spec file for package powerstat # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # Copyright (c) 2017-2021, Martin Hauke <mar...@gmx.de> # # All modifications and additions to the file contributed by third parties @@ -18,7 +18,7 @@ Name: powerstat -Version: 0.03.03 +Version: 0.04.03 Release: 0 Summary: Laptop power measuring tool License: GPL-2.0-only ++++++ V0.03.03.tar.gz -> V0.04.03.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerstat-0.03.03/Makefile new/powerstat-0.04.03/Makefile --- old/powerstat-0.03.03/Makefile 2023-04-24 18:32:47.000000000 +0200 +++ new/powerstat-0.04.03/Makefile 2024-03-06 15:12:36.000000000 +0100 @@ -1,6 +1,6 @@ # # Copyright (C) 2011-2021 Canonical, Ltd. -# Copyright (C) 2021-2023 Colin Ian King. +# Copyright (C) 2021-2024 Colin Ian King. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -17,9 +17,9 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION=0.03.03 +VERSION=0.04.03 -CFLAGS += -Wall -Wextra -DVERSION='"$(VERSION)"' +CFLAGS += -Wall -Wextra -DVERSION='"$(VERSION)"' -O2 # # Pedantic flags @@ -45,7 +45,7 @@ dist: rm -rf powerstat-$(VERSION) mkdir powerstat-$(VERSION) - cp -rp Makefile mascot powerstat.c powerstat.8 COPYING snap \ + cp -rp Makefile mascot powerstat.c powerstat.8 COPYING rpm \ .travis.yml bash-completion README.md powerstat-$(VERSION) tar -Jcf powerstat-$(VERSION).tar.xz powerstat-$(VERSION) rm -rf powerstat-$(VERSION) @@ -60,4 +60,4 @@ mkdir -p ${DESTDIR}${MANDIR} cp powerstat.8.gz ${DESTDIR}${MANDIR} mkdir -p ${DESTDIR}${BASHDIR} - cp bash-completion/powerstat ${DESTDIR}${BASHDIR} + cp -p bash-completion/powerstat ${DESTDIR}${BASHDIR} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerstat-0.03.03/README.md new/powerstat-0.04.03/README.md --- old/powerstat-0.03.03/README.md 2023-04-24 18:32:47.000000000 +0200 +++ new/powerstat-0.04.03/README.md 2024-03-06 15:12:36.000000000 +0100 @@ -1,5 +1,11 @@ + + # Powerstat +<a href="https://repology.org/project/powerstat/versions"> + <img src="https://repology.org/badge/vertical-allrepos/powerstat.svg" alt="Packaging status" align="right"> +</a> + Powerstat measures the power consumption of a laptop using the ACPI battery information. The output is like vmstat but also shows power consumption statistics. At the end of a run, powerstat will calculate the average, standard deviation and min/max of the gathered data. ## Example diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerstat-0.03.03/debian/changelog new/powerstat-0.04.03/debian/changelog --- old/powerstat-0.03.03/debian/changelog 2023-04-24 18:32:47.000000000 +0200 +++ new/powerstat-0.04.03/debian/changelog 2024-03-06 15:12:36.000000000 +0100 @@ -1,3 +1,45 @@ +powerstat (0.04.03-1) unstable; urgency=medium + + * Makefile: bump version + * Re-use last ujoules setting if current value is invalid + * Ignore power readings that are zero + + -- Colin Ian King <colin.i.k...@gmail.com> Wed, 6 Mar 2024 14:12:10 +0000 + +powerstat (0.04.02-1) unstable; urgency=medium + + * rpm: update spec for 0.04.02 + * Makefile: bump version + * Makefile: add -O2 to optimization flags + * Update copyright year to 2024 + * debian/rules: add missing hardening settings + + -- Colin Ian King <colin.i.k...@gmail.com> Fri, 12 Jan 2024 10:42:36 +0000 + +powerstat (0.04.01-1) unstable; urgency=medium + + * rpm: update spec for 0.04.01 + * Makefile: bump version + * Typo powerstat.c missing dot + * Rename strlcpy with bsd_strlcpy to avoid name clashing with glibc-2.38 + * Show logo in README + * Create RPM spec file + * Preserve bash completion file timestamp + + -- Colin Ian King <colin.i.k...@gmail.com> Fri, 24 Nov 2023 10:48:11 +0000 + +powerstat (0.04.00-1) unstable; urgency=medium + + * Makefile: bump version + * Report N/A for unknown CPU/GPU frequencies + * Makefile: remove snap from make dist rule + * Update manual and help for -a option, note it enables -g + * Add -g GPU frequency stats option + * Remove snapcraft + * README.md: Add repology link + + -- Colin Ian King <colin.i.k...@gmail.com> Fri, 24 Nov 2023 10:13:24 +0000 + powerstat (0.03.03-1) unstable; urgency=medium * Makefile:: bump version diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerstat-0.03.03/debian/rules new/powerstat-0.04.03/debian/rules --- old/powerstat-0.03.03/debian/rules 2023-04-24 18:32:47.000000000 +0200 +++ new/powerstat-0.04.03/debian/rules 2024-03-06 15:12:36.000000000 +0100 @@ -1,5 +1,9 @@ #!/usr/bin/make -f +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/buildflags.mk + override_dh_auto_build: $(shell dpkg-buildflags --export=sh); dh_auto_build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerstat-0.03.03/powerstat.8 new/powerstat-0.04.03/powerstat.8 --- old/powerstat-0.03.03/powerstat.8 2023-04-24 18:32:47.000000000 +0200 +++ new/powerstat-0.04.03/powerstat.8 2024-03-06 15:12:36.000000000 +0100 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH POWERSTAT 8 "24 January 2023" +.TH POWERSTAT 8 "12 January 2024" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -41,7 +41,7 @@ powerstat options are as follow: .TP .B \-a -enable all statistics gathering options, equivalent to \-c, \-f, \-t and \-H. +enable all statistics gathering options, equivalent to \-c, \-f, \-g, \-t and \-H. .TP .B \-b redo a sample measurement if a system is busy, the default for busy is considered less than 98% CPU idle. The CPU idle threshold can be altered using the \-i option. @@ -60,6 +60,9 @@ powerstat has to be running to do so, so these statistics are skewed by this. It is best to use this option with a reasonably large delay (more than 5 seconds) between samples to reduce the overhead of powerstat. .TP +.B \-g +report GPU frequency of card0. +.TP .B \-h show help. .TP @@ -159,7 +162,7 @@ This manual page was written by Colin Ian King <colin.i.k...@gmail.com>, for the Ubuntu project (but may be used by others). .SH COPYRIGHT -Copyright \(co 2011-2021 Canonical Ltd. Copyright \(co 2021-2023 Colin Ian King +Copyright \(co 2011-2021 Canonical Ltd. Copyright \(co 2021-2024 Colin Ian King .br This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerstat-0.03.03/powerstat.c new/powerstat-0.04.03/powerstat.c --- old/powerstat-0.03.03/powerstat.c 2023-04-24 18:32:47.000000000 +0200 +++ new/powerstat-0.04.03/powerstat.c 2024-03-06 15:12:36.000000000 +0100 @@ -1,6 +1,6 @@ /* * Copyright (C) 2011-2021 Canonical - * Copyright (C) 2021-2023 Colin Ian King + * Copyright (C) 2021-2024 Colin Ian King * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -106,6 +106,7 @@ CPU_FREQ, CPU_FREQ_MIN, CPU_FREQ_MAX, + GPU_FREQ, PROC_FORK, PROC_EXEC, PROC_EXIT, @@ -191,6 +192,7 @@ #define OPTS_CPU_FREQ (0x1000) /* Average CPU frequency */ #define OPTS_NO_STATS_HEADINGS (0x2000) /* No stats headings */ #define OPTS_THERMAL_ZONE (0x4000) /* Thermal zones */ +#define OPTS_GPU_FREQ (0x8000) /* GPU frequency */ #define OPTS_USE_NETLINK (OPTS_SHOW_PROC_ACTIVITY | \ OPTS_REDO_NETLINK_BUSY | \ @@ -332,10 +334,10 @@ }; /* - * strlcpy() + * bsd_strlcpy() * BSD strlcpy */ -static size_t strlcpy(char *dst, const char *src, size_t len) +static size_t bsd_strlcpy(char *dst, const char *src, size_t len) { char *d = dst; const char *s = src; @@ -444,16 +446,20 @@ double scale = 1e18; size_t i; - for (i = 0; cpu_freq_scale[i].suffix; i++) { - if (f < cpu_freq_scale[i].threshold) { - suffix = cpu_freq_scale[i].suffix; - scale = cpu_freq_scale[i].scale; - break; + if (freq > 0) { + for (i = 0; cpu_freq_scale[i].suffix; i++) { + if (f < cpu_freq_scale[i].threshold) { + suffix = cpu_freq_scale[i].suffix; + scale = cpu_freq_scale[i].scale; + break; + } } - } - (void)snprintf(buffer, sizeof(buffer), "%5.2f %-3s", - f / scale, suffix); + (void)snprintf(buffer, sizeof(buffer), "%5.2f %-3s", + f / scale, suffix); + } else { + (void)snprintf(buffer, sizeof(buffer), " N/A "); + } return buffer; } @@ -786,6 +792,19 @@ stats_clear(&stats[i]); } +static void stats_gpu_freq_read(stats_t *const stats) +{ + uint64_t freq = 0; + + if (file_get_uint64("/sys/class/drm/card0/gt_cur_freq_mhz", &freq) == 0) { + stats->value[GPU_FREQ] = (double)freq; + } else if (file_get_uint64("/sys/class/graphics/fb0/device/drm/card0/gt_cur_freq_mhz", &freq) == 0) { + stats->value[GPU_FREQ] = (double)freq; + } else { + stats->value[GPU_FREQ] = 0.0; + } +} + static void stats_cpu_freq_read(stats_t *const stats) { struct dirent **cpu_list = NULL; @@ -902,6 +921,9 @@ if (opts & OPTS_CPU_FREQ) stats_cpu_freq_read(stats); + if (opts & OPTS_GPU_FREQ) + stats_gpu_freq_read(stats); + return 0; } @@ -990,6 +1012,7 @@ res->value[CPU_FREQ] = s2->value[CPU_FREQ]; res->value[CPU_FREQ_MIN] = s2->value[CPU_FREQ_MIN]; res->value[CPU_FREQ_MAX] = s2->value[CPU_FREQ_MAX]; + res->value[GPU_FREQ] = s2->value[GPU_FREQ]; return true; } @@ -1009,9 +1032,9 @@ if (opts & (OPTS_DOMAIN_STATS | OPTS_THERMAL_ZONE | - OPTS_CPU_FREQ)) + OPTS_CPU_FREQ | + OPTS_GPU_FREQ)) (void)putchar(' '); - if (opts & OPTS_DOMAIN_STATS) { for (i = 0; i < power_domains; i++) (void)printf(" %6.6s", @@ -1023,6 +1046,8 @@ } if (opts & OPTS_CPU_FREQ) (void)printf(" %9.9s %9.9s %9.9s", "CPU Freq", "Freq Min", "Freq Max"); + if (opts & OPTS_GPU_FREQ) + (void)printf(" %9.9s", "GPU Freq"); (void)printf("\n"); } @@ -1048,6 +1073,8 @@ (void)printf(" ------"); } if (opts & OPTS_CPU_FREQ) + (void)printf(" --------- --------- ---------"); + if (opts & OPTS_GPU_FREQ) (void)printf(" ---------"); (void)printf("\n"); } @@ -1134,6 +1161,8 @@ (void)printf(" %s", cpu_freq_format(s->value[CPU_FREQ_MIN])); (void)printf(" %s", cpu_freq_format(s->value[CPU_FREQ_MAX])); } + if (opts & OPTS_GPU_FREQ) + (void)printf(" %s", cpu_freq_format(s->value[GPU_FREQ])); (void)printf("\n"); } @@ -1787,7 +1816,7 @@ char buf[sizeof(domain_name)]; (void)snprintf(buf, sizeof(buf), "pkg-%s", domain_name + 8); - strlcpy(domain_name, buf, sizeof(domain_name)); + bsd_strlcpy(domain_name, buf, sizeof(domain_name)); } if (rapl_domain_unique(domain_name)) @@ -1810,7 +1839,7 @@ power_domains = MIN(n, MAX_POWER_DOMAINS); if (!n) - (void)printf("Device does not have any RAPL domains, cannot power measure power usage\n"); + (void)printf("Device does not have any RAPL domains, cannot measure power usage.\n"); return n; } @@ -1841,7 +1870,7 @@ break; } names = tmp; - (void)strlcpy(names + len, new_name, new_len + 1); + (void)bsd_strlcpy(names + len, new_name, new_len + 1); len += new_len; } @@ -1888,29 +1917,36 @@ double t_delta = t_now - rapl->t_last; double last_energy_uj = rapl->last_energy_uj; - rapl->t_last = t_now; - - /* Wrapped around since last time? */ - if (ujoules - rapl->last_energy_uj < 0.0) { - rapl->last_energy_uj = ujoules; - ujoules += rapl->max_energy_uj; - } else { - rapl->last_energy_uj = ujoules; - } + /* Invalid, re-use last value as a workaround */ + if (ujoules <= 0.0) + ujoules = rapl->last_energy_uj; + + /* ensure we have a valid value */ + if (ujoules > 0.0) { + rapl->t_last = t_now; + + /* Wrapped around since last time? */ + if (ujoules - rapl->last_energy_uj < 0.0) { + rapl->last_energy_uj = ujoules; + ujoules += rapl->max_energy_uj; + } else { + rapl->last_energy_uj = ujoules; + } - if (first || (t_delta <= 0.0)) { - stats->value[POWER_DOMAIN_0 + n] = 0.0; - stats->inaccurate[POWER_DOMAIN_0 + n] = true; - } else { - stats->value[POWER_DOMAIN_0 + n] = - (ujoules - last_energy_uj) / (t_delta * 1000000.0); - stats->inaccurate[POWER_DOMAIN_0 + n] = false; - } - if (!stats->inaccurate[POWER_DOMAIN_0 + n]) { - stats->value[POWER_TOTAL] += stats->value[POWER_DOMAIN_0 + n]; + if (first || (t_delta <= 0.0)) { + stats->value[POWER_DOMAIN_0 + n] = 0.0; + stats->inaccurate[POWER_DOMAIN_0 + n] = true; + } else { + stats->value[POWER_DOMAIN_0 + n] = + (ujoules - last_energy_uj) / (t_delta * 1000000.0); + stats->inaccurate[POWER_DOMAIN_0 + n] = false; + } + if (!stats->inaccurate[POWER_DOMAIN_0 + n]) { + stats->value[POWER_TOTAL] += stats->value[POWER_DOMAIN_0 + n]; + } + n++; + *discharging = true; } - n++; - *discharging = true; } (void)fclose(fp); } @@ -2149,7 +2185,7 @@ free(s); return NULL; } - (void)strlcpy(s->name_short, name, len + 1); + (void)bsd_strlcpy(s->name_short, name, len + 1); s->name_short[len] = '\0'; s->hash_next = cpu_states[h]; cpu_states[h] = s; @@ -2192,10 +2228,10 @@ (void)memset(buffer, 0, sizeof(buffer)); if ((fp = fopen(path, "r")) != NULL) { if (fscanf(fp, "%63s", buffer) != 1) - (void)strlcpy(buffer, "unknown", sizeof(buffer)); + (void)bsd_strlcpy(buffer, "unknown", sizeof(buffer)); (void)fclose(fp); } else { - (void)strlcpy(buffer, state, sizeof(buffer)); + (void)bsd_strlcpy(buffer, state, sizeof(buffer)); } if ((ci->cpu_state = cpu_state_get(buffer)) == NULL) { free(ci->state); @@ -2438,7 +2474,7 @@ } if (n < 1) { - (void)strlcpy(cmdline, "<unknown>", size); + (void)bsd_strlcpy(cmdline, "<unknown>", size); n = 9; } @@ -2913,12 +2949,13 @@ { (void)printf("%s, version %s\n\n", app_name, VERSION); (void)printf("usage: %s [options] [delay [count]]\n", argv[0]); - (void)printf("\t-a enable all sampling collection options (-c, -f, -t and -H)\n"); + (void)printf("\t-a enable all sampling collection options (-c, -f, -g, -t and -H)\n"); (void)printf("\t-b redo a sample if a system is busy, considered less than %d%% CPU idle\n", IDLE_THRESHOLD); (void)printf("\t-c show C-State statistics at end of the run\n"); (void)printf("\t-d specify delay before starting, default is %" PRId32 " seconds\n", start_delay); (void)printf("\t-D show RAPL domain power measurements (enables -R option)\n"); (void)printf("\t-f show average CPU frequency\n"); + (void)printf("\t-g show average GPU frequency\n"); (void)printf("\t-h show help\n"); (void)printf("\t-H show spread of measurements with power histogram\n"); (void)printf("\t-i specify CPU idle threshold, used in conjunction with -b\n"); @@ -2949,9 +2986,9 @@ for (;;) { #if defined(POWERSTAT_X86) - int c = getopt(argc, argv, "abd:cDfhHi:nprszStR"); + int c = getopt(argc, argv, "abd:cDfghHi:nprszStR"); #else - int c = getopt(argc, argv, "abd:cDfhHi:nprszSt"); + int c = getopt(argc, argv, "abd:cDfghHi:nprszSt"); #endif if (c == -1) break; @@ -2959,6 +2996,7 @@ case 'a': opts |= (OPTS_CSTATES | OPTS_CPU_FREQ | + OPTS_GPU_FREQ | OPTS_HISTOGRAM | OPTS_THERMAL_ZONE); break; @@ -2987,6 +3025,9 @@ case 'f': opts |= OPTS_CPU_FREQ; break; + case 'g': + opts |= OPTS_GPU_FREQ; + break; case 'h': show_help(argv); exit(EXIT_SUCCESS); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerstat-0.03.03/rpm/powerstat.spec new/powerstat-0.04.03/rpm/powerstat.spec --- old/powerstat-0.03.03/rpm/powerstat.spec 1970-01-01 01:00:00.000000000 +0100 +++ new/powerstat-0.04.03/rpm/powerstat.spec 2024-03-06 15:12:36.000000000 +0100 @@ -0,0 +1,53 @@ +Summary: Measures the power consumption of a machine +Name: powerstat +License: GPL-2.0-only +Version: 0.04.02 +Release: 1%{?dist} + +URL: https://github.com/ColinIanKing/powerstat +Source0: %{url}/archive/V%{version}/%{name}-V%{version}.tar.gz + +BuildRequires: bash-completion +BuildRequires: gcc +BuildRequires: make +# This is not linked to the executable +Requires: bash-completion +# RAPL not available on other architectures +ExclusiveArch: %{ix86} x86_64 + +%description +Powerstat measures the power consumption of a machine using the +battery stats or the Intel RAPL interface. The output is like +vmstat but also shows power consumption statistics. At the end +of a run, powerstat will calculate the average, standard +deviation and min/max of the gathered data. + +%prep +%autosetup + +%build +%make_build + +%install +%make_install + +%check +# Smoke test binary works, no tests available +./powerstat -h + +%files +%doc README.md +%license COPYING +%{_bindir}/powerstat +%{_mandir}/man8/powerstat.8* +%{_datadir}/bash-completion/completions/powerstat + +%changelog +* Fri Jan 12 2023 Colin Ian King <colin.k...@gmail.com> - 0.04.02-1 +- Update to 0.04.02 + +* Fri Nov 24 2023 Colin Ian King <colin.k...@gmail.com> - 0.04.01-1 +- Update to 0.04.01 + +* Wed Jul 19 2023 Benson Muite <benson_mu...@emailplus.org> - 0.04.00-1 +- Initial packaging diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerstat-0.03.03/snap/Makefile new/powerstat-0.04.03/snap/Makefile --- old/powerstat-0.03.03/snap/Makefile 2023-04-24 18:32:47.000000000 +0200 +++ new/powerstat-0.04.03/snap/Makefile 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -all: - snapcraft - -clean: - rm -rf setup *.snap - snapcraft clean diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerstat-0.03.03/snap/snapcraft.yaml new/powerstat-0.04.03/snap/snapcraft.yaml --- old/powerstat-0.03.03/snap/snapcraft.yaml 2023-04-24 18:32:47.000000000 +0200 +++ new/powerstat-0.04.03/snap/snapcraft.yaml 1970-01-01 01:00:00.000000000 +0100 @@ -1,46 +0,0 @@ -name: powerstat -summary: computer power measuring tool -description: Powerstat measures the power consumption of a computer that has a battery power source or an Intel RAPL power domain. The output is like vmstat but also shows power consumption statistics. At the end of a run, powerstat will calculate the average, standard deviation and min/max of the gathered data. -confinement: strict -type: app -grade: stable -assumes: [snapd2.45] -base: core22 -adopt-info: powerstat - -architectures: - - build-on: s390x - - build-on: ppc64el - - build-on: arm64 - - build-on: armhf - - build-on: amd64 - - build-on: i386 - -parts: - powerstat: - plugin: make - source: https://github.com/ColinIanKing/powerstat - source-type: git - override-pull: | - snapcraftctl pull - description="$(git describe HEAD --tags)" - sha=$(echo $description | tr '-' ' ' | awk '{print $NF}') - version=${description%$sha} - commits=$(git log --oneline | wc -l) - date=$(date +'%Y%m%d') - if test "$description" = "$sha" - then - version="$description" - else - version=$(echo $version$date-$commits-$sha | cut -c1-32) - fi - snapcraftctl set-version "$version" - build-packages: - - gcc - - make - -apps: - powerstat: - command: usr/bin/powerstat - plugs: [hardware-observe,netlink-connector,system-observe] -