pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

btop-git: sync with upstream changes.



Module Name:	pkgsrc-wip
Committed By:	Santhosh Raju <fox%NetBSD.org@localhost>
Pushed By:	fox
Date:		Wed May 6 18:08:55 2026 +0200
Changeset:	8967e41a8f488d56bbd83e70f13003451593495e

Modified Files:
	btop-git/Makefile
	btop-git/PLIST
	btop-git/distinfo
	btop-git/patches/patch-Makefile
Added Files:
	btop-git/patches/patch-src_btop.cpp

Log Message:
btop-git: sync with upstream changes.

Apply the patch from https://github.com/aristocratos/btop/pull/1647
to test if btop stops hanging on long runs.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=8967e41a8f488d56bbd83e70f13003451593495e

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 btop-git/Makefile                   | 29 +++++++++-----
 btop-git/PLIST                      | 11 +++++-
 btop-git/distinfo                   |  7 +++-
 btop-git/patches/patch-Makefile     | 12 +++---
 btop-git/patches/patch-src_btop.cpp | 75 +++++++++++++++++++++++++++++++++++++
 5 files changed, 115 insertions(+), 19 deletions(-)

diffs:
diff --git a/btop-git/Makefile b/btop-git/Makefile
index 9762984e24..fb2a90f44b 100644
--- a/btop-git/Makefile
+++ b/btop-git/Makefile
@@ -1,16 +1,22 @@
 # $NetBSD$
 
-DISTNAME=	btop-1.4.0
+DISTNAME=	btop-1.4.7
 CATEGORIES=	sysutils
 MASTER_SITES=	${MASTER_SITE_GITHUB:=aristocratos/}
-GITHUB_TAG=	v${PKGVERSION_NOREV}
+GITHUB_TAG=	6e39144aaf5a6bc01b9f795010b0914431067183
 
 MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=	https://github.com/aristocratos/btop
 COMMENT=	Colorful TTY resource monitor
 LICENSE=	apache-2.0
 
-GIT_REPO=	https://github.com/aristocratos/btop.git
+GIT_REPO=      https://github.com/aristocratos/btop.git
+
+# gcc 10 support was removed from the code base.
+# https://github.com/aristocratos/btop/pull/1106
+GCC_REQD+=	14
+
+TOOL_DEPENDS+=	lowdown-[0-9]*:../../textproc/lowdown
 
 USE_LANGUAGES=	c c++
 USE_TOOLS+=	gmake
@@ -22,16 +28,19 @@ INSTALLATION_DIRS=	${PKGMANDIR}/man1
 CXXFLAGS+=	-DNDEBUG
 MAKE_ENV+=	STRIP=true VERBOSE=true
 
+SUBST_CLASSES+=		themes
+SUBST_SED.themes+=	-e 's,/usr/local/share/btop/themes,${PREFIX}/share/btop/themes,'
+SUBST_SED.themes+=	-e 's,/usr/.local/.share/btop/themes,${PREFIX}/share/btop/themes,'
+SUBST_FILES.themes+=	src/btop_menu.cpp
+SUBST_FILES.themes+=	src/btop.cpp
+SUBST_STAGE.themes=	pre-configure
+SUBST_MESSAGE.themes=	Fixing hardcoded paths to themes.
+
 post-extract:
+	# Fix permission issues.
 	${CHMOD} -R g-w ${WRKSRC}
 
-post-build:
-	${CP} ${FILESDIR}/btop.1 ${WRKDIR}/btop.1
-
-post-install:
-	${INSTALL_MAN} ${WRKDIR}/btop.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
-
 .include "../../graphics/hicolor-icon-theme/buildlink3.mk"
-.include "../../mk/pthread.buildlink3.mk"
 .include "../../wip/mk/git-package.mk"
+.include "../../mk/pthread.buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"
diff --git a/btop-git/PLIST b/btop-git/PLIST
index 8c60c1539e..1b5bb23e1c 100644
--- a/btop-git/PLIST
+++ b/btop-git/PLIST
@@ -2,9 +2,9 @@
 bin/btop
 man/man1/btop.1
 share/applications/btop.desktop
-share/btop/README.md
 share/btop/themes/HotPurpleTrafficLight.theme
 share/btop/themes/adapta.theme
+share/btop/themes/adwaita-dark.theme
 share/btop/themes/adwaita.theme
 share/btop/themes/ayu.theme
 share/btop/themes/dracula.theme
@@ -15,18 +15,25 @@ share/btop/themes/everforest-dark-medium.theme
 share/btop/themes/everforest-light-medium.theme
 share/btop/themes/flat-remix-light.theme
 share/btop/themes/flat-remix.theme
