diff mbox series

[1/1] package/casync-nano: new package

Message ID 20250420204540.32264-1-fl@n621.de
State New
Headers show
Series [1/1] package/casync-nano: new package | expand

Commit Message

Florian Larysch April 20, 2025, 8:45 p.m. UTC
casync-nano is an implementation of a subset of the features of casync,
optimized for performing OTA updates on embedded systems.

Signed-off-by: Florian Larysch <fl@n621.de>
---
 DEVELOPERS                           |  3 +++
 package/Config.in                    |  1 +
 package/Config.in.host               |  1 +
 package/casync-nano/Config.in        | 21 +++++++++++++++++++++
 package/casync-nano/Config.in.host   |  7 +++++++
 package/casync-nano/casync-nano.hash |  3 +++
 package/casync-nano/casync-nano.mk   | 28 ++++++++++++++++++++++++++++
 7 files changed, 64 insertions(+)
 create mode 100644 package/casync-nano/Config.in
 create mode 100644 package/casync-nano/Config.in.host
 create mode 100644 package/casync-nano/casync-nano.hash
 create mode 100644 package/casync-nano/casync-nano.mk

Comments

Thomas Petazzoni April 20, 2025, 9:13 p.m. UTC | #1
Hello Florian,

On Sun, 20 Apr 2025 22:45:38 +0200
Florian Larysch <fl@n621.de> wrote:

> casync-nano is an implementation of a subset of the features of casync,
> optimized for performing OTA updates on embedded systems.
> 
> Signed-off-by: Florian Larysch <fl@n621.de>

Thanks for this contribution, this looks really good. I only have a few
questions, below.


> +config BR2_PACKAGE_CASYNC_NANO_CASYNC_SHIM
> +	bool "install casync shim"
> +	# only once package should provide the "casync" command
> +	depends on !BR2_PACKAGE_CASYNC
> +	help
> +	  Install a shim that provides basic compatibility with the
> +	  "extract" sub-command of casync to programs that expect it.

I am wondering if we really need this option. What about simply
installing this shim automatically if BR2_PACKAGE_CASYNC is disabled?


> +CASYNC_NANO_VERSION = 1.1.1
> +CASYNC_NANO_SITE = $(call github,florolf,casync-nano,v$(CASYNC_NANO_VERSION))
> +CASYNC_NANO_LICENSE = LGPL-2.1
> +CASYNC_NANO_LICENSE_FILES = COPYING
> +CASYNC_NANO_DEPENDENCIES = host-pkgconf openssl zstd libcurl
> +
> +ifeq ($(BR2_PACKAGE_CASYNC_NANO_CASYNC_SHIM),y)
> +define CASYNC_NANO_INSTALL_CASYNC_SHIM
> +	ln -sf csn $(TARGET_DIR)/usr/bin/casync
> +endef
> +endif
> +
> +define CASYNC_NANO_INSTALL_TARGET_CMDS
> +	$(INSTALL) -D -m0755 $(@D)/csn $(TARGET_DIR)/usr/bin/csn
> +	$(CASYNC_NANO_INSTALL_CASYNC_SHIM)
> +endef
> +
> +HOST_CASYNC_NANO_DEPENDENCIES = host-pkgconf host-openssl
> +HOST_CASYNC_NANO_CONF_OPTS = -DBUILD_CSN=Off -DBUILD_CSN_TOOL=On

Why aren't those same options set for the target variant? I'm not quite
sure to understand why the host and target variant don't have the same
dependencies. If zstd and libcurl are optional, then they should also
be optional for the target variant.

Could you clarify this point?

Thanks a lot!

Thomas
Florian Larysch April 20, 2025, 9:32 p.m. UTC | #2
Hello Thomas,

On Sun, Apr 20, 2025 at 11:13:07PM +0200, Thomas Petazzoni via buildroot wrote:
> > +config BR2_PACKAGE_CASYNC_NANO_CASYNC_SHIM
> I am wondering if we really need this option. What about simply
> installing this shim automatically if BR2_PACKAGE_CASYNC is disabled?

That would be an option too. Personally I'd err on the side of not
cluttering /usr/bin unnecessarily, but if you think that makes more
sense I can change it.
 
