Le Tue, Feb 20, 2024 at 08:42:23PM +0100, Bjorn Ketelaars a écrit :
> On Tue 20/02/2024 11:30, Jeremie Courreges-Anglas wrote:
> > On Mon, Feb 19 2024, Bjorn Ketelaars <b...@openbsd.org> wrote:
> > > Diff below updates net/unison to 2.53.4, which includes bug fixes, minor
> > > improvements and clean-ups. Release notes:
> > > https://github.com/bcpierce00/unison/releases/tag/v2.53.4.
> > >
> > > Change in the build system is that the gtk3 flavor of unison is
> > > renamed to unison-gui. This is undone in the diff below by setting the
> > > correct binary and renaming it in the do-install phase. I'm not sure
> > > if this is the way to go, or if there is a better way to do this.
> > 
> > If lablgtk3 is installed then both unison and unison-gui are built, with
> > or without FLAVOR=no_x11.  The problem is you're *adding* to MAKE_FLAGS
> > instead of *setting* ALL_TARGET=gui/tui.
> > 
> > Now that the build system lets you build both, it would be interesting
> > to use MULTI_PACKAGES, with a -gui subpackage shipping just the
> > unison-gui program and carrying the gtk3 dep.  With proper @pkgpaths the
> > upgrade path would be mostly transparent for users (gotta retrain their
> > fingers to type unison-gui when needed).
> > 
> > Additionally no_x11 could stay as a PSEUDO_FLAVOR so that people can
> > build and install the tui program/package without having lablgtk3
> > installed.
> 
> New diff, which addresses Jeremie's feedback:
> - uses MULTI_PACKAGES (with a -x11 subpackage);
> - no_x11 as PSEUDO_FLAVOR;
> - updated @pkgpath markers;
> - added quirks entry;
> - updated net/Makefile.
>
> With this users are able to use `pkg_add -u` and:
> - update unison-2.53.3 to unison-x11-2.53.4 (pulls in unison-2.53.4 as
>   RDEP);
> - update unison-no_x11-2.53.3 to unison-2.53.4.
> 
> Comments/OK?

Looks mostly good, please see comments inline.

> diff --git devel/quirks/Makefile devel/quirks/Makefile
> index b52a6ca153c..29352025828 100644
> --- devel/quirks/Makefile
> +++ devel/quirks/Makefile
> @@ -3,7 +3,7 @@ CATEGORIES =  devel databases
>  DISTFILES =
>  
>  # API.rev
> -PKGNAME =    quirks-7.6
> +PKGNAME =    quirks-7.7
>  PKG_ARCH =   *
>  MAINTAINER = Marc Espie <es...@openbsd.org>
>  
> diff --git devel/quirks/files/Quirks.pm devel/quirks/files/Quirks.pm
> index a5641d20104..e0a8ce89fc4 100644
> --- devel/quirks/files/Quirks.pm
> +++ devel/quirks/files/Quirks.pm
> @@ -809,6 +809,8 @@ my $stem_extensions = {
>       'py-analyzemft' => 'py3-analyzemft',
>       'llama' => 'walk',
>       'py-setuptools-git' => 'py3-setuptools-git',
> +     'unison' => 'unison-x11',

This line is correct and needed for the upgrade path.

> +     'unison-no_x11' => 'unison',

This one looks incorrect: there never was a unison-no_x11 package
(rather unison--no_x11).  It's not needed for pkg_add -u to work so
you can just drop it.

>  };
>  
>  my $obsolete_reason = {};
> diff --git net/Makefile net/Makefile
> index eaee3c5bf66..370c6a22f70 100644
> --- net/Makefile
> +++ net/Makefile
> @@ -749,7 +749,6 @@
>       SUBDIR += uhttpmock
>       SUBDIR += unifi
>       SUBDIR += unison
> -     SUBDIR += unison,no_x11
>       SUBDIR += unworkable
>       SUBDIR += usockets
>       SUBDIR += utox
> diff --git net/unison/Makefile net/unison/Makefile
> index d240adb9879..da4c1fef4e1 100644
> --- net/unison/Makefile
> +++ net/unison/Makefile
> @@ -2,12 +2,12 @@
>  USE_NOEXECONLY = yes
>  .endif
>  
> -COMMENT =    multi-platform file synchronization tool
> +COMMENT-main =       multi-platform file synchronization tool
> +COMMENT-x11 =        gtk3 based interface for unison

You're using the default unison-x11 package name for the GUI program.
Was there a reason not to name the package unison-gui instead, just
like the program it ships?  (Not objecting, just wondering.)

