i3status: update to 2.14

2021-11-09 i3status 2.14

 • switch to meson build system
 • battery: OpenBSD: If acpibat watts value is not available, try current
 • make pulseaudio an optional dependency
 • print_cpu_usage: use buffered file API
 • fix memory leak in slurp()
 • NetBSD: native audio support
 • wireless: Linux: update %signal and %quality based on station info
 • memory: introduce unit and decimals options
 • battery: introduce format_percentage option
 • memory: fix overflow on 32-bit systems
 • use format_placeholder
 • wireless: introduce format_bitrate, format_noise and format_signal
 • cpu: fix out of bounds read after invalid %cpu conversion
 • file system: use f_frsize for correct block size
 • wireless: FreeBSD: support connection bitrate
 • volume: fix memory leak
 • print_file_contents: resolve tilde
 • add build option to disable manual pages
 • pulseaudio: use port name instead of sink name
 • battery: add support for POWER_SUPPLY_TIME_TO_EMPTY (e.g. pinebook pro)
 • tztime: allow selective pango markup
 • wireless: fix memory corruption
This commit is contained in:
nia 2022-04-12 14:43:01 +00:00
parent 1c6c355839
commit f5eca3ae04
8 changed files with 89 additions and 125 deletions

View file

@ -1,10 +1,9 @@
# $NetBSD: Makefile,v 1.21 2022/03/28 10:59:28 tnn Exp $ # $NetBSD: Makefile,v 1.22 2022/04/12 14:43:01 nia Exp $
DISTNAME= i3status-2.13 DISTNAME= i3status-2.14
PKGREVISION= 11
CATEGORIES= sysutils CATEGORIES= sysutils
MASTER_SITES= https://i3wm.org/i3status/ MASTER_SITES= https://i3wm.org/i3status/
EXTRACT_SUFX= .tar.bz2 EXTRACT_SUFX= .tar.xz
MAINTAINER= pkgsrc-users@NetBSD.org MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= https://i3wm.org/i3status/ HOMEPAGE= https://i3wm.org/i3status/
@ -14,12 +13,12 @@ LICENSE= modified-bsd
TOOL_DEPENDS+= asciidoc-[0-9]*:../../textproc/asciidoc TOOL_DEPENDS+= asciidoc-[0-9]*:../../textproc/asciidoc
TOOL_DEPENDS+= xmlto-[0-9]*:../../textproc/xmlto TOOL_DEPENDS+= xmlto-[0-9]*:../../textproc/xmlto
GNU_CONFIGURE= yes USE_TOOLS+= pkg-config bash perl
USE_TOOLS+= gmake pkg-config
INSTALLATION_DIRS= share/examples/${PKGBASE} INSTALLATION_DIRS= share/examples/${PKGBASE}
CONF_FILES= ${PREFIX}/share/examples/${PKGBASE}/i3status.conf ${PKG_SYSCONFDIR}/i3status.conf CONF_FILES= ${PREFIX}/share/examples/${PKGBASE}/i3status.conf \
${PKG_SYSCONFDIR}/i3status.conf
BUILD_DEFS+= VARBASE BUILD_DEFS+= VARBASE
@ -29,14 +28,12 @@ SUBST_MESSAGE.fix-paths= Fixing absolute paths.
SUBST_FILES.fix-paths= man/i3status.* SUBST_FILES.fix-paths= man/i3status.*
SUBST_SED.fix-paths+= -e 's,/var,${VARBASE},g' SUBST_SED.fix-paths+= -e 's,/var,${VARBASE},g'
post-install: .include "options.mk"
${MV} ${DESTDIR}${PREFIX}/etc/i3status.conf ${DESTDIR}${PREFIX}/share/examples/${PKGBASE} .include "../../devel/meson/build.mk"
.include "../../devel/confuse/buildlink3.mk" .include "../../devel/confuse/buildlink3.mk"
.include "../../devel/yajl/buildlink3.mk" .include "../../devel/yajl/buildlink3.mk"
.include "../../mk/bsd.prefs.mk" .include "../../mk/bsd.prefs.mk"
.if ${OPSYS} == "Linux" .if ${OPSYS} == "Linux"
. include "../../audio/alsa-lib/buildlink3.mk" . include "../../audio/alsa-lib/buildlink3.mk"
. include "../../audio/pulseaudio/buildlink3.mk"
.endif .endif
.include "../../mk/bsd.pkg.mk" .include "../../mk/bsd.pkg.mk"

View file

