Bug 222261 - textproc/elasticsearch5: Update to 5.6.0
Summary: textproc/elasticsearch5: Update to 5.6.0
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Mark Felder
URL:
Keywords: needs-qa, patch
Depends on:
Blocks:
 
Reported: 2017-09-12 15:32 UTC by Franz Bettag
Modified: 2018-03-08 06:51 UTC (History)
6 users (show)

See Also:
pi: maintainer-feedback-


Attachments
elasticsearch 5.3 -> 5.6 diff (13.40 KB, patch)
2017-09-12 15:32 UTC, Franz Bettag
no flags Details | Diff
elasticsearch5 5.3.0 to 5.6.4 patch (14.95 KB, patch)
2017-11-13 16:28 UTC, Patrice
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Franz Bettag 2017-09-12 15:32:19 UTC
Created attachment 186301 [details]
elasticsearch 5.3 -> 5.6 diff

Update for elasticsearch 5.6.0
Comment 1 Jeffrey Gelens 2017-09-29 23:54:34 UTC
I tried a build for 5.6.2 manually and it seems the version of JNA (4.4.0) coming with this version of Elasticsearch is not build for Freebsd.

Version 4.5.0 however does have FreeBSD support again, just replacing the file  /usr/local/lib/elasticsearch/lib/jna-4.4.0-1.jar with 4.5.0 from here https://github.com/java-native-access/jna worked for me.
Comment 2 Patrice 2017-11-09 08:40:21 UTC
I used the following procedure to update to 5.6.0:

- use the patch from the original poster
- install jna 4.5.0 port (devel/jna)
- install patched elasticsearch5 port (textproc/elasticsearch5)
- remove jna 4.4.0
=> rm /usr/local/lib/elasticsearch/lib/jna-4.4.0-1.jar
- copy jna 4.5.0 from installed port
=> cp /usr/local/share/java/classes/jna.jar /usr/local/lib/elasticsearch/lib/jna-4.5.0-1.jar
- change permission on log4j2.properties
=> chmod a+r /usr/local/etc/elasticsearch/log4j2.properties
- service elasticsearch start

And all goes well (on a single node dev host and until now).
Comment 3 Patrice 2017-11-13 16:28:38 UTC
Created attachment 187971 [details]
elasticsearch5 5.3.0 to 5.6.4 patch

Hello,

I made a patch against original 5.3.0 version of the port to update to 5.6.4 which integrates the jna.jar file from devel/jna port.

It is currently running ok on our preproduction cluster.

Regards,
Comment 4 Walter Schwarzenfeld freebsd_triage 2018-02-05 20:39:09 UTC
Update patch to 5.6.3 exists - bug #223439. So I close here - overcome by events.
Comment 5 Kurt Jaeger freebsd_committer freebsd_triage 2018-02-25 09:27:57 UTC
Mark, can you look at the JNA topic mentioned in comment 3 ?
Comment 6 commit-hook freebsd_committer freebsd_triage 2018-02-26 23:06:34 UTC
A commit references this bug:

Author: feld
Date: Mon Feb 26 23:06:02 UTC 2018
New revision: 463096
URL: https://svnweb.freebsd.org/changeset/ports/463096

Log:
  textproc/elasticsearch5: Fix JNA support

  JNA (Java Native Access) provides access to OS-native facilities in pure
  Java code. The JNA shipped with Elastic is meant for Linux so it does
  not function correctly. We will ship one built for FreeBSD instead.

  PR:		222261
  Approved by:	portmgr (with hat)

Changes:
  head/textproc/elasticsearch5/Makefile
Comment 7 commit-hook freebsd_committer freebsd_triage 2018-02-26 23:12:45 UTC
A commit references this bug:

Author: feld
Date: Mon Feb 26 23:11:53 UTC 2018
New revision: 463098
URL: https://svnweb.freebsd.org/changeset/ports/463098

Log:
  textproc/elasticsearch6: Fix JNA support

  JNA (Java Native Access) provides access to OS-native facilities in pure
  Java code. The JNA shipped with Elastic is meant for Linux so it does
  not function correctly. We will ship one built for FreeBSD instead.

  PR:		222261

Changes:
  head/textproc/elasticsearch6/Makefile