> 
> > +CASYNC_NANO_VERSION = 1.1.1
> > +CASYNC_NANO_SITE = $(call github,florolf,casync-nano,v$(CASYNC_NANO_VERSION))
> > +CASYNC_NANO_LICENSE = LGPL-2.1
> > +CASYNC_NANO_LICENSE_FILES = COPYING
> > +CASYNC_NANO_DEPENDENCIES = host-pkgconf openssl zstd libcurl
> > +
> > +ifeq ($(BR2_PACKAGE_CASYNC_NANO_CASYNC_SHIM),y)
> > +define CASYNC_NANO_INSTALL_CASYNC_SHIM
> > +	ln -sf csn $(TARGET_DIR)/usr/bin/casync
> > +endef
> > +endif
> > +
> > +define CASYNC_NANO_INSTALL_TARGET_CMDS
> > +	$(INSTALL) -D -m0755 $(@D)/csn $(TARGET_DIR)/usr/bin/csn
> > +	$(CASYNC_NANO_INSTALL_CASYNC_SHIM)
> > +endef
> > +
> > +HOST_CASYNC_NANO_DEPENDENCIES = host-pkgconf host-openssl
> > +HOST_CASYNC_NANO_CONF_OPTS = -DBUILD_CSN=Off -DBUILD_CSN_TOOL=On
> 
> Why aren't those same options set for the target variant? I'm not quite
> sure to understand why the host and target variant don't have the same
> dependencies. If zstd and libcurl are optional, then they should also
> be optional for the target variant.

The host variant of the package is only building a different sub-program
(csn-tool), which has different dependencies (namely it only needs
libcrypto from OpenSSL).

The reasoning for the split here is similar to other OTA tools like RAUC
where there is one component that is only really useful on the target
for installing the update and another component that is only useful on
the host for generating/manipulating that update.

Florian
Thomas Petazzoni April 20, 2025, 9:48 p.m. UTC | #3
Hello Florian,

On Sun, 20 Apr 2025 23:32:05 +0200
Florian Larysch <fl@n621.de> wrote:

> On Sun, Apr 20, 2025 at 11:13:07PM +0200, Thomas Petazzoni via buildroot wrote:
> > > +config BR2_PACKAGE_CASYNC_NANO_CASYNC_SHIM  
> > I am wondering if we really need this option. What about simply
> > installing this shim automatically if BR2_PACKAGE_CASYNC is disabled?  
> 
> That would be an option too. Personally I'd err on the side of not
> cluttering /usr/bin unnecessarily, but if you think that makes more
> sense I can change it.

OK, fair enough!

> > Why aren't those same options set for the target variant? I'm not quite
> > sure to understand why the host and target variant don't have the same
> > dependencies. If zstd and libcurl are optional, then they should also
> > be optional for the target variant.  
> 
> The host variant of the package is only building a different sub-program
> (csn-tool), which has different dependencies (namely it only needs
> libcrypto from OpenSSL).
> 
> The reasoning for the split here is similar to other OTA tools like RAUC
> where there is one component that is only really useful on the target
> for installing the update and another component that is only useful on
> the host for generating/manipulating that update.

Makes sense, thanks for the explanation!

Thomas
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 3a921c8a74..6f30b6b938 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1130,6 +1130,9 @@  F:	package/rsyslog/
 N:	Florian Fainelli <f.fainelli@gmail.com>
 F:	package/cpulimit/
 
+N:	Florian Larysch <fl@n621.de>
+F:	package/casync-nano/
+
 N:	Floris Bos <bos@je-eigen-domein.nl>
 F:	package/ipmitool/
 F:	package/odhcploc/
diff --git a/package/Config.in b/package/Config.in
index c29109aa7e..cfff6a77eb 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2456,6 +2456,7 @@  endif
 	source "package/can-utils/Config.in"
 	source "package/cannelloni/Config.in"
 	source "package/casync/Config.in"
+	source "package/casync-nano/Config.in"
 	source "package/cfm/Config.in"
 	source "package/chrony/Config.in"
 	source "package/civetweb/Config.in"
