[v2,7/9] package/netopeer2-keystored: add package
diff mbox series

Message ID 20191009112656.21232-8-heiko.thiery@gmail.com
State Superseded
Headers show
Series
  • Add netopeer2 package (and dependencies)
Related show

Commit Message

Heiko Thiery Oct. 9, 2019, 11:26 a.m. UTC
From: Heiko Thiery <heiko.thiery@kontron.com>

netopeer2 keystored plugin.

Signed-off-by: Heiko Thiery <heiko.thiery@kontron.com>
---
 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 package/netopeer2-keystored/Config.in         | 15 ++++++++++
 .../netopeer2-keystored.hash                  |  2 ++
 .../netopeer2-keystored.mk                    | 29 +++++++++++++++++++
 5 files changed, 48 insertions(+)
 create mode 100644 package/netopeer2-keystored/Config.in
 create mode 100644 package/netopeer2-keystored/netopeer2-keystored.hash
 create mode 100644 package/netopeer2-keystored/netopeer2-keystored.mk

Comments

Thomas Petazzoni Oct. 9, 2019, 12:12 p.m. UTC | #1
Hello Heiko,

Sorry I didn't had the chance to review the remainder of your first
iteration, but there was one main issue about the netopeer2 package.
See below.

On Wed,  9 Oct 2019 13:26:54 +0200
heiko.thiery@gmail.com wrote:

> +	select BR2_PACKAGE_SYSREPO
> +	select BR2_PACKAGE_SYSREPO

Duplicate select.

Also, sysrepo has plenty of "depends on". They *all* need to be
replicated in the netopeer2 package.

> diff --git a/package/netopeer2-keystored/netopeer2-keystored.mk b/package/netopeer2-keystored/netopeer2-keystored.mk
> new file mode 100644
> index 0000000000..8160c53867
> --- /dev/null
> +++ b/package/netopeer2-keystored/netopeer2-keystored.mk
> @@ -0,0 +1,29 @@
> +################################################################################
> +#
> +# netopeer2-keystored
> +#
> +################################################################################
> +
> +NETOPEER2_KEYSTORED_VERSION = v0.7-r2
> +NETOPEER2_KEYSTORED_SITE = $(call github,CESNET,Netopeer2,$(NETOPEER2_KEYSTORED_VERSION))

This is the exact same source code you are fetching in
netopeer2-keystored, netopeer2-server and netopeer2-cli. We do not want
3 separate Buildroot packages, but only one. Of course, it can have
sub-options in the Config.in file so that the user can selectively
enable keystored, cli and/or server.

But generally speaking in Buildroot, the rule is one upstream project
== one package. We do have a few exceptions to this rule for various
reasons, but unless there's a good and strong justification, we like to
keep this one upstream project == one package rule in place.

> +NETOPEER2_KEYSTORED_LICENSE = BSD-3-Clause
> +NETOPEER2_KEYSTORED_LICENSE_FILES = LICENSE
> +NETOPEER2_KEYSTORED_SUBDIR = keystored
> +NETOPEER2_KEYSTORED_DEPENDENCIES += host-sysrepo sysrepo

Just = for unconditional assignments.

> +
> +NETOPEER2_KEYSTORED_CONF_OPTS += \

Ditto.

> +	-DKEYSTORED_DEFER_SSH_KEY=ON \
> +	-DSSH_KEY_INSTALL=ON \
> +	-DMODEL_INSTALL=ON \
> +	-DSYSREPOCTL_EXECUTABLE=$(HOST_DIR)/bin/sysrepoctl \
> +	-DSYSREPOCFG_EXECUTABLE=$(HOST_DIR)/bin/sysrepocfg
> +
> +define NETOPEER2_KEYSTORED_PERMISSIONS
> +	/etc/sysrepo/data/ietf-keystore.persist f 600 0 0 - - - - -
> +	/etc/sysrepo/data/ietf-keystore.running f 600 0 0 - - - - -
> +	/etc/sysrepo/data/ietf-keystore.running.lock f 600 0 0 - - - - -
> +	/etc/sysrepo/data/ietf-keystore.startup f 600 0 0 - - - - -
> +	/etc/sysrepo/data/ietf-keystore.startup.lock f 600 0 0 - - - - -
> +endef
> +
> +$(eval $(cmake-package))

Thanks!