Comment 8 commit-hook freebsd_committer freebsd_triage 2018-02-26 23:22:56 UTC
A commit references this bug:

Author: feld
Date: Mon Feb 26 23:21:57 UTC 2018
New revision: 463102
URL: https://svnweb.freebsd.org/changeset/ports/463102

Log:
  textproc/elasticsearch{5,6}: Fix build

  The JNA dependency was meant to be at runtime

  Pointyhat:	me
  PR:		222261

Changes:
  head/textproc/elasticsearch5/Makefile
  head/textproc/elasticsearch6/Makefile
Comment 9 Patrice 2018-02-27 11:12:38 UTC
(In reply to commit-hook from comment #8)

Hi,

the new patch still don't work. A symbolic link is created pointing to nowhere.

Logs from ES:

2018-02-26T01:12:53,034][WARN ][o.e.b.Natives            ] JNA not found. native methods will be disabled.

Missing jna.jar:

ls -l /usr/local/lib/elasticsearch/lib/jna.jar
lrwxr-xr-x  1 root  wheel  68 Feb 27 12:51 /usr/local/lib/elasticsearch/lib/jna.jar@ -> ../../../../../../../../../../../../local/share/java/classes/jna.jar

md5 /usr/local/lib/elasticsearch/lib/jna.jar
md5: /usr/local/lib/elasticsearch/lib/jna.jar: No such file or directory
Comment 10 Walter Schwarzenfeld freebsd_triage 2018-02-27 11:29:48 UTC
see Bug #226234.
Comment 11 Mark Felder freebsd_committer freebsd_triage 2018-02-27 14:49:21 UTC
(In reply to Patrice from comment #9)

$ pkg info | grep elasticsearch5
elasticsearch5-5.6.8_2         Full-text search engine for Java

$ ls -la jna.jar 
lrwxr-xr-x  1 root  wheel  72 Feb 26 23:23 jna.jar -> ../../../../../../../../../../../../usr/local/share/java/classes/jna.jar

$ md5 jna.jar 
MD5 (jna.jar) = 5736a11b203679cda4b3cb5237a82b70

$ md5 ../../../../../../../../../../../../usr/local/share/java/classes/jna.jar
MD5 (../../../../../../../../../../../../usr/local/share/java/classes/jna.jar) = 5736a11b203679cda4b3cb5237a82b70


Make sure you're using PORTREVISION=2 version of the port/package.
Comment 12 Patrice 2018-02-27 15:23:51 UTC
(In reply to Mark Felder from comment #11)

Sorry, but it fails at compile time. I updated the tree with portsnap fetch && update. Then, I pkg deleted jna and elasticsearch5 and used portmaster to install elasticsearch5. Here is the compile error:

install -lrs /usr/ports/usr/ports/textproc/elasticsearch5/work/stage/usr/local/lib/elasticsearch/bin/elasticsearch-plugin /usr/ports/usr/ports/textproc/elasticsearch5/work/stage/usr/local/bin/elasticsearch-plugin
install -lrs /usr/local/share/java/classes/jna.jar /usr/ports/usr/ports/textproc/elasticsearch5/work/stage/usr/local/lib/elasticsearch/lib/jna.jar
install: /usr/local/share/java/classes/jna.jar: realpath: No such file or directory
*** Error code 71

Stop.
make[1]: stopped in /usr/ports/textproc/elasticsearch5
*** Error code 1


I made the patch in the first place with JNA as a build dependency only on purpose.
Comment 13 Mark Felder freebsd_committer freebsd_triage 2018-02-28 17:06:35 UTC
(In reply to Patrice from comment #12)

Your portsnap is behind. What PORTREVISION are you on?

I intentionally removed it as a BUILD dependency because we should not bundle this with Elastic if it's in the ports tree; instead we should install it from the package and symlink to it. This ensures we get fixes and improvements regardless of what version of Elastic is installed.
Comment 14 Patrice 2018-02-28 18:09:40 UTC
(In reply to Mark Felder from comment #13)

I am on PORTREVISION 2. Tried again a few minutes ago. Update via portsnap, here are the results:

root@ports:/usr/ports/textproc/elasticsearch5 # grep PORTREV Makefile 
PORTREVISION=	2

root@ports:/usr/ports/textproc/elasticsearch5 # pkg info |grep jna
root@ports:/usr/ports/textproc/elasticsearch5 # portmaster -gdb textproc/elasticsearch5
...
===>>> The following actions will be taken if you choose to proceed:
	Install textproc/elasticsearch5
	Install devel/jna
	Upgrade openjdk8-8.162.12 to openjdk8-8.162.12_1

===>>> Proceed? y/n [y]
...
install -lrs /usr/ports/usr/ports/textproc/elasticsearch5/work/stage/usr/local/lib/elasticsearch/bin/elasticsearch-plugin /usr/ports/usr/ports/textproc/elasticsearch5/work/stage/usr/local/bin/elasticsearch-plugin
install -lrs /usr/local/share/java/classes/jna.jar /usr/ports/usr/ports/textproc/elasticsearch5/work/stage/usr/local/lib/elasticsearch/lib/jna.jar
install: /usr/local/share/java/classes/jna.jar: realpath: No such file or directory
*** Error code 71

Stop.


Have you tried my procedure: uninstall jna and elasticsearch5 and try to build elasticsearch5 again? My guess: build is breaking because jna is built after elasticsearch5.
Comment 15 Mark Felder freebsd_committer freebsd_triage 2018-03-01 23:44:15 UTC
Portmaster is behaving differently than Poudriere here... I'll force this with a BUILD_DEPENDS so the symlink never errors.
Comment 16 commit-hook freebsd_committer freebsd_triage 2018-03-01 23:46:55 UTC
A commit references this bug:

Author: feld
Date: Thu Mar  1 23:46:17 UTC 2018
New revision: 463359
URL: https://svnweb.freebsd.org/changeset/ports/463359

Log:
  textproc/elasticsearch5: Fix build

  devel/jca needs to be a BUILD_DEPEND or install fails to find the path
  for creating the symlink.

  Poudriere seemed to not notice as it had already installed devel/jca.

  PR:		222261

Changes:
  head/textproc/elasticsearch5/Makefile
Comment 17 Patrice 2018-03-02 08:25:02 UTC
(In reply to commit-hook from comment #16)

Hi,

well, even though the build works, there is still a bug with the symlink to jna.jar. I have deinstalled both jna and elasticsearch5 and installed the new ports (with PORTREVISION=2). jna.jar is still not found:

[2018-03-02T09:21:47,682][WARN ][o.e.b.Natives            ] JNA not found. native methods will be disabled.

root@pnode1:~ # find /usr/local/ -name jna.jar
/usr/local/share/java/classes/jna.jar
/usr/local/lib/elasticsearch/lib/jna.jar
root@pnode1:~ # ls -l /usr/local/lib/elasticsearch/lib/jna.jar 
lrwxr-xr-x  1 root  wheel  68 Mar  1 18:17 /usr/local/lib/elasticsearch/lib/jna.jar -> ../../../../../../../../../../../../local/share/java/classes/jna.jar
root@pnode1:~ # ls -l /usr/local/lib/elasticsearch/lib/../../../../../../../../../../../../local/share/java/classes/jna.jar
ls: /usr/local/lib/elasticsearch/lib/../../../../../../../../../../../../local/share/java/classes/jna.jar: No such file or directory
Comment 18 commit-hook freebsd_committer freebsd_triage 2018-03-02 13:07:01 UTC
A commit references this bug:

Author: feld
Date: Fri Mar  2 13:06:24 UTC 2018
New revision: 463392
URL: https://svnweb.freebsd.org/changeset/ports/463392

Log:
  textproc/elasticsearch{5,6}: Fix symlink

  Relative symlinks should only be used when both files are in the
  STAGEDIR. In this situation poudriere was producing usable packages
  because of the unique location of WRKSRC (/wrksrc/...) which caused the
  relative symlink to be deep enough "../../../../../" to hit the root of the
  filesystem and then point to the location of the file. However, users
  who were building the port directory with "make" or "portmaster" were
  getting symlinks that did not point to the right location.

  PR:		226234 226265 222261

Changes:
  head/textproc/elasticsearch5/Makefile
  head/textproc/elasticsearch6/Makefile
Comment 19 Patrice 2018-03-08 06:51:38 UTC
(In reply to commit-hook from comment #18)

Thanks very much, works perfectly now.

Regards,