[arch-commits] Commit in elasticsearch/trunk (PKGBUILD elasticsearch-env)

Sven-Hendrik Haase svenstaro at archlinux.org
Wed Jul 15 04:02:00 UTC 2020


    Date: Wednesday, July 15, 2020 @ 04:02:00
  Author: svenstaro
Revision: 663828

upgpkg: elasticsearch 7.8.0-1: Modernize package, build from source and update

Modified:
  elasticsearch/trunk/PKGBUILD
Deleted:
  elasticsearch/trunk/elasticsearch-env

-------------------+
 PKGBUILD          |   80 +++++++++++++++++++++++++++-------------------------
 elasticsearch-env |   67 -------------------------------------------
 2 files changed, 42 insertions(+), 105 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-07-15 02:14:55 UTC (rev 663827)
+++ PKGBUILD	2020-07-15 04:02:00 UTC (rev 663828)
@@ -3,16 +3,16 @@
 # Refactored by Blaž "Speed" Hrastnik <https://github.com/archSeer>
 
 pkgname=elasticsearch
-pkgver=7.7.0
-pkgrel=2
+pkgver=7.8.0
+pkgrel=1
 pkgdesc="Distributed RESTful search engine built on top of Lucene"
 arch=('x86_64')
 url="https://www.elastic.co/products/elasticsearch"
 license=('Apache')
-depends=('java-runtime-headless' 'systemd')
+depends=('java-runtime-headless' 'systemd' 'libxml2')
+makedepends=('java-environment=11' 'gradle')
 source=(
-  "https://artifacts.elastic.co/downloads/$pkgname/$pkgname-oss-$pkgver-x86_64.rpm"
-  elasticsearch-env
+  $pkgname-$pkgver.tar.gz::"https://github.com/elastic/elasticsearch/archive/v${pkgver}.tar.gz"
   elasticsearch.service
   elasticsearch at .service
   elasticsearch-keystore.service
@@ -22,8 +22,7 @@
   elasticsearch-tmpfile.conf
   elasticsearch.default
 )
