Wednesday, April 27, 2022

Re: net/znc - enable cyrus-sasl module and make into multi-package

aisha <openbsd.ports@aisha.cc> wrote:
> On 22/03/17 08:56PM, Brad Smith wrote:
> > On 3/17/2022 8:07 PM, aisha wrote:
> > > On 22/02/26 01:14PM, aisha wrote:
> > > > Hi,
> > > > I've had a need to add the sasl functionality for ZNC
> > > > so I added it as a multi package.

There's a specific reason to package the sasl functionality into a
subpackage? Does the main package still works without the -sasl
subpackage installed?

Why don't just enable sasl in the main package? It's an extra
dependency, ok, but it does not seems huge, so we may just as well keep
a single package?

Asking just for curiosity. I haven't run znc for a while (switched to
pounce :P) and I haven't tested the diff yet.

> > > > This is my first time making a multi package so I'm not
> > > > super sure if I've done everything correctly.
> > > > I've checked with portcheck and port-lib-depends-check
> > > > and they seem to be happy.

as i've discovered just yesterday, you're missing a @pkgpath marker in
the plists for the -main package. comments inline

> > > > While here, I've also added a dedicated user for ZNC
> > > > and a service file, as well as a small README to tell
> > > > how and where to create the config files.
> > > >
> > > > Best,
> > > > Aisha
>
> ping reattached updated patch
>
> diff --git a/infrastructure/db/user.list b/infrastructure/db/user.list
> index c19a1052206..491cf421e06 100644
> --- a/infrastructure/db/user.list
> +++ b/infrastructure/db/user.list
> @@ -384,3 +384,4 @@ id user group port
> 873 _alertmanager _alertmanager sysutils/alertmanager
> 874 _snowflakeproxy _snowflakeproxy net/snowflake_proxy
> 875 _guacd _guacd net/guacamole/server
> +876 _znc _znc net/znc

(it's just me or we're adding a lot of users recently?)

> diff --git a/net/znc/Makefile b/net/znc/Makefile
> index b6d42ba7558..e6858ab8612 100644
> --- a/net/znc/Makefile
> +++ b/net/znc/Makefile
> @@ -1,9 +1,10 @@
> -COMMENT= advanced IRC bouncer
> +COMMENT-main= advanced IRC bouncer
> +COMMENT-sasl= SASL module for ZNC
>
> DISTNAME= znc-1.8.2
> CATEGORIES= net
> MASTER_SITES= ${HOMEPAGE}releases/
> -REVISION= 2
> +REVISION= 3

+REVISION-main = 3

no need to bump the global revision. you can use

$ make show=PKGNAMES

to see the names of the produced packages and see how REVISION /
REVISION-${subpackage} reflects on the generated package names.

> HOMEPAGE= https://znc.in/
>
> @@ -12,19 +13,29 @@ MAINTAINER= Aisha Tammy <openbsd@aisha.cc>
> # Apache 2.0
> PERMIT_PACKAGE= Yes
>
> -WANTLIB= c crypto icuuc icudata m pthread ssl z ${COMPILER_LIBCXX}
> +MULTI_PACKAGES= -main -sasl
> +PSEDUO_FLAVORS= no_sasl

I don't have a strong opinion, but I think we can live without the
PSEUDO_FLAVORS for this one.

It's useful in various cases (see for example x11/wxWidgets and how the
-webkit subpackage is built only on some architectures), but here
provides little benefits I think.