@ -1,9 +1,8 @@
$NetBSD: distinfo,v 1.7 2021/10/26 11:19:42 nia Exp $ $NetBSD: distinfo,v 1.8 2022/04/12 14:43:01 nia Exp $
BLAKE2s (i3status-2.13.tar.bz2) = 75d0bb8994ee49219b2605e397b39f8a0433f1e97dd20e2f9f6d19d5fa17f882 BLAKE2s (i3status-2.14.tar.xz) = 06556d5a7be94cc298368068a9657f0c18b1568a98565e8815231346e51c02c4
SHA512 (i3status-2.13.tar.bz2) = 6dadff19e53499d169ba4f491e1f821014b4f92fc3c93d7947c85cbbbdeaba538d02bd8ab98fe266a8f80756a287fd5803ec77a8cd874d50082b5cad309875c2 SHA512 (i3status-2.14.tar.xz) = 10a1235cc314f5fc4dde4e1369a30f49118c95271f636c5803caa52d94d99ad8565b89fcd602d0c8aa7c830a79d3a3bb08e5ac8123cf07cfddc8ef0126b10f80
Size (i3status-2.13.tar.bz2) = 201409 bytes Size (i3status-2.14.tar.xz) = 68900 bytes
SHA1 (patch-Makefile.in) = e50ed614d41a1bcef33feb6414322affa5e20a92 SHA1 (patch-meson.build) = 8c3a34e49bcedd1a381909afca4357d001b665ab
SHA1 (patch-src_print__volume.c) = b855472d429f17491c7441924e0aca9ce4ee6190 SHA1 (patch-src_print__disk__info.c) = a9fbbcd4aab59cddf6163a9a31e35af78e4c5254
SHA1 (patch-src_print__wireless__info.c) = 7039b7fbd2f43b798763793cd4296035610eeee0 SHA1 (patch-src_print__volume.c) = d57447621989f470d41463810a1f865bf2aed0da
SHA1 (patch-src_pulse.c) = bfc5265c5c11f3a56e9b88c936b9856245b998f4

View file