>  GH_ACCOUNT = bcpierce00
>  GH_PROJECT = unison
> -GH_TAGNAME = v2.53.3
> -REVISION =   2
> +GH_TAGNAME = v2.53.4
>  
>  CATEGORIES = net
>  
> @@ -16,47 +16,46 @@ MAINTAINER =      Bjorn Ketelaars <b...@openbsd.org>
>  # GPLv3
>  PERMIT_PACKAGE =     Yes
>  
> -WANTLIB =            c m util
> +WANTLIB =    c m pthread util
> +WANTLIB-x11 =        ${WANTLIB} atk-1.0 cairo cairo-gobject fontconfig 
> freetype
> +WANTLIB-x11 +=       gdk-3 gdk_pixbuf-2.0 gio-2.0 glib-2.0 gobject-2.0 gtk-3
> +WANTLIB-x11 +=       harfbuzz intl pango-1.0 pangocairo-1.0
>  
>  MODULES =            lang/ocaml
>  MODOCAML_RUNDEP =    if-not-native
>  
> -USE_GMAKE =  Yes
> +LIB_DEPENDS-x11 =    x11/gtk+3
> +RUN_DEPENDS-x11 =    ${BASE_PKGPATH},-main=${GH_TAGNAME:S/v//} \
> +                     devel/desktop-file-utils
>  
>  # CFLAGS _must_ be empty. This is an OCaml compiler.
>  MAKE_FLAGS = NATIVE=${MODOCAML_NATIVE:S/Yes/true/:S/No/false/} \
>               OCAMLOPT=ocamlopt.opt \
>               CFLAGS=
>  
> -FLAVORS =    no_x11
> -FLAVOR ?=
> -
> -.if ${FLAVOR:Mno_x11}
> -MAKE_FLAGS +=        UISTYLE=text
> -.else
> -WANTLIB +=   atk-1.0 cairo cairo-gobject fontconfig freetype gdk-3
> -WANTLIB +=   gdk_pixbuf-2.0 gio-2.0 glib-2.0 gobject-2.0 gtk-3 harfbuzz
> -WANTLIB +=   intl pango-1.0 pangocairo-1.0
> -BUILD_DEPENDS +=     x11/lablgtk3
> -LIB_DEPENDS +=               x11/gtk+3
> -RUN_DEPENDS +=               devel/desktop-file-utils
> -MAKE_FLAGS +=                UISTYLE=gtk3
> -.endif
> +USE_GMAKE =  Yes
>  
> -FLAVOR_COMMA =       ${FLAVOR_EXT:S/-/,/g}
> -SUBST_VARS = FLAVOR_COMMA
> +MULTI_PACKAGES =     -main -x11
> +PSEUDO_FLAVORS =     no_x11
> +FLAVOR ?=
>  
>  PORTHOME =   ${WRKDIR}
>  DOCS =               NEWS.md README.md
>  
> -# Avoid the nightmare of their Makefile install target.
> +.include <bsd.port.arch.mk>
> +
> +.if ${BUILD_PACKAGES:M-x11}
> +BUILD_DEPENDS =              x11/lablgtk3
> +.endif

Here things get a bit hairy.  The gtk bits are built if lablgtk3 is
installed, even if no_x11 is selected.  That shouldn't affect the
resulting unison package, and no_x11 is only a pseudo-flavor that will
not be exercised in bulk builds, but it bothers me.

I could not find an easy way to address this.  Using

+.if ${BUILD_PACKAGES:M-x11}
+BUILD_DEPENDS =                x11/lablgtk3
+.else
+ALL_TARGET = tui
+.endif

would fail at fake time because the manpage isn't generated, and 

+.if ${BUILD_PACKAGES:M-x11}
+BUILD_DEPENDS =                x11/lablgtk3
+.else
+ALL_TARGET = tui manpage
+.endif

also results in the gtk bits being built, so same issue.  At this
point I would suggest to just drop the PSEUDO_FLAVOR, the
BUILT_PACKAGES checks, and always depend on lablgtk3.  I hope you
haven't spent too much time on that suggestion. :-/

> +
>  # Do not use INSTALL_PROGRAM, as the bytecode version must not be stripped!
>  do-install:
>       ${INSTALL_SCRIPT} ${WRKSRC}/src/unison ${PREFIX}/bin
>       ${INSTALL_MAN} ${WRKSRC}/man/unison.1 ${PREFIX}/man/man1
>       ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/unison
>       @cd ${WRKSRC} && ${INSTALL_DATA} ${DOCS} ${PREFIX}/share/doc/unison
> -.if !${FLAVOR:Mno_x11}
> +.if ${BUILD_PACKAGES:M-x11}
> +     ${INSTALL_SCRIPT} ${WRKSRC}/src/unison-gui ${PREFIX}/bin
>       ${INSTALL_DATA_DIR} ${PREFIX}/share/pixmaps
>       ${INSTALL_DATA} ${WRKSRC}/icons/U.svg \
>               ${PREFIX}/share/pixmaps/unison.svg
> diff --git net/unison/distinfo net/unison/distinfo
> index df466e43a6d..aaf7e3e2284 100644
> --- net/unison/distinfo
> +++ net/unison/distinfo
> @@ -1,2 +1,2 @@
> -SHA256 (unison-2.53.3.tar.gz) = quoE/FvHbc/oYnaDyWWe5MGU1PmSzIqqFbuygg/I3kY=
> -SIZE (unison-2.53.3.tar.gz) = 1415490
> +SHA256 (unison-2.53.4.tar.gz) = 0Z5CkwE1gdvE0Umu+Js0x2Ih78vYc8eqUZPeSJrduFo=
> +SIZE (unison-2.53.4.tar.gz) = 1407429
> diff --git net/unison/files/unison.desktop net/unison/files/unison.desktop
> index af64ef6617c..f091224ffee 100644
> --- net/unison/files/unison.desktop
> +++ net/unison/files/unison.desktop
> @@ -2,7 +2,7 @@
>  Encoding=UTF-8
>  Name=unison
>  Comment=File synchronisation tool for X11
> -TryExec=unison
> +TryExec=unison-gui
>  Exec=unison

Should this line also be changed to unison-gui?

>  Terminal=false
>  Type=Application
> diff --git net/unison/pkg/DESCR net/unison/pkg/DESCR
> deleted file mode 100644
> index d55c9d37b4d..00000000000
> --- net/unison/pkg/DESCR
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -Unison is a file-synchronization tool for Unix and Windows.  It allows
> -two replicas of a collection of files and directories to be stored on
> -different hosts (or different disks on the same host), modified
> -separately, and then brought up to date by propagating the changes in
> -each replica to the other.
> -
> -Flavors:
> -     no_x11  - build without X support
> diff --git net/unison/pkg/DESCR-main net/unison/pkg/DESCR-main
> new file mode 100644
> index 00000000000..d55c9d37b4d
> --- /dev/null
> +++ net/unison/pkg/DESCR-main
> @@ -0,0 +1,8 @@
> +Unison is a file-synchronization tool for Unix and Windows.  It allows
> +two replicas of a collection of files and directories to be stored on
> +different hosts (or different disks on the same host), modified
> +separately, and then brought up to date by propagating the changes in
> +each replica to the other.
> +
> +Flavors:
> +     no_x11  - build without X support

Please drop the no_x11 FLAVOR, there is isn't a no_x11 FLAVOR anymore.
You *may* want to mention that the unison-gui program is available in
another package, your call.

> diff --git net/unison/pkg/DESCR-x11 net/unison/pkg/DESCR-x11
> new file mode 100644
> index 00000000000..1fdf8f99d18
> --- /dev/null
> +++ net/unison/pkg/DESCR-x11
> @@ -0,0 +1 @@
> +GTK3 based interface for unison.
> diff --git net/unison/pkg/PFRAG.no-no_x11 net/unison/pkg/PFRAG.no-no_x11
> deleted file mode 100644
> index a8d2b57156d..00000000000
> --- net/unison/pkg/PFRAG.no-no_x11
> +++ /dev/null
> @@ -1,4 +0,0 @@
> -share/applications/unison.desktop
> -share/pixmaps/
> -share/pixmaps/unison.svg
> -@tag update-desktop-database
> diff --git net/unison/pkg/PLIST net/unison/pkg/PLIST
> deleted file mode 100644
> index 4b3d8d144fa..00000000000
> --- net/unison/pkg/PLIST
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -@pkgpath net/unison/2.4x${FLAVOR_COMMA}
> -@pkgpath net/unison/2.5x${FLAVOR_COMMA}
> -@pkgpath net/unison/snapshot${FLAVOR_COMMA}
> -@pkgpath net/unison/stable${FLAVOR_COMMA}
> -@bin bin/unison
> -lib/ocaml/
> -lib/ocaml/stublibs/
> -@man man/man1/unison.1
> -share/doc/pkg-readmes/${PKGSTEM}
> -share/doc/unison/
> -share/doc/unison/NEWS.md
> -share/doc/unison/README.md
> -!%%no_x11%%
> diff --git net/unison/pkg/PLIST-main net/unison/pkg/PLIST-main
> new file mode 100644
> index 00000000000..eb6c049b92d
> --- /dev/null
> +++ net/unison/pkg/PLIST-main
> @@ -0,0 +1,12 @@
> +@pkgpath net/unison/2.4x,no_x11
> +@pkgpath net/unison/2.5x,no_x11
> +@pkgpath net/unison/snapshot,no_x11
> +@pkgpath net/unison/stable,no_x11
> +@pkgpath net/unison,no_x11

LGTM

> +@bin bin/unison
> +@man man/man1/unison.1
> +share/applications/
> +share/doc/pkg-readmes/${PKGSTEM}
> +share/doc/unison/
> +share/doc/unison/NEWS.md
> +share/doc/unison/README.md
> diff --git net/unison/pkg/PLIST-x11 net/unison/pkg/PLIST-x11
> new file mode 100644
> index 00000000000..9a111597b31
> --- /dev/null
> +++ net/unison/pkg/PLIST-x11
> @@ -0,0 +1,10 @@
> +@pkgpath net/unison/2.4x
> +@pkgpath net/unison/2.5x
> +@pkgpath net/unison/snapshot
> +@pkgpath net/unison/stable
> +@pkgpath net/unison

LGTM

> +@bin bin/unison-gui
> +share/applications/unison.desktop
> +share/pixmaps/
> +share/pixmaps/unison.svg
> +@tag update-desktop-database
> diff --git net/unison/pkg/README net/unison/pkg/README
> deleted file mode 100644
> index 486568a163a..00000000000
> --- net/unison/pkg/README
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -+-----------------------------------------------------------------------
> -| Running ${PKGSTEM} on OpenBSD
> -+-----------------------------------------------------------------------
> -
> -This version of unison is compatible with:
> -- unison 2.52 or newer. You do not have to pay any attention to OCaml
> -  compiler versions.
> -- unison 2.51 if both versions are compiled with same OCaml compiler
> -  version.
> -- unison 2.48 if both versions are compiled with same OCaml compiler
> -  version.
> -
> -It is possible to use the OPAM OCaml package manager to build unison
> -with the same version of the OCaml compiler on all machines:
> -
> -doas pkg_add opam
> -export OPAMROOT=~/opam_unison
> -opam init --no-setup --compiler ocaml-base-compiler.4.09.0
> -opam install unison lablgtk  # To build without the gui, remove lablgtk
> -$(opam var bin)/unison
> -
> -Common issue
> -=============
> -Unison sometimes reports chown() failures that are actually failures to
> -change group ownership. This can occur when a user does not belong to
> -the specified group and is the owner of the file, or is not the
> -superuser. Issue can be addressed by setting the option 'group' to
> -'false'.
> diff --git net/unison/pkg/README-main net/unison/pkg/README-main
> new file mode 100644
> index 00000000000..486568a163a
> --- /dev/null
> +++ net/unison/pkg/README-main
> @@ -0,0 +1,28 @@
> ++-----------------------------------------------------------------------
> +| Running ${PKGSTEM} on OpenBSD
> ++-----------------------------------------------------------------------
> +
> +This version of unison is compatible with:
> +- unison 2.52 or newer. You do not have to pay any attention to OCaml
> +  compiler versions.
> +- unison 2.51 if both versions are compiled with same OCaml compiler
> +  version.
> +- unison 2.48 if both versions are compiled with same OCaml compiler
> +  version.
> +
> +It is possible to use the OPAM OCaml package manager to build unison
> +with the same version of the OCaml compiler on all machines:
> +
> +doas pkg_add opam
> +export OPAMROOT=~/opam_unison
> +opam init --no-setup --compiler ocaml-base-compiler.4.09.0

Not a new concern, and maybe not an actual problem, but: would it be
better to tell people to pick any version instead of hardcoding an old
release that may not work anymore?

> +opam install unison lablgtk  # To build without the gui, remove lablgtk
> +$(opam var bin)/unison
> +
> +Common issue
> +=============
> +Unison sometimes reports chown() failures that are actually failures to
> +change group ownership. This can occur when a user does not belong to
> +the specified group and is the owner of the file, or is not the
> +superuser. Issue can be addressed by setting the option 'group' to
> +'false'.
> 

-- 
jca

Reply via email to