Thomas
Heiko Thiery Oct. 9, 2019, 1:14 p.m. UTC | #2
> > +################################################################################
> > +#
> > +# netopeer2-keystored
> > +#
> > +################################################################################
> > +
> > +NETOPEER2_KEYSTORED_VERSION = v0.7-r2
> > +NETOPEER2_KEYSTORED_SITE = $(call github,CESNET,Netopeer2,$(NETOPEER2_KEYSTORED_VERSION))
>
> This is the exact same source code you are fetching in
> netopeer2-keystored, netopeer2-server and netopeer2-cli. We do not want
> 3 separate Buildroot packages, but only one. Of course, it can have
> sub-options in the Config.in file so that the user can selectively
> enable keystored, cli and/or server.
>
> But generally speaking in Buildroot, the rule is one upstream project
> == one package. We do have a few exceptions to this rule for various
> reasons, but unless there's a good and strong justification, we like to
> keep this one upstream project == one package rule in place.
>
> > +NETOPEER2_KEYSTORED_LICENSE = BSD-3-Clause
> > +NETOPEER2_KEYSTORED_LICENSE_FILES = LICENSE
> > +NETOPEER2_KEYSTORED_SUBDIR = keystored
> > +NETOPEER2_KEYSTORED_DEPENDENCIES += host-sysrepo sysrepo

So I have to move all the stuff from the 3 packages (netopeer2-server,
netopeer2-cli, netopeer2-keystored) into one package e.g. netopeer2.
Is it possible to have there 3 different build targets depending on
the configuration?
Thomas Petazzoni Oct. 9, 2019, 1:34 p.m. UTC | #3
On Wed, 9 Oct 2019 15:14:15 +0200
Heiko Thiery <heiko.thiery@gmail.com> wrote:

> > > +NETOPEER2_KEYSTORED_LICENSE = BSD-3-Clause
> > > +NETOPEER2_KEYSTORED_LICENSE_FILES = LICENSE
> > > +NETOPEER2_KEYSTORED_SUBDIR = keystored
> > > +NETOPEER2_KEYSTORED_DEPENDENCIES += host-sysrepo sysrepo  
> 
> So I have to move all the stuff from the 3 packages (netopeer2-server,
> netopeer2-cli, netopeer2-keystored) into one package e.g. netopeer2.

Yes.

> Is it possible to have there 3 different build targets depending on
> the configuration?

It depends on what you call build targets. Looking at the netooper2
code base, it's indeed 3 separate projects together, each with its own
CMake build system. I.e, there is no top-level CMakeLists.txt to build
the different components.

So we would have to do the CMake configuration/build/install steps
manually, as the cmake-package infrastructure only deals with a single
top-level CMake build infrastructure, which netopeer2 doesn't have.

In the light of this in the end, perhaps it makes sense to have three
packages like you did. It kind of reflects the fact that even though
they are stored in the same Git repo, they are three independent
components each with its own build system.

Peter, Arnout, Yann, any thoughts ? See
https://github.com/CESNET/Netopeer2 for the code base.

Thomas
Peter Korsgaard Oct. 9, 2019, 1:43 p.m. UTC | #4
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

Hi,
 > In the light of this in the end, perhaps it makes sense to have three
 > packages like you did. It kind of reflects the fact that even though
 > they are stored in the same Git repo, they are three independent
 > components each with its own build system.

 > Peter, Arnout, Yann, any thoughts ? See
 > https://github.com/CESNET/Netopeer2 for the code base.

Yes, that indeed seems the best solution to me as well.
Yann E. MORIN Oct. 9, 2019, 3:53 p.m. UTC | #5
Thomas, Heiko, All,

On 2019-10-09 15:34 +0200, Thomas Petazzoni spake thusly:
> On Wed, 9 Oct 2019 15:14:15 +0200
> Heiko Thiery <heiko.thiery@gmail.com> wrote:
> 
> > > > +NETOPEER2_KEYSTORED_LICENSE = BSD-3-Clause
> > > > +NETOPEER2_KEYSTORED_LICENSE_FILES = LICENSE
> > > > +NETOPEER2_KEYSTORED_SUBDIR = keystored
> > > > +NETOPEER2_KEYSTORED_DEPENDENCIES += host-sysrepo sysrepo  
> > 
> > So I have to move all the stuff from the 3 packages (netopeer2-server,
> > netopeer2-cli, netopeer2-keystored) into one package e.g. netopeer2.
> 
> Yes.
> 
> > Is it possible to have there 3 different build targets depending on
> > the configuration?
> 
> It depends on what you call build targets. Looking at the netooper2
> code base, it's indeed 3 separate projects together, each with its own
> CMake build system. I.e, there is no top-level CMakeLists.txt to build
> the different components.