+share/btop/themes/flexoki-dark.theme
+share/btop/themes/flexoki-light.theme
+share/btop/themes/gotham.theme
 share/btop/themes/greyscale.theme
 share/btop/themes/gruvbox_dark.theme
 share/btop/themes/gruvbox_dark_v2.theme
 share/btop/themes/gruvbox_light.theme
 share/btop/themes/gruvbox_material_dark.theme
 share/btop/themes/horizon.theme
+share/btop/themes/kanagawa-dragon.theme
+share/btop/themes/kanagawa-lotus.theme
+share/btop/themes/kanagawa-wave.theme
 share/btop/themes/kyli0x.theme
 share/btop/themes/matcha-dark-sea.theme
 share/btop/themes/monokai.theme
 share/btop/themes/night-owl.theme
 share/btop/themes/nord.theme
 share/btop/themes/onedark.theme
+share/btop/themes/orange.theme
 share/btop/themes/paper.theme
 share/btop/themes/phoenix-night.theme
 share/btop/themes/solarized_dark.theme
@@ -34,6 +41,8 @@ share/btop/themes/solarized_light.theme
 share/btop/themes/tokyo-night.theme
 share/btop/themes/tokyo-storm.theme
 share/btop/themes/tomorrow-night.theme
+share/btop/themes/twilight.theme
 share/btop/themes/whiteout.theme
+share/doc/btop/README.md
 share/icons/hicolor/48x48/apps/btop.png
 share/icons/hicolor/scalable/apps/btop.svg
diff --git a/btop-git/distinfo b/btop-git/distinfo
index 644da735df..e2c26259bf 100644
--- a/btop-git/distinfo
+++ b/btop-git/distinfo
@@ -1,4 +1,7 @@
 $NetBSD$
 
-SHA1 (patch-Makefile) = 87cd9333e786899109df3a931c6d0e99fbd017de
-SHA1 (patch-src_netbsd_btop__collect.cpp) = fc456e15c11a5e50b8a2ae3ca569d1b27f2141cc
+BLAKE2s (btop-1.4.7-6e39144aaf5a6bc01b9f795010b0914431067183.tar.gz) = 7a1d8fea484e969ddde9eed5ff090259683e5a674180b82b98b17574aa7c7652
+SHA512 (btop-1.4.7-6e39144aaf5a6bc01b9f795010b0914431067183.tar.gz) = b90d96cc53bde84637535584af13109f6998d2f5a0be4143829814ff30ad4da71173822a5aa4c96a790a86a7950258197504350c17567ed8a330eca3c24bc1bc
+Size (btop-1.4.7-6e39144aaf5a6bc01b9f795010b0914431067183.tar.gz) = 1280353 bytes
+SHA1 (patch-Makefile) = 7cec0d616dd445ad139f0868141d15d1687bf402
+SHA1 (patch-src_btop.cpp) = 46edbcad224ba31643bf14b5942bb195e3ecdfeb
diff --git a/btop-git/patches/patch-Makefile b/btop-git/patches/patch-Makefile
index ac54488655..b54c274b87 100644
--- a/btop-git/patches/patch-Makefile
+++ b/btop-git/patches/patch-Makefile
@@ -1,23 +1,23 @@
-$NetBSD: patch-Makefile,v 1.1 2024/10/06 10:43:17 fox Exp $
+$NetBSD: patch-Makefile,v 1.3 2025/12/28 02:25:17 fox Exp $
 
 Fix the man page path.
 
---- Makefile.orig	2024-10-06 10:22:47.718265628 +0000
+--- Makefile.orig	2025-12-26 15:53:24.000000000 +0000
 +++ Makefile
-@@ -343,9 +343,9 @@ install:
+@@ -317,9 +317,9 @@ install:
  	@mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps
  	@cp -p Img/icon.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/btop.svg
  ifneq ($(wildcard btop.1),)
--	@printf "\033[1;92mInstalling man page to: \033[1;97m$(DESTDIR)$(PREFIX)/share/man/man1/btop.1\n"
+-	@printf "\033[1;92mInstalling man page to: \033[1;97m$(DESTDIR)$(PREFIX)/share/man/man1/btop.1\033[0m\n"
 -	@mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
 -	@cp -p btop.1 $(DESTDIR)$(PREFIX)/share/man/man1/btop.1
-+	@printf "\033[1;92mInstalling man page to: \033[1;97m$(DESTDIR)$(PREFIX)/$(PKGMANDIR)/man1/btop.1\n"
++	@printf "\033[1;92mInstalling man page to: \033[1;97m$(DESTDIR)$(PREFIX)/$(PKGMANDIR)/man1/btop.1\033[0m\n"
 +	@mkdir -p $(DESTDIR)$(PREFIX)/$(PKGMANDIR)/man1
 +	@cp -p btop.1 $(DESTDIR)$(PREFIX)/$(PKGMANDIR)/man1/btop.1
  endif
  
  #? Set SUID bit for btop as $SU_USER in $SU_GROUP
