Bug 223401

Summary: [NEW PORT] net-mgmt/unifi5-devel: New port for Unifi unstable releases, version 5.7.3
Product: Ports & Packages Reporter: Bryce Edwards <bryce>
Component: Individual Port(s)Assignee: Mark Felder <feld>
Status: Closed FIXED    
Severity: Affects Only Me CC: berend, feld
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
shar contents of net-mgmt/unifi5 - passes poudriere testport
none
svn diff net-mgmt/unifi-devel none

Description Bryce Edwards 2017-11-03 16:43:04 UTC
Created attachment 187696 [details]
shar contents of net-mgmt/unifi5 - passes poudriere testport

This is to compliment port net-mgmt/unifi5 with a devel port that follows the Unifi unstable releases.
Comment 1 berend 2018-01-18 07:21:39 UTC
Great idea, please add.
Comment 2 Mark Felder freebsd_committer freebsd_triage 2018-01-18 12:46:00 UTC
I believe this precedes my changes to use the .deb as the distfile, but I will take care of that. We should be able to get this committed soon.
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-02-04 14:02:45 UTC
A commit references this bug:

Author: feld
Date: Sun Feb  4 14:01:51 UTC 2018
New revision: 460932
URL: https://svnweb.freebsd.org/changeset/ports/460932

Log:
  The UniFi Controller allows you to manage Wireless, Routing & Switching,
  VoIP and Video of Ubiquiti Networks.

  This port tracks the development releases.

  WWW: http://wiki.ubnt.com/UniFi_FAQ

  PR:	223401

Changes:
  head/net-mgmt/Makefile
  head/net-mgmt/unifi-devel/
  head/net-mgmt/unifi-devel/Makefile
  head/net-mgmt/unifi-devel/distinfo
  head/net-mgmt/unifi-devel/files/
  head/net-mgmt/unifi-devel/files/unifi.in
  head/net-mgmt/unifi-devel/pkg-descr
Comment 4 Mark Felder freebsd_committer freebsd_triage 2018-02-04 14:48:13 UTC
Bryce, do you want to take maintainership of this port? There isn't a good way to receive notifications when Ubiquiti releases updates, so I tend to miss them. With the version of the port I have committed there is no need to maintain a pkg-plist which makes updates very simple.

Let me know


Thanks!
Comment 5 Bryce Edwards 2018-02-09 01:57:29 UTC
Yes, I would be happy to, but before I take it I would like to validate a couple changes with you.  Take a look at the below and let me know if you have advice/suggestions.  The first two edits are due to portlint whining, you may advise I ignore those.

root@build /poudriere/ports/default/net-mgmt/unifi-devel #svnlite diff
Index: Makefile
===================================================================
--- Makefile	(revision 461202)
+++ Makefile	(working copy)
@@ -3,7 +3,6 @@
 
 PORTNAME=	unifi
 PORTVERSION=	5.7.15
-PORTREVISION=	0
 CATEGORIES=	net-mgmt java
 MASTER_SITES=	http://dl.ubnt.com/unifi/${PORTVERSION}-${UNIFI_BUILD}/
 PKGNAMESUFFIX=	-devel
@@ -20,14 +19,12 @@
 SUB_LIST+=	USERS=${USERS} GROUPS=${GROUPS} JAVASHAREDIR=${JAVASHAREDIR} \
 		JAVA=${JAVA}
 
-EXTRACT_CMD=	/usr/bin/ar
+EXTRACT_CMD=	ar
 EXTRACT_BEFORE_ARGS=	-p
 EXTRACT_AFTER_ARGS=	data.tar.xz | ${TAR} -xf -
 
 UNIFI_BUILD=	e9b882be05
 
-CONFLICTS=	unifi5-*
-
 USES=		cpe
 CPE_VENDOR=	ubnt
 CPE_PRODUCT=	unifi_controller
@@ -47,13 +44,13 @@
 
 NO_WRKSUBDIR=	yes
 