... yet they share the same set of top-level cmake modules... :-/

Which is not clean, because those CMakeModules should be provided by the
libs themselves (e.g. libyang should provide FindLibYANG.cmake)...

> So we would have to do the CMake configuration/build/install steps
> manually, as the cmake-package infrastructure only deals with a single
> top-level CMake build infrastructure, which netopeer2 doesn't have.
> 
> In the light of this in the end, perhaps it makes sense to have three
> packages like you did. It kind of reflects the fact that even though
> they are stored in the same Git repo, they are three independent
> components each with its own build system.

Yes.

And since they do share the same source tree, we really want to download
it only once:

    NETOPEER2_KEYSTORED_DL_SUBDIR = netopeer2

(similarly for the other two packages, of course).

Regards,
Yann E. MORIN.
Heiko Thiery Oct. 9, 2019, 5:03 p.m. UTC | #6
Hi Yann,

> > So we would have to do the CMake configuration/build/install steps
> > manually, as the cmake-package infrastructure only deals with a single
> > top-level CMake build infrastructure, which netopeer2 doesn't have.
> >
> > In the light of this in the end, perhaps it makes sense to have three
> > packages like you did. It kind of reflects the fact that even though
> > they are stored in the same Git repo, they are three independent
> > components each with its own build system.
>
> Yes.
>
> And since they do share the same source tree, we really want to download
> it only once:
>
>     NETOPEER2_KEYSTORED_DL_SUBDIR = netopeer2
>
> (similarly for the other two packages, of course).

does this mean we still have 3 packages but 2 of them use the download
of e.g. netopeer2-server as the "master" package?
Heiko Thiery Oct. 9, 2019, 5:08 p.m. UTC | #7
> Hi Yann,
>
> > > So we would have to do the CMake configuration/build/install steps
> > > manually, as the cmake-package infrastructure only deals with a single
> > > top-level CMake build infrastructure, which netopeer2 doesn't have.
> > >
> > > In the light of this in the end, perhaps it makes sense to have three
> > > packages like you did. It kind of reflects the fact that even though
> > > they are stored in the same Git repo, they are three independent
> > > components each with its own build system.
> >
> > Yes.
> >
> > And since they do share the same source tree, we really want to download
> > it only once:
> >
> >     NETOPEER2_KEYSTORED_DL_SUBDIR = netopeer2
> >
> > (similarly for the other two packages, of course).
>
> does this mean we still have 3 packages but 2 of them use the download
> of e.g. netopeer2-server as the "master" package?

should I add the 2 other packages into a subfolder under
netopeer2-server like it is done for the fftw package and the
corresponding subpackages?
Yann E. MORIN Oct. 9, 2019, 6:15 p.m. UTC | #8
On 2019-10-09 19:08 +0200, Heiko Thiery spake thusly:
> > Hi Yann,
> >
> > > > So we would have to do the CMake configuration/build/install steps
> > > > manually, as the cmake-package infrastructure only deals with a single
> > > > top-level CMake build infrastructure, which netopeer2 doesn't have.
> > > >
> > > > In the light of this in the end, perhaps it makes sense to have three
> > > > packages like you did. It kind of reflects the fact that even though
> > > > they are stored in the same Git repo, they are three independent
> > > > components each with its own build system.
> > >
> > > Yes.
> > >
> > > And since they do share the same source tree, we really want to download
> > > it only once:
> > >
> > >     NETOPEER2_KEYSTORED_DL_SUBDIR = netopeer2
> > >
> > > (similarly for the other two packages, of course).
> >
> > does this mean we still have 3 packages but 2 of them use the download
> > of e.g. netopeer2-server as the "master" package?
> 
> should I add the 2 other packages into a subfolder under
> netopeer2-server like it is done for the fftw package and the
> corresponding subpackages?

You should keep doing three packages, like you initially submitted:

    package/netopeer2-keystored/Config.in
    package/netopeer2-keystored/netopeer2-keystored.mk
    package/netopeer2-keystored/netopeer2-keystored.hash
    package/netopeer2-server/Config.in
    package/netopeer2-server/netopeer2-server.mk
    package/netopeer2-server/netopeer2-server.hash
    package/netopeer2-cli/Config.in
    package/netopeer2-cli/netopeer2-cli.hash
    package/netopeer2-cli/netopeer2-cli.mk