-sha256sums=('df2ba7e1991dd26f3dc14aa0cf6a90b0567ca5988636ab2a70bc9a12f9a7f6ef'
-            'cf5a7723e029a1dea0e7c5891dd0694d4ec46b36525a1fdaa0be61b7d0ae40f5'
+sha256sums=('6a04dac8da32755f53962a34b85b7dac7593b2a544f5bccb50344b2b345b3944'
             '9e1f68ff275ef2b5f2b93d2823efc5cc9643da696fcbe09a3ea7520ada35ffba'
             '8a76ad9a44a34eca8d6cb7ec9d8f1b01d46c114765b0a76094de8d72f0477351'
             'bac40d87acaa5bee209ceb6dfa253009a072e9243fe3b94be42fb5cd44727d6f'
@@ -38,44 +37,49 @@
         'etc/elasticsearch/jvm.options'
         'etc/default/elasticsearch')
 
-prepare() {
-  cd "$srcdir"
-  find usr/share/elasticsearch/bin -type f ! -name \*.jar -exec \
-    sed -r 's;source .*/(.*)-env;source /usr/share/elasticsearch/\1-env;' -i {} +
-  find usr/share/elasticsearch/bin -type f -name "elasticsearch-*" ! -name elasticsearch-bin -exec \
-    sed 's/`dirname "$0"`/$(dirname "$(realpath "$0")")/' -i {} +
+build() {
+  cd $pkgname-$pkgver
+  export PATH=/usr/lib/jvm/java-11-openjdk/bin:$PATH
+  gradle assemble \
+      -x :distribution:docker:buildAarch64DockerImage \
+      -x :distribution:docker:buildAarch64OssDockerImage \
+      -x :distribution:docker:buildDockerImage \
+      -x :distribution:docker:buildOssDockerImage \
+      -x :distribution:docker:docker-export:exportDockerImage \
+      -x :distribution:docker:oss-docker-export:exportOssDockerImage
 }
 
 package() {
-  cd "$pkgdir"
-  install -dm2750 etc/elasticsearch
-  install -dm750 etc/elasticsearch/{scripts,jvm.options.d}
-  install -dm755 {usr/share,var/lib,var/log}/elasticsearch
-  install -dm755 usr/bin
+  cd $pkgname-$pkgver
 
-  cd "$srcdir"
-  find etc/elasticsearch/ -type f -exec \
-    install -Dm644 {} "$pkgdir/"{} \;
+  install -dm755 "$pkgdir"/{usr/share,var/lib,var/log}/elasticsearch
+  install -dm755 "$pkgdir"/usr/bin
 
-  cp -R usr/share/elasticsearch/{bin,lib,modules,plugins} "$pkgdir"/usr/share/elasticsearch
+  tar xf distribution/archives/linux-tar/build/distributions/elasticsearch-$pkgver-*linux-x86_64.tar.gz \
+      --strip 1 -C "$pkgdir"/usr/share/elasticsearch
+  rm -rf "$pkgdir"/usr/share/elasticsearch/jdk
 
-  cd "$pkgdir"/usr/share/elasticsearch
-  rm -rf bin/elasticsearch-env
+  install -dm755 "$pkgdir"/etc
+  mv "$pkgdir"/usr/share/elasticsearch/config "$pkgdir"/etc/elasticsearch
+  chmod 2750 "$pkgdir"/etc/elasticsearch
 
-  find bin/ -type f -name elasticsearch-\* ! -name elasticsearch-cli -exec \
-    ln -s ../share/elasticsearch/{} "$pkgdir"/usr/{} \;
+  for bin in "$pkgdir"/usr/share/elasticsearch/bin/*; do
+    ln -s /usr/share/elasticsearch/bin/$(basename $bin) "$pkgdir"/usr/bin/$(basename $bin)
+  done
 
-  ln -s ../../../var/log/elasticsearch logs
-  ln -s ../../../var/lib/elasticsearch data
+  ln -s /etc/elasticsearch "$pkgdir"/usr/share/elasticsearch/config
+  ln -s /var/log/elasticsearch "$pkgdir"/usr/share/elasticsearch/logs
+  ln -s /var/lib/elasticsearch "$pkgdir"/usr/share/elasticsearch/data
 
-  cd "$pkgdir"
-  install -Dm644 "$srcdir"/elasticsearch-env usr/share/elasticsearch/elasticsearch-env
-  install -Dm644 "$srcdir"/elasticsearch.service usr/lib/systemd/system/elasticsearch.service
-  install -Dm644 "$srcdir"/elasticsearch at .service usr/lib/systemd/system/elasticsearch at .service
-  install -Dm644 "$srcdir"/elasticsearch-keystore.service usr/lib/systemd/system/elasticsearch-keystore.service
-  install -Dm644 "$srcdir"/elasticsearch-keystore at .service usr/lib/systemd/system/elasticsearch-keystore at .service
-  install -Dm644 "$srcdir"/elasticsearch-user.conf usr/lib/sysusers.d/elasticsearch.conf
-  install -Dm644 "$srcdir"/elasticsearch-tmpfile.conf usr/lib/tmpfiles.d/elasticsearch.conf
-  install -Dm644 "$srcdir"/elasticsearch-sysctl.conf usr/lib/sysctl.d/elasticsearch.conf
-  install -Dm644 "$srcdir"/elasticsearch.default etc/default/elasticsearch
+  install -Dm644 "$srcdir"/elasticsearch.service "$pkgdir"/usr/lib/systemd/system/elasticsearch.service
+  install -Dm644 "$srcdir"/elasticsearch at .service "$pkgdir"/usr/lib/systemd/system/elasticsearch at .service
+  install -Dm644 "$srcdir"/elasticsearch-keystore.service "$pkgdir"/usr/lib/systemd/system/elasticsearch-keystore.service
+  install -Dm644 "$srcdir"/elasticsearch-keystore at .service "$pkgdir"/usr/lib/systemd/system/elasticsearch-keystore at .service
+  install -Dm644 "$srcdir"/elasticsearch-user.conf "$pkgdir"/usr/lib/sysusers.d/elasticsearch.conf
+  install -Dm644 "$srcdir"/elasticsearch-tmpfile.conf "$pkgdir"/usr/lib/tmpfiles.d/elasticsearch.conf
+  install -Dm644 "$srcdir"/elasticsearch-sysctl.conf "$pkgdir"/usr/lib/sysctl.d/elasticsearch.conf
+  install -Dm644 "$srcdir"/elasticsearch.default "$pkgdir"/etc/default/elasticsearch
+
+  sed -i '2iJAVA_HOME=/usr/lib/jvm/default-runtime' "$pkgdir"/usr/share/elasticsearch/bin/elasticsearch-env
+  sed -i 's/ES_BUNDLED_JDK=true/ES_BUNDLED_JDK=false/g' "$pkgdir"/usr/share/elasticsearch/bin/elasticsearch-env
 }

Deleted: elasticsearch-env
===================================================================
--- elasticsearch-env	2020-07-15 02:14:55 UTC (rev 663827)
+++ elasticsearch-env	2020-07-15 04:02:00 UTC (rev 663828)
@@ -1,67 +0,0 @@
-#!/bin/bash
-
-set -e -o pipefail
-
-JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/default-runtime}
-ES_HOME=/usr/share/elasticsearch
-
-# now set the classpath
-ES_CLASSPATH="$ES_HOME/lib/*"
-
-# now set the path to java
-if [ ! -z "$JAVA_HOME" ]; then
-  JAVA="$JAVA_HOME/bin/java"
-else
-  if [ "$(uname -s)" = "Darwin" ]; then
-    # OSX has a different structure
-    JAVA="$ES_HOME/jdk/Contents/Home/bin/java"
-  else
-    JAVA="$ES_HOME/jdk/bin/java"
-  fi
-fi
-
-if [ ! -x "$JAVA" ]; then
-  echo "could not find java in JAVA_HOME or bundled at $JAVA" >&2
-  exit 1
-fi
-
-# do not let JAVA_TOOL_OPTIONS slip in (as the JVM does by default)
-if [ ! -z "$JAVA_TOOL_OPTIONS" ]; then
-  echo "warning: ignoring JAVA_TOOL_OPTIONS=$JAVA_TOOL_OPTIONS"
-  unset JAVA_TOOL_OPTIONS
-fi
-
-# JAVA_OPTS is not a built-in JVM mechanism but some people think it is so we
-# warn them that we are not observing the value of $JAVA_OPTS
-if [ ! -z "$JAVA_OPTS" ]; then
-  echo -n "warning: ignoring JAVA_OPTS=$JAVA_OPTS; "
-  echo "pass JVM parameters via ES_JAVA_OPTS"
-fi
-
-if [[ "$("$JAVA" -version 2>/dev/null)" =~ "Unable to map CDS archive" ]]; then
-  XSHARE="-Xshare:off"
-else
-  XSHARE="-Xshare:auto"
-fi
-
-# check the Java version
-"$JAVA" "$XSHARE" -cp "$ES_CLASSPATH" org.elasticsearch.tools.java_version_checker.JavaVersionChecker
-
-export HOSTNAME=$HOSTNAME
-
-if [ -z "$ES_PATH_CONF" ]; then
-  ES_PATH_CONF=/etc/elasticsearch
-fi
-
-# now make ES_PATH_CONF absolute
-ES_PATH_CONF=`cd "$ES_PATH_CONF"; pwd`
-
-ES_DISTRIBUTION_FLAVOR=default
-ES_DISTRIBUTION_TYPE=rpm
-ES_BUNDLED_JDK=false
-
-if [ -z "$ES_TMPDIR" ]; then
-  ES_TMPDIR=`"$JAVA" -cp "$ES_CLASSPATH" org.elasticsearch.tools.launchers.TempDirectory`
-fi
-
-cd "$ES_HOME"


More information about the arch-commits mailing list