-@@ -374,8 +374,8 @@ uninstall:
+@@ -348,8 +348,8 @@ uninstall:
  	@rm -rfv $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/btop.png
  	@printf "\033[1;91mRemoving: \033[1;97m$(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/btop.svg\033[0m\n"
  	@rm -rfv $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/btop.svg
diff --git a/btop-git/patches/patch-src_btop.cpp b/btop-git/patches/patch-src_btop.cpp
new file mode 100644
index 0000000000..2057b6688a
--- /dev/null
+++ b/btop-git/patches/patch-src_btop.cpp
@@ -0,0 +1,75 @@
+$NetBSD$
+
+Attempt to fix UI hangs when running for long periods
+
+https://github.com/aristocratos/btop/pull/1647
+
+--- src/btop.cpp.orig	2026-05-06 15:50:33.000000000 +0000
++++ src/btop.cpp
+@@ -127,6 +127,7 @@ namespace Global {
+ 
+ namespace Runner {
+ 	static pthread_t runner_id;
++	void safe_thread_trigger();
+ } // namespace Runner
+ 
+ //* Handler for SIGWINCH and general resizing events, does nothing if terminal hasn't been resized unless force=true
+@@ -215,6 +216,12 @@ void clean_quit(int sig) {
+ 	Runner::stop();
+ 	if (Global::_runner_started) {
+ 	#if defined __APPLE__ || defined __OpenBSD__ || defined __NetBSD__
++		// binary_semaphore::acquire() is not a POSIX cancellation point on macOS;
++		// pthread_join() would hang if the thread is parked in thread_wait(). Post
++		// a token so it wakes, sees Global::quitting==true, and exits the loop.
++		// safe_thread_trigger() drains any pre-existing token to avoid undefined behavior on the
++		// max-1 semaphore.
++		Runner::safe_thread_trigger();
+ 		if (pthread_join(Runner::runner_id, nullptr) != 0) {
+ 			Logger::warning("Failed to join _runner thread on exit!");
+ 			pthread_cancel(Runner::runner_id);
+@@ -374,6 +381,9 @@ namespace Runner {
+ 	std::binary_semaphore do_work { 0 };
+ 	inline void thread_wait() { do_work.acquire(); }
+ 	inline void thread_trigger() { do_work.release(); }
++	// Guarantees exactly one token is posted: drains any pre-existing token
++	// before release() to avoid undefined behavior on the max-1 binary_semaphore.
++	inline void safe_thread_trigger() { do_work.try_acquire(); do_work.release(); }
+ 
+ 	//* Wrapper for raising privileges when using SUID bit
+ 	class gain_priv {
+@@ -742,7 +752,13 @@ namespace Runner {
+ 			Logger::error("Stall in Runner thread, restarting!");
+ 			set_active(false);
+ 			// exit(1);
++			// pthread_cancel() marks cancellation pending before thread_trigger() wakes
++			// the thread. binary_semaphore::acquire() is not a POSIX cancellation point
++			// on macOS; sleep_ms(1) is. With cancellation already pending when the
++			// thread reaches sleep_ms(), delivery is guaranteed regardless of scheduling.
++			stopping = true;
+ 			pthread_cancel(Runner::runner_id);
++			thread_trigger();
+ 
+ 			// Wait for the thread to actually terminate before creating a new one
+ 			void* thread_result;
+@@ -750,6 +766,21 @@ namespace Runner {
+ 			if (join_result != 0) {
+ 				Logger::warning("Failed to join cancelled thread: {}", strerror(join_result));
+ 			}
++			// pthread_cancel does not reliably invoke C++ destructors on macOS,
++			// so the cancelled thread's lock_guard on mtx may not have fired.
++			// The thread is gone (joined above); unlock the orphaned mutex so
++			// the replacement thread can acquire it. Technically undefined
++			// behavior per [thread.mutex.requirements.mutex] (calling unlock
++			// from a non-owning thread), but the mutex would otherwise remain
++			// permanently locked.
++			if (join_result == 0) {
++				mtx.unlock();
++			}
++			// A thread cancelled mid-work never calls do_work.acquire(), leaving the
++			// counter at 1. Drain it so the new thread blocks on its first thread_wait()
++			// rather than racing on current_conf.
++			do_work.try_acquire();
++			stopping = false;
+ 
+ 			if (pthread_create(&Runner::runner_id, nullptr, &Runner::_runner, nullptr) != 0) {
+ 				Global::exit_error_msg = "Failed to re-create _runner thread!";


Home | Main Index | Thread Index | Old Index