Then, you should add in the corresponding files:

    NETOPEER2_KEYSTORED_DL_SUBDIR = netopeer2
    NETOPEER2_SERVER_DL_SUBDIR = netopeer2
    NETOPEER2_CLI_DL_SUBDIR = netopeer2

That all three of them have the same _DL_SUBDIR means that the archive
will be downloaded only once, and be used for all three packages (but
this _DL_SUBDIR variable is indeed not documented in our manual).

See for example: mesa3d and mesa3d-headers, or bluez5_utils and
bluez5_utils-headers, for an example of using _DL_SUBDIR.

Regards,
Yann E. MORIN.
Arnout Vandecappelle Oct. 9, 2019, 7:14 p.m. UTC | #9
On 09/10/2019 20:15, Yann E. MORIN wrote:
[snip]
> You should keep doing three packages, like you initially submitted:
> 
>     package/netopeer2-keystored/Config.in
>     package/netopeer2-keystored/netopeer2-keystored.mk
>     package/netopeer2-keystored/netopeer2-keystored.hash
>     package/netopeer2-server/Config.in
>     package/netopeer2-server/netopeer2-server.mk
>     package/netopeer2-server/netopeer2-server.hash
>     package/netopeer2-cli/Config.in
>     package/netopeer2-cli/netopeer2-cli.hash
>     package/netopeer2-cli/netopeer2-cli.mk

 Note that two of the three hash files can be symlinks to the third one, so only
one hash file needs to be updated on a version bump.

 Since the server depends on keystored, I think it makes most sense to have
keystored as the "master" hash file. But it doesn't matter that much.


> 
> Then, you should add in the corresponding files:
> 
>     NETOPEER2_KEYSTORED_DL_SUBDIR = netopeer2
>     NETOPEER2_SERVER_DL_SUBDIR = netopeer2
>     NETOPEER2_CLI_DL_SUBDIR = netopeer2
> 
> That all three of them have the same _DL_SUBDIR means that the archive
> will be downloaded only once, and be used for all three packages (but
> this _DL_SUBDIR variable is indeed not documented in our manual).

 Call for contribution :-)

 Regards,
 Arnout

> 
> See for example: mesa3d and mesa3d-headers, or bluez5_utils and
> bluez5_utils-headers, for an example of using _DL_SUBDIR.
> 
> Regards,
> Yann E. MORIN.
>
Heiko Thiery Oct. 9, 2019, 7:45 p.m. UTC | #10
Hi Yann,

> You should keep doing three packages, like you initially submitted:
>b
>     package/netopeer2-keystored/Config.in
>     package/netopeer2-keystored/netopeer2-keystored.mk
>     package/netopeer2-keystored/netopeer2-keystored.hash
>     package/netopeer2-server/Config.in
>     package/netopeer2-server/netopeer2-server.mk
>     package/netopeer2-server/netopeer2-server.hash
>     package/netopeer2-cli/Config.in
>     package/netopeer2-cli/netopeer2-cli.hash
>     package/netopeer2-cli/netopeer2-cli.mk
>
> Then, you should add in the corresponding files:
>
>     NETOPEER2_KEYSTORED_DL_SUBDIR = netopeer2
>     NETOPEER2_SERVER_DL_SUBDIR = netopeer2
>     NETOPEER2_CLI_DL_SUBDIR = netopeer2
>
> That all three of them have the same _DL_SUBDIR means that the archive
> will be downloaded only once, and be used for all three packages (but
> this _DL_SUBDIR variable is indeed not documented in our manual).

I also have to set the <PKg>_SOURCE to the same file for all 3 packages.
Is it then still necessary to set also the <PKG>_DL_SUBDIR?
Heiko Thiery Oct. 9, 2019, 7:57 p.m. UTC | #11
> I also have to set the <PKg>_SOURCE to the same file for all 3 packages.
> Is it then still necessary to set also the <PKG>_DL_SUBDIR?

Just can give me self the answer .. YES it is needed ;-)

Patch
diff mbox series

