diff mbox series

snooze: new package

Message ID 20240704-snooze-v1-1-f9e845f0d813@gmx.net
State New
Headers show
Series snooze: new package | expand

Commit Message

J. Neuschäfer July 4, 2024, 7:49 p.m. UTC
Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net>
---
 package/Config.in                                  |  1 +
 .../snooze/0001-fix-snooze-n-format-string.patch   | 38 ++++++++++++++++++++++
 package/snooze/Config.in                           |  8 +++++
 package/snooze/snooze.hash                         |  3 ++
 package/snooze/snooze.mk                           | 29 +++++++++++++++++
 5 files changed, 79 insertions(+)


---
base-commit: 3ebc7c69d56430c34eba4c869d1d4fe4d1e8de55
change-id: 20240704-snooze-4f210f54eb80

Best regards,
--
J. Neuschäfer <j.neuschaefer@gmx.net>
diff mbox series

Patch

diff --git a/package/Config.in b/package/Config.in
index 48ef1a6fdc..d2dac6a559 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2334,6 +2334,7 @@  menu "Miscellaneous"
 	source "package/qpdf/Config.in"
 	source "package/rtl_433/Config.in"
 	source "package/shared-mime-info/Config.in"
+	source "package/snooze/Config.in"
 	source "package/sunwait/Config.in"
 	source "package/taskd/Config.in"
 	source "package/wine/Config.in"
diff --git a/package/snooze/0001-fix-snooze-n-format-string.patch b/package/snooze/0001-fix-snooze-n-format-string.patch
new file mode 100644
index 0000000000..3a87844ed7
--- /dev/null
+++ b/package/snooze/0001-fix-snooze-n-format-string.patch
@@ -0,0 +1,38 @@ 
+From 5f9e616b29fe272fffbb31e4b7ea8ff61f781601 Mon Sep 17 00:00:00 2001
+From: Leah Neukirchen <leah@vuxu.org>
+Date: Wed, 29 May 2024 19:42:27 +0200
+Subject: [PATCH] fix "snooze -n" format string
+
+Fixes #22.
+
+Upstream: https://github.com/leahneukirchen/snooze/commit/5f9e616b29fe272fffbb31e4b7ea8ff61f781601
+---
+ snooze.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/snooze.c b/snooze.c
+index 06f0d07..e47ad11 100644
+--- a/snooze.c
++++ b/snooze.c
+@@ -329,13 +329,13 @@ main(int argc, char *argv[])
+ 			char weekstr[4];
+ 			struct tm *tm = localtime(&t);
+ 			strftime(weekstr, sizeof weekstr, "%a", tm);
+-			printf("%s %s %2ldd%3ldh%3ldm%3lds ",
++			printf("%s %s %2dd%3dh%3dm%3ds ",
+ 			    isotime(tm),
+ 			    weekstr,
+-			    ((t - now) / (60*60*24)),
+-			    ((t - now) / (60*60)) % 24,
+-			    ((t - now) / 60) % 60,
+-			    (t - now) % 60);
++			    ((int)(t - now) / (60*60*24)),
++			    ((int)(t - now) / (60*60)) % 24,
++			    ((int)(t - now) / 60) % 60,
++			    (int)(t - now) % 60);
+ 			if(jitter) {
+ 				printf("(plus up to %ds for jitter)\n", jitter);
+ 			} else {
+--
+2.43.0
+
diff --git a/package/snooze/Config.in b/package/snooze/Config.in
new file mode 100644
index 0000000000..0e068cb607
--- /dev/null
+++ b/package/snooze/Config.in
@@ -0,0 +1,8 @@ 
+config BR2_PACKAGE_SNOOZE
+	bool "snooze"
+	help
+	  snooze is a tool for waiting until a particular time and then
+	  running a command. Together with a service supervision system
+	  such as runit, this can be used to replace cron(8).
+
+	  https://github.com/leahneukirchen/snooze
diff --git a/package/snooze/snooze.hash b/package/snooze/snooze.hash
new file mode 100644
index 0000000000..c1710d857f
--- /dev/null
+++ b/package/snooze/snooze.hash
@@ -0,0 +1,3 @@ 
+# Locally computed:
+sha256  d63fde85d9333188bed5996baabd833eaa00842ce117443ffbf8719c094be414  snooze-0.5.tar.gz
+sha256  2cea433f84afcfd9d55515908d3ea69ed1df00ffbf90cc48cd68d72a2b464544  README.md
diff --git a/package/snooze/snooze.mk b/package/snooze/snooze.mk
new file mode 100644
index 0000000000..a52b38abd8
--- /dev/null
+++ b/package/snooze/snooze.mk
@@ -0,0 +1,29 @@ 
+################################################################################
+#
+# snooze
+#
+################################################################################
+
+SNOOZE_VERSION = 0.5
+SNOOZE_SITE = $(call github,leahneukirchen,snooze,v$(SNOOZE_VERSION))
+SNOOZE_LICENSE = CC0-1.0
+
+# Unfortunately, snooze doesn't have a dedicated file for the license, but it
+# is mentioned in the README and in the manpage.
+SNOOZE_LICENSE_FILES = README.md
+
+SNOOZE_MAKE_OPTS = \
+		   PREFIX=/ \
+		   DESTDIR=$(TARGET_DIR) \
+		   CC=$(TARGET_CC) \
+		   LD=$(TARGET_LD)
+
+define SNOOZE_BUILD_CMDS
+	$(MAKE) -C $(@D)/ $(SNOOZE_MAKE_OPTS)
+endef
+
+define SNOOZE_INSTALL_TARGET_CMDS
+	$(MAKE) -C $(@D)/ $(SNOOZE_MAKE_OPTS) install
+endef
+
+$(eval $(generic-package))