> +WANTLIB-common= crypto icuuc icudata m pthread ssl z ${COMPILER_LIBCXX}
> +WANTLIB= c ${WANTLIB-common}
> +WANTLIB-sasl= sasl2 ${WANTLIB-common}
>
> LIB_DEPENDS= textproc/icu4c
> +LIB_DEPENDS-sasl= ${LIB_DEPENDS} \
> + security/cyrus-sasl2
>
> MODULES= devel/cmake
>
> COMPILER= base-clang ports-gcc
>
> -CONFIGURE_ARGS+= -DWANT_CYRUS=NO \
> - -DWANT_I18N=NO \
> - -DWANT_ICU=YES
> +CONFIGURE_ARGS+= -DWANT_I18N=NO
> +
> CXXFLAGS+= -DHAVE_OPAQUE_SSL
>
> NO_TEST= Yes
>
> .include <bsd.port.mk>
> +
> +.if !${BUILD_PACKAGES:M-sasl}
> +CONFIGURE_ARGS+= -DWANT_CYRUS=NO
> +.endif
> diff --git a/net/znc/pkg/DESCR b/net/znc/pkg/DESCR-main
> similarity index 100%
> rename from net/znc/pkg/DESCR
> rename to net/znc/pkg/DESCR-main
> diff --git a/net/znc/pkg/DESCR-sasl b/net/znc/pkg/DESCR-sasl
> new file mode 100644
> index 00000000000..26aad0d36f8
> --- /dev/null
> +++ b/net/znc/pkg/DESCR-sasl
> @@ -0,0 +1 @@
> +SASL module for ZNC
> diff --git a/net/znc/pkg/PLIST b/net/znc/pkg/PLIST-main
> similarity index 97%
> rename from net/znc/pkg/PLIST
> rename to net/znc/pkg/PLIST-main
> index fa26e73f141..681461a0cc1 100644
> --- a/net/znc/pkg/PLIST
> +++ b/net/znc/pkg/PLIST-main
> @@ -1,3 +1,12 @@

you need a

@pkgpath net/znc

for updates to work. If I've understood everything correctly, by
splitting this into a subpackage the pkgpath changed from net/znc to
net/znc,-main so for smooth upgrade you need a @pkgpath here.

> +@newgroup _znc:876
> +@newuser _znc:876:876:daemon:ZNC Daemon:/nonexistent:/sbin/nologin
> +@rcscript ${RCDIR}/znc
> +@owner _znc
> +@group _znc
> +@sample /var/znc/
> +@sample /var/znc/configs/
> +@owner
> +@group
> @bin bin/znc
> bin/znc-buildmod
> include/znc/
> @@ -92,6 +101,7 @@ lib/znc/
> @so lib/znc/webadmin.so
> @man man/man1/znc-buildmod.1
> @man man/man1/znc.1
> +share/doc/pkg-readmes/${PKGSTEM}
> share/znc/
> share/znc/cmake/
> share/znc/cmake/ZNCConfig.cmake
> diff --git a/net/znc/pkg/PLIST-sasl b/net/znc/pkg/PLIST-sasl
> new file mode 100644
> index 00000000000..8fabc5365e2
> --- /dev/null
> +++ b/net/znc/pkg/PLIST-sasl
> @@ -0,0 +1 @@
> +@so lib/znc/cyrusauth.so
> diff --git a/net/znc/pkg/README-main b/net/znc/pkg/README-main
> new file mode 100644
> index 00000000000..55bf39e73dd
> --- /dev/null
> +++ b/net/znc/pkg/README-main
> @@ -0,0 +1,12 @@
> ++--------------------------
> ++ Running ZNC on OpenBSD
> ++--------------------------

should read

Running ${PKGSTEM} on OpenBSD

and the '--' long as per infrastructure/template/README.template, but I
guess it doesn't matter too much.

> +Configuration file
> +==================
> +
> +The default configuration file for ZNC on OpenBSD is to be stored
> +at /var/znc/configs/znc.conf and can be created interactively by
> +
> +$ su -l -s /bin/ksh _znc
> +$ znc -d /var/znc --makeconf

I'd rewrite this as a one liner. No strong reason for it, I just think
that it'd read better since it involves commands that needs to be
executed by two different users (the first by a regular user, the second
by the shell executed at the previous step...).

No strong opinion thought.

> diff --git a/net/znc/pkg/znc.rc b/net/znc/pkg/znc.rc
> new file mode 100644
> index 00000000000..30bb831f0e3
> --- /dev/null
> +++ b/net/znc/pkg/znc.rc
> @@ -0,0 +1,11 @@
> +#!/bin/ksh
> +
> +daemon="${PREFIX}/bin/znc"
> +daemon_flags="-d /var/znc"
> +daemon_user="_znc"
> +
> +. /etc/rc.d/rc.subr
> +
> +rc_reload=NO
> +
> +rc_cmd $1

No comments:

Post a Comment