diff --git a/DEVELOPERS b/DEVELOPERS
index 143b277dc4..2eb3ae905b 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1041,6 +1041,7 @@  F:	package/python-sip/
 N:	Heiko Thiery <heiko.thiery@gmail.com>
 F:	package/libnetconf2/
 F:	package/libyang/
+F:	package/netopeer2-keystored/
 F:	package/sysrepo/
 
 N:	Henrique Camargo <henrique@henriquecamargo.com>
diff --git a/package/Config.in b/package/Config.in
index 80bc83e8cd..fbe5ab2306 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1647,6 +1647,7 @@  menu "Networking"
 	source "package/mongoose/Config.in"
 	source "package/nanomsg/Config.in"
 	source "package/neon/Config.in"
+	source "package/netopeer2-keystored/Config.in"
 	source "package/nghttp2/Config.in"
 	source "package/norm/Config.in"
 	source "package/nss-mdns/Config.in"
diff --git a/package/netopeer2-keystored/Config.in b/package/netopeer2-keystored/Config.in
new file mode 100644
index 0000000000..e25f0d70ce
--- /dev/null
+++ b/package/netopeer2-keystored/Config.in
@@ -0,0 +1,15 @@ 
+config BR2_PACKAGE_NETOPEER2_KEYSTORED
+	bool "netopeer2-keystore daemon"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_STATIC_LIBS
+	select BR2_PACKAGE_LIBYANG
+	select BR2_PACKAGE_SYSREPO
+	select BR2_PACKAGE_SYSREPO
+	help
+	  Netopeer2 is a set of tools implementing network
+	  configuration tools based on the NETCONF Protocol.
+
+	  https://github.com/CESNET/Netopeer2
+
+comment "needs a toolchain w/ threads, dynamic libraray"
+	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/netopeer2-keystored/netopeer2-keystored.hash b/package/netopeer2-keystored/netopeer2-keystored.hash
new file mode 100644
index 0000000000..a54b062a9d
--- /dev/null
+++ b/package/netopeer2-keystored/netopeer2-keystored.hash
@@ -0,0 +1,2 @@ 
+sha256 59688271be4fecbbee671fc7eb3dc0538b13b4baab53e923e26eaeb33e6f7ec0  netopeer2-keystored-v0.7-r2.tar.gz
+sha256 932b75a8610a5c58e0fe0f70f8e4ebbcf3a2392acc16a88e95aebcdbdb9245e0  LICENSE
diff --git a/package/netopeer2-keystored/netopeer2-keystored.mk b/package/netopeer2-keystored/netopeer2-keystored.mk
new file mode 100644
index 0000000000..8160c53867
--- /dev/null
+++ b/package/netopeer2-keystored/netopeer2-keystored.mk
@@ -0,0 +1,29 @@ 
+################################################################################
+#
+# netopeer2-keystored
+#
+################################################################################
+
+NETOPEER2_KEYSTORED_VERSION = v0.7-r2
+NETOPEER2_KEYSTORED_SITE = $(call github,CESNET,Netopeer2,$(NETOPEER2_KEYSTORED_VERSION))
+NETOPEER2_KEYSTORED_LICENSE = BSD-3-Clause
+NETOPEER2_KEYSTORED_LICENSE_FILES = LICENSE
+NETOPEER2_KEYSTORED_SUBDIR = keystored
+NETOPEER2_KEYSTORED_DEPENDENCIES += host-sysrepo sysrepo
+
+NETOPEER2_KEYSTORED_CONF_OPTS += \
+	-DKEYSTORED_DEFER_SSH_KEY=ON \
+	-DSSH_KEY_INSTALL=ON \
+	-DMODEL_INSTALL=ON \
+	-DSYSREPOCTL_EXECUTABLE=$(HOST_DIR)/bin/sysrepoctl \
+	-DSYSREPOCFG_EXECUTABLE=$(HOST_DIR)/bin/sysrepocfg
+
+define NETOPEER2_KEYSTORED_PERMISSIONS
+	/etc/sysrepo/data/ietf-keystore.persist f 600 0 0 - - - - -
+	/etc/sysrepo/data/ietf-keystore.running f 600 0 0 - - - - -
+	/etc/sysrepo/data/ietf-keystore.running.lock f 600 0 0 - - - - -
+	/etc/sysrepo/data/ietf-keystore.startup f 600 0 0 - - - - -
+	/etc/sysrepo/data/ietf-keystore.startup.lock f 600 0 0 - - - - -
+endef
+
+$(eval $(cmake-package))