-CONFLICTS=	unifi2-* unifi3-* unifi4-*
+CONFLICTS=	unifi2-* unifi3-* unifi4-* unifi5-*
 
 DIR_LIST=	conf data logs run work
 
 post-patch:
 	${RM} ${WRKSRC}/usr/lib/unifi/lib/snappy-java-1.1.2.6.jar ${WRKSRC}/usr/lib/unifi/bin/*
-	(cd ${WRKSRC}/usr/lib/unifi/lib && ${LN} -s ${JAVAJARDIR}/snappy-java.jar snappy-java-1.1.2.6.jar)
+	(cd ${WRKSRC}/usr/lib/unifi/lib && ${LN} -f -s ${JAVAJARDIR}/snappy-java.jar snappy-java-*.jar)
 	${RM} -r ${WRKSRC}/usr/lib/unifi/lib/native
 
 do-install:
Comment 6 Bryce Edwards 2018-02-18 22:44:40 UTC
Created attachment 190765 [details]
svn diff net-mgmt/unifi-devel
Comment 7 commit-hook freebsd_committer freebsd_triage 2018-02-25 14:56:13 UTC
A commit references this bug:

Author: feld
Date: Sun Feb 25 14:55:39 UTC 2018
New revision: 462955
URL: https://svnweb.freebsd.org/changeset/ports/462955

Log:
  net-mgmt/unifi-devel: Fix CONFLICTS

  - Update COMMENT
  - Assign to new maintainer

  PR:		223401

Changes:
  head/net-mgmt/unifi-devel/Makefile
Comment 8 Mark Felder freebsd_committer freebsd_triage 2018-02-25 14:56:49 UTC
(In reply to Bryce Edwards from comment #6)

Sorry about the delay.

PORTREVISION is harmless to leave at 0, but it can be removed.

It would be preferable to keep the EXTRACT_CMD as a full path to /usr/bin/ar to ensure we always use the one in base regardless of what PATH changes a user may have made when trying to build the package from ports.

Fixing the CONFLICTS is good -- thanks; I over looked this.

Changing the LN for snappy won't work. That will never successfully create a symlink because we delete the version included in the port a line earlier. We could try to automate this, but we won't notice when Unifi changes their snappy library version. It would be good to keep a close eye on this so we know if they jump major versions that might cause an incompatibility. The snappy port in FreeBSD is lagging behind a bit right now, but it's fully compatible. This might change and it would be bad to push out a Unifi release that starts to behave badly because of a snappy incompatibility. 

Getting an updated snappy port in the FreeBSD ports tree is proving difficult because there is a lot of difficulty in getting it to build without requiring internet access as is required by our tooling. Someone has to manually construct a build environment that won't require any internet access to fetch dependencies and make that the port DISTFILE. It seems quite tedious. An alternative approach I have been considering is to fetch the jar (http://central.maven.org/maven2/org/xerial/snappy/snappy-java/) and remove all non-FreeBSD native libraries. This only gives us x86_64 support though, and the build-from-source in the ports tree method gives us more architectures...
Comment 9 Bryce Edwards 2018-03-02 02:03:30 UTC
Thanks for explanation on PORTREVISION & EXTRACT_CMD, makes sense.  I was just going off what portlint what whining about, seems like it should support the desired behavior for those.

Anyways, as for snappy - unifi did not work (it started, but threw errors) with your changes because the file they have in the archive is not snappy-java-1.1.2.6.jar (which is why the RM didn't remove it) and we need to create a link to whatever version they have in there.

I recommend we remove the following line:

${RM} ${WRKSRC}/usr/lib/unifi/lib/snappy-java-1.1.2.6.jar

and then let this line replace the (bad) snappy file that exists (regardless of version) with a symlink:

(cd ${WRKSRC}/usr/lib/unifi/lib && ${LN} -f -s ${JAVAJARDIR}/snappy-java.jar snappy-java-*.jar)
Comment 10 commit-hook freebsd_committer freebsd_triage 2018-03-02 13:37:31 UTC
A commit references this bug:

Author: feld
Date: Fri Mar  2 13:36:29 UTC 2018
New revision: 463398
URL: https://svnweb.freebsd.org/changeset/ports/463398

Log:
  net-mgmt/unifi-devel: Replace bundled snappy jar

  Overwrite whichever version is shipped with a symlink to the version
  installed by the package dependency.

  PR:		223401
  Submitted by:	maintainer

Changes:
  head/net-mgmt/unifi-devel/Makefile