diff --git a/package/Config.in.host b/package/Config.in.host
index bf04f5fa97..b0f7529a13 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -13,6 +13,7 @@  menu "Host utilities"
 	source "package/bmap-writer/Config.in.host"
 	source "package/bootgen/Config.in.host"
 	source "package/btrfs-progs/Config.in.host"
+	source "package/casync-nano/Config.in.host"
 	source "package/cbootimage/Config.in.host"
 	source "package/checkpolicy/Config.in.host"
 	source "package/checksec/Config.in.host"
diff --git a/package/casync-nano/Config.in b/package/casync-nano/Config.in
new file mode 100644
index 0000000000..ec7eeafaaa
--- /dev/null
+++ b/package/casync-nano/Config.in
@@ -0,0 +1,21 @@ 
+config BR2_PACKAGE_CASYNC_NANO
+	bool "casync-nano"
+	select BR2_PACKAGE_OPENSSL
+	select BR2_PACKAGE_ZSTD
+	select BR2_PACKAGE_LIBCURL
+	help
+	  Tiny casync-like tool optimized for embedded systems.
+
+	  https://github.com/florolf/casync-nano
+
+if BR2_PACKAGE_CASYNC_NANO
+
+config BR2_PACKAGE_CASYNC_NANO_CASYNC_SHIM
+	bool "install casync shim"
+	# only once package should provide the "casync" command
+	depends on !BR2_PACKAGE_CASYNC
+	help
+	  Install a shim that provides basic compatibility with the
+	  "extract" sub-command of casync to programs that expect it.
+
+endif
diff --git a/package/casync-nano/Config.in.host b/package/casync-nano/Config.in.host
new file mode 100644
index 0000000000..2fc3340017
--- /dev/null
+++ b/package/casync-nano/Config.in.host
@@ -0,0 +1,7 @@ 
+config BR2_PACKAGE_HOST_CASYNC_NANO
+	bool "host casync-nano tool"
+	help
+	  casync-nano host tool (csn-tool) for casync-nano specific
+	  features like chunk encryption.
+
+	  https://github.com/florolf/casync-nano
diff --git a/package/casync-nano/casync-nano.hash b/package/casync-nano/casync-nano.hash
new file mode 100644
index 0000000000..1697fa93ef
--- /dev/null
+++ b/package/casync-nano/casync-nano.hash
@@ -0,0 +1,3 @@ 
+# locally calculated
+sha256  29ed8a767304e7e3032e66feea3d2dada7cc7db73344231a54bf080cc6e65ecf  casync-nano-1.1.1.tar.gz
+sha256  dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551  COPYING
diff --git a/package/casync-nano/casync-nano.mk b/package/casync-nano/casync-nano.mk
new file mode 100644
index 0000000000..a15377a6b4
--- /dev/null
+++ b/package/casync-nano/casync-nano.mk
@@ -0,0 +1,28 @@ 
+################################################################################
+#
+# casync-nano
+#
+################################################################################
+
+CASYNC_NANO_VERSION = 1.1.1
+CASYNC_NANO_SITE = $(call github,florolf,casync-nano,v$(CASYNC_NANO_VERSION))
+CASYNC_NANO_LICENSE = LGPL-2.1
+CASYNC_NANO_LICENSE_FILES = COPYING
+CASYNC_NANO_DEPENDENCIES = host-pkgconf openssl zstd libcurl
+
+ifeq ($(BR2_PACKAGE_CASYNC_NANO_CASYNC_SHIM),y)
+define CASYNC_NANO_INSTALL_CASYNC_SHIM
+	ln -sf csn $(TARGET_DIR)/usr/bin/casync
+endef
+endif
+
+define CASYNC_NANO_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m0755 $(@D)/csn $(TARGET_DIR)/usr/bin/csn
+	$(CASYNC_NANO_INSTALL_CASYNC_SHIM)
+endef
+
+HOST_CASYNC_NANO_DEPENDENCIES = host-pkgconf host-openssl
+HOST_CASYNC_NANO_CONF_OPTS = -DBUILD_CSN=Off -DBUILD_CSN_TOOL=On
+
+$(eval $(cmake-package))
+$(eval $(host-cmake-package))