@ -1,15 +0,0 @@
$NetBSD: patch-Makefile.in,v 1.1 2019/07/22 23:04:31 wiz Exp $
This line gets expanded to
am--fnord am--fnord-all $(TEST_LOGS) $(TEST_LOGS:
--- Makefile.in.orig 2019-06-30 17:54:48.000000000 +0000
+++ Makefile.in
@@ -1346,7 +1346,6 @@ distclean-tags:
# Leading 'am--fnord' is there to ensure the list of targets does not
# expand to empty, as could happen e.g. with make check TESTS=''.
-am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
am--force-recheck:
@:

View file

@ -0,0 +1,15 @@
$NetBSD: patch-meson.build,v 1.1 2022/04/12 14:43:01 nia Exp $
Install configuration to examples, per pkgsrc conventions.
--- meson.build.orig 2021-11-09 07:27:11.974258400 +0000
+++ meson.build
@@ -215,7 +215,7 @@ executable(
install_subdir(
'etc',
strip_directory: true,
- install_dir: get_option('sysconfdir'),
+ install_dir: 'share/examples/i3status'
)
# We cannot use configure_file for run-tests.pl.in

View file

@ -0,0 +1,24 @@
$NetBSD: patch-src_print__disk__info.c,v 1.3 2022/04/12 14:43:01 nia Exp $
Fix building on BSD. Upstream code was changed and the BSD paths
were not tested.
--- src/print_disk_info.c.orig 2021-11-09 07:27:11.974258400 +0000
+++ src/print_disk_info.c
@@ -127,14 +127,14 @@ void print_disk_info(disk_info_ctx_t *ct
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
struct statfs buf;
- if (statfs(path, &buf) == -1)
+ if (statfs(ctx->path, &buf) == -1)
return;
mounted = true;
#elif defined(__NetBSD__)
struct statvfs buf;
- if (statvfs(path, &buf) == -1)
+ if (statvfs(ctx->path, &buf) == -1)
return;
mounted = true;

View file

@ -1,70 +1,45 @@
$NetBSD: patch-src_print__volume.c,v 1.2 2020/03/11 23:28:21 nia Exp $ $NetBSD: patch-src_print__volume.c,v 1.3 2022/04/12 14:43:01 nia Exp $
Use sunaudio on NetBSD. Fix building on BSD. Upstream code was changed and the BSD paths
were not tested.
https://github.com/i3/i3status/pull/391 --- src/print_volume.c.orig 2021-11-09 07:27:11.977591500 +0000
--- src/print_volume.c.orig 2019-01-23 08:03:56.000000000 +0000
+++ src/print_volume.c +++ src/print_volume.c
@@ -21,7 +21,7 @@ @@ -250,8 +250,8 @@ void print_volume(volume_ctx_t *ctx) {
#include <sys/soundcard.h> const char *devicename = "UNSUPPORTED"; /* TODO: implement support for this */
#endif pbval = 1;
-#ifdef __OpenBSD__ - if (mixer_idx > 0)
+#if defined(__NetBSD__) || defined(__OpenBSD__) - asprintf(&mixerpath, "/dev/mixer%d", mixer_idx);
#include <fcntl.h> + if (ctx->mixer_idx > 0)
#include <unistd.h> + asprintf(&mixerpath, "/dev/mixer%d", ctx->mixer_idx);
#include <sys/audioio.h> else
@@ -86,7 +86,7 @@ void print_volume(yajl_gen json_gen, cha mixerpath = defaultmixer;
free(instance);
@@ -264,7 +264,7 @@ void print_volume(volume_ctx_t *ctx) {
goto out;
} }
-#if !defined(__DragonFly__) && !defined(__OpenBSD__) - if (mixer_idx > 0)
+#if defined(__linux__) + if (ctx->mixer_idx > 0)
/* Try PulseAudio first */
/* If the device name has the format "pulse[:N]" where N is the
@@ -248,7 +248,7 @@ void print_volume(yajl_gen json_gen, cha
snd_mixer_selem_id_free(sid);
#endif
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
char *mixerpath;
char defaultmixer[] = "/dev/mixer";
int mixfd, vol, devmask = 0;
@@ -272,7 +272,7 @@ void print_volume(yajl_gen json_gen, cha
if (mixer_idx > 0)
free(mixerpath); free(mixerpath);
-#if defined(__OpenBSD__) #if defined(__NetBSD__) || defined(__OpenBSD__)
+#if defined(__NetBSD__) || defined(__OpenBSD__) @@ -330,7 +330,7 @@ void print_volume(volume_ctx_t *ctx) {
int oclass_idx = -1, master_idx = -1, master_mute_idx = -1;
int master_next = AUDIO_MIXER_LAST; if (vinfo.un.ord) {
mixer_devinfo_t devinfo, devinfo2; START_COLOR("color_degraded");
@@ -327,15 +327,17 @@ void print_volume(yajl_gen json_gen, cha - fmt = fmt_muted;
vol = (int)vinfo.un.value.level[AUDIO_MIXER_LEVEL_MONO]; + ctx->fmt = ctx->fmt_muted;
pbval = 0;
}
}
@@ -351,7 +351,7 @@ void print_volume(volume_ctx_t *ctx) {
} }
- vinfo.dev = master_mute_idx; #endif
- vinfo.type = AUDIO_MIXER_ENUM; - buffer = apply_volume_format(fmt, buffer, vol & 0x7f, devicename);
- if (ioctl(mixfd, AUDIO_MIXER_READ, &vinfo) == -1) + ctx->buf = apply_volume_format(ctx->fmt, vol & 0x7f, devicename);
- goto out; close(mixfd);
+ if (master_mute_idx != -1) { goto out_with_format;
+ vinfo.dev = master_mute_idx; #endif
+ vinfo.type = AUDIO_MIXER_ENUM;
+ if (ioctl(mixfd, AUDIO_MIXER_READ, &vinfo) == -1)
+ goto out;
- if (master_mute_idx != -1 && vinfo.un.ord) {
- START_COLOR("color_degraded");
- fmt = fmt_muted;
- pbval = 0;
+ if (vinfo.un.ord) {
+ START_COLOR("color_degraded");
+ fmt = fmt_muted;
+ pbval = 0;
+ }
}
#else

View file

@ -1,14 +0,0 @@
$NetBSD: patch-src_print__wireless__info.c,v 1.3 2019/07/22 23:04:31 wiz Exp $
Add includes for AF_INET & AF_INET6.
--- src/print_wireless_info.c.orig 2019-01-23 08:03:56.000000000 +0000
+++ src/print_wireless_info.c
@@ -61,6 +61,7 @@
#ifdef __NetBSD__
#include <sys/types.h>
+#include <sys/socket.h>
#include <net80211/ieee80211.h>
#define IW_ESSID_MAX_SIZE IEEE80211_NWID_LEN
#endif

View file

@ -1,17 +0,0 @@
$NetBSD: patch-src_pulse.c,v 1.1 2020/03/11 22:46:36 nia Exp $
The makefile forgets to conditionally build this file even
when pulseaudio isn't available. Hack around this.
--- src/pulse.c.orig 2019-01-23 08:03:56.000000000 +0000
+++ src/pulse.c
@@ -1,3 +1,4 @@
+#if defined(__linux__)
// vim:ts=4:sw=4:expandtab
#include <config.h>
#include <string.h>
@@ -337,3 +338,4 @@ bool pulse_initialize(void) {
}
return true;
}
+#endif