aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzongyu <zzy2529420793@gmail.com>2020-08-24 11:39:36 +0800
committerZhang Zongyu <zzy2529420793@gmail.com>2020-08-27 14:22:35 +0800
commitecd495b383dc06f1193c22c172b05660f70ddb83 (patch)
treec299a74b18f0ad5a229dc6ab9a1eee416a6621ef
parentupdate scripts.new/* to make use of 'hprefixify' (diff)
downloadjava-ebuilder-ecd495b383dc06f1193c22c172b05660f70ddb83.tar.gz
java-ebuilder-ecd495b383dc06f1193c22c172b05660f70ddb83.tar.bz2
java-ebuilder-ecd495b383dc06f1193c22c172b05660f70ddb83.zip
migrate scripts from scripts.new/ to scripts/
Signed-off-by: zongyu <zzy2529420793@gmail.com>
-rwxr-xr-xscripts.new/movl43
-rwxr-xr-xscripts/bin/compare-maven-version (renamed from scripts.new/bin/compare-maven-version)0
-rwxr-xr-xscripts/bin/fill-cache (renamed from scripts.new/bin/fill-cache)0
-rwxr-xr-xscripts/bin/simple-xml-formatter (renamed from scripts.new/bin/simple-xml-formatter)0
-rwxr-xr-xscripts/bin/tree-wrapper.sh (renamed from scripts.new/bin/tree-wrapper.sh)2
-rwxr-xr-xscripts/bin/tree.sh (renamed from scripts.new/bin/tree.sh)4
-rwxr-xr-xscripts/meta.sh121
-rwxr-xr-xscripts/movl123
-rw-r--r--scripts/resources/Makefiles/Makefile (renamed from scripts.new/resources/Makefiles/Makefile)0
-rw-r--r--scripts/resources/Makefiles/cache.mk (renamed from scripts.new/resources/Makefiles/cache.mk)0
-rw-r--r--scripts/resources/Makefiles/environment.mk (renamed from scripts.new/resources/Makefiles/environment.mk)0
-rw-r--r--scripts/resources/Makefiles/stage1.mk (renamed from scripts.new/resources/Makefiles/stage1.mk)8
-rw-r--r--scripts/resources/Makefiles/stage2.mk (renamed from scripts.new/resources/Makefiles/stage2.mk)0
-rw-r--r--scripts/resources/resources/LUT (renamed from scripts.new/resources/resources/LUT)24
-rwxr-xr-xscripts/tree.sh145
15 files changed, 44 insertions, 426 deletions
diff --git a/scripts.new/movl b/scripts.new/movl
deleted file mode 100755
index 793eea9..0000000
--- a/scripts.new/movl
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-[[ ${CONFIG} ]] && CONFIG=$(printf "%q\n" "$(realpath "${CONFIG}")")
-export PATH="${PATH}:/usr/lib/java-ebuilder/bin"
-export EROOT=$(dirname /etc)
-
-if [[ $# -gt 0 ]]; then
- if [[ "$1" == "-h" || "$1" == "--help" ]]; then
- echo This is a helper to automagically generate ebuild for
- echo Maven artifacts defined in ${EROOT}/etc/java-ebuilder.conf
- echo
- echo Usage: movl [options] [target] ...
- echo Options: please refer to \`make -h\`
- echo Targets:
- echo " all alias for stage2 and post-stage2"
- echo " build alias for stage2 and post-stage2"
- echo " stage1 resolve the dependency graph of the provided Maven artifact"
- echo " stage2 generate ebuild files of the whole dep graph"
- echo " force-stage2 force generate stage2 ebuild files"
- echo " post-stage2 generate digests for ebuilds"
- echo " clean-cache remove cache files"
- echo " clean-stage1 remove stage1-related stuffs"
- echo " clean-stage2 remove stage2-related stuffs"
- echo " clean remove all the generated stuffs"
- echo "Bash Variables:"
- echo " CONFIG path to the config file"
- echo " default: ${EROOT}/etc/java-ebuilder.conf"
- echo " DEFAULT_CATEGORY the default category of the generated ebuilds"
- echo " default: app-maven"
- echo " MAVEN_NODEP set this variable to stop tree.sh from recursively resolving"
- echo " the dependencies of MAVEN_ARTS"
- echo " REPOSITORY where to find the pom and jar files"
- echo " default: https://repo1.maven.org/maven2"
- echo " TSH_NODEBUG set this variable to make \`movl build\` more silent"
- exit
- fi
-else
- movl -h
- exit 0
-fi
-
-cd "${EROOT}/usr/lib/java-ebuilder/Makefiles"
-make $@
-
diff --git a/scripts.new/bin/compare-maven-version b/scripts/bin/compare-maven-version
index de0ab47..de0ab47 100755
--- a/scripts.new/bin/compare-maven-version
+++ b/scripts/bin/compare-maven-version
diff --git a/scripts.new/bin/fill-cache b/scripts/bin/fill-cache
index ebb8bf9..ebb8bf9 100755
--- a/scripts.new/bin/fill-cache
+++ b/scripts/bin/fill-cache
diff --git a/scripts.new/bin/simple-xml-formatter b/scripts/bin/simple-xml-formatter
index 410ead7..410ead7 100755
--- a/scripts.new/bin/simple-xml-formatter
+++ b/scripts/bin/simple-xml-formatter
diff --git a/scripts.new/bin/tree-wrapper.sh b/scripts/bin/tree-wrapper.sh
index 259bf3f..6b29286 100755
--- a/scripts.new/bin/tree-wrapper.sh
+++ b/scripts/bin/tree-wrapper.sh
@@ -11,7 +11,7 @@ mkdir -p "${POMDIR}"
mkdir -p "${CUR_STAGE_DIR}"
for artifact in $MAVEN_ARTS; do
- $TSH $artifact
+ "$TSH" $artifact
if [[ $? -ne 0 ]]; then
echo [!] While processing $artifact, TSH returned an error
exit 1
diff --git a/scripts.new/bin/tree.sh b/scripts/bin/tree.sh
index 00eb870..69dfbd6 100755
--- a/scripts.new/bin/tree.sh
+++ b/scripts/bin/tree.sh
@@ -185,7 +185,7 @@ gebd() {
# generate ebuild file if it does not exist
if [[ ! -f "${cur_stage_ebd}" ]]; then
- mkdir -p $(dirname ${cur_stage_ebd})
+ mkdir -p "$(dirname "${cur_stage_ebd}")"
tsh_log "java-ebuilder: generage ebuild files for ${MID} in ${CUR_STAGE}"
java-ebuilder -p "${POMDIR}"/${M}.pom -e "${cur_stage_ebd}" -g --workdir "${POMDIR}" \
-u ${SRC_URI} --slot ${SLOT:-0} --keywords ~amd64 \
@@ -232,7 +232,7 @@ gebd() {
[[ -z "${MAVEN_NODEP}" ]] && MAKEFILE_DEP=1 mfill "${cur_stage_ebd}"
target_line+="\n"
- target_line+="\tmkdir -p $(dirname ${final_stage_ebd})\n"
+ target_line+="\tmkdir -p \"$(dirname "${final_stage_ebd}")\"\n"
target_line+="\tjava-ebuilder -p \"${POMDIR}\"/${M}.pom -e \"${final_stage_ebd}\" -g --workdir \"${POMDIR}\""
target_line+=" -u ${SRC_URI} --slot ${SLOT:-0} --keywords ~amd64"
target_line+=" --cache-file \"${CACHEDIR}\"/post-${CUR_STAGE}-cache"
diff --git a/scripts/meta.sh b/scripts/meta.sh
deleted file mode 100755
index 4bd16ba..0000000
--- a/scripts/meta.sh
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/bin/bash
-# read in cache from java-ebuilder and find out the groupId,
-# artifactId and version.
-
-# example:
-# ( echo 1.0; tail -n +2 cache | parallel -j -2 meta.sh; ) > cache.1
-source /etc/java-ebuilder.conf
-: ${PORTAGE_TMPDIR:=$(portageq envvar PORTAGE_TMPDIR)}
-
-pkg=$(awk -F ":" '{print $1"/"$2"-"$3}' <<< $1)
-spkg=$(cut -d: -f2 <<< $1)
-sver=$(cut -d: -f3 <<< $1)
-case ${spkg} in
- guava)
- echo $1:com.google.guava:${spkg}:${sver%%-*}
- exit 0
- ;;
- json|jmock)
- echo $1:org.${spkg}:${spkg}:${sver%%-*}
- exit 0
- ;;
- hamcrest-*)
- echo $1:org.${spkg%%-*}:${spkg}:${sver%%-*}
- exit 0
- ;;
- xerces)
- echo $1:xerces:${spkg}:${sver%%-*}
- echo $1:xerces:xercesImpl:${sver%%-*}
- echo $1:xerces:xmlParserAPIs:${sver%%-*}
- exit 0
- ;;
- commons-*|classworlds|jdom|xalan*)
- echo $1:${spkg}:${spkg}:${sver%%-*}
- exit 0
- ;;
- javax-inject)
- spkg=${spkg/-/.}
- echo $1:${spkg}:${spkg}:${sver%%-*}
- exit 0
- ;;
- velocity)
- echo $1:org.apache.${spkg}:${spkg}:${sver%%-*}
- exit 0
- ;;
- jtidy)
- echo $1:net.sf.${spkg}:${spkg}:${sver%%-*}
- exit 0
- ;;
- saxpath)
- echo $1:${spkg}:${spkg}:${sver%%-*}-FCS # maven version
- echo $1:org.jdom:${spkg}:${sver%%-*}-FCS
- exit 0
- ;;
- ant*)
- [[ ${spkg} = ant-core ]] && { spkg=ant; echo $1:ant:${spkg}:${sver%%-*}; }
- [[ ${spkg} = ant-ivy ]] && spkg=ivy
- echo $1:org.apache.ant:${spkg}:${sver%%-*}
- exit 0
- ;;
- bcpg|bcprov)
- echo $1:org.bouncycastle:${spkg}-jdk12:130
- for jv in 1{4,5,6}; do
- echo $1:org.bouncycastle:${spkg}-jdk${jv}:${sver%%-*}
- done
- exit 0
- ;;
- asm)
- echo $1:org.ow2.asm:${spkg}:${sver%%-*}
- echo $1:org.ow2.asm:${spkg}-all:${sver%%-*}
- echo $1:org.ow2.asm:${spkg}-debug-all:${sver%%-*}
- exit 0
- ;;
- cofoja)
- echo $1:org.huoc:${spkg}:${sver%%-*}
- exit 0
- ;;
- scala)
- echo $1:org.scala-lang:${spkg}-compiler:${sver%%-*}
- exit 0
- ;;
-esac
-
-touch bebd bpom
-grep -q ${pkg} <bebd <bpom && exit 0
-
-ebd=$(equery w ${pkg} 2>/dev/null)
-if [[ -z "${ebd}" ]]; then
- echo $1:${pkg} >> bebd
- exit 0
-fi
-
-# java-utils-2.eclass:java-pkg_needs-vm()
-export JAVA_PKG_NV_DEPEND="nothing"
-
-if ! ebuild "${ebd}" unpack >/dev/null 2>&1; then
- echo $1:${pkg} >> bebd
- exit 0
-fi
-
-bad_pom="yes"
-for subd in "${PORTAGE_TMPDIR}"/portage/${pkg}/work/*; do
- [[ -f ${subd}/pom.xml ]] || continue
- bad_pom=""
- pushd ${subd} > /dev/null
- poms=$(mvn -q --also-make exec:exec -Dexec.executable="pwd" 2> /dev/null | grep ^/)
- popd > /dev/null
- for pd in ${poms}; do
- ppom=$(xml2 < ${pd}/pom.xml | egrep '(groupId|artifactId|version)=')
- PG=$(echo "${ppom}" | sed -n -r -e 's,/project/groupId=(.*),\1,p')
- [[ -z ${PG} ]] && PG=$(echo "${ppom}" | sed -n -r -e 's,/project/parent/groupId=(.*),\1,p')
- PA=$(echo "${ppom}" | sed -n -r -e 's,/project/artifactId=(.*),\1,p')
- PV=$(echo "${ppom}" | sed -n -r -e 's,/project/version=(.*),\1,p')
- [[ -z ${PV} ]] && PV=$(echo "${ppom}" | sed -n -r -e 's,/project/parent/version=(.*),\1,p')
- echo $1:${PG}:${PA}:${PV/-SNAPSHOT/}
- done
-done
-if [[ -n "${bad_pom}" ]]; then
- echo $1:${pkg} >> bpom
-fi
-
-ebuild "${ebd}" clean >/dev/null 2>&1
diff --git a/scripts/movl b/scripts/movl
index efc31c7..793eea9 100755
--- a/scripts/movl
+++ b/scripts/movl
@@ -1,92 +1,43 @@
#!/bin/bash
-source "/etc/java-ebuilder.conf"
-tsh="/usr/lib/java-ebuilder/tree.sh"
-
-clean-maven() {
- rm -f "${CACHEDIR}"/maven-cache
- rm -rf "${MAVEN_OVERLAY_DIR}"/app-maven
-}
-
-clean-pom() {
- rm -f "${POMDIR}"/*.pom
-}
-
-clean-cache() {
- rm -f "${CACHEDIR}"/cache.{raw,}{0,1}
- rm -f "${CACHEDIR}"/b{ebd,pom}
-}
-
-clean() {
- clean-cache
- clean-pom
- clean-maven
-}
-
-rrdep() {
- # regenerate reverse dependencies
- for rdep in $(egrep -l "$1.*->" -r "${MAVEN_OVERLAY_DIR}"/app-maven); do
- [[ ${rdep} = *.ebuild ]] && "${tsh}" ${rdep}
- done
-}
-
-refresh() {
- if [[ $1=*:* ]]; then
- rrdep $1
- else
- # input: package name
- for ebd in "${MAVEN_OVERLAY_DIR}"/app-maven/$1/*.ebuild; do
- mid=$(sed -nr 's,^MAVEN_ID="(.*)",\1,p' "${ebd}")
- rm "${ebd}"; "${tsh}" ${mid}
- sed "/${mid}/d" -i "${CACHEDIR}"/maven-cache
- rrdep ${mid}
- done
- fi
-}
-
-build() {
- : ${PORTDIR:=$(portageq get_repo_path $(portageq envvar EROOT) gentoo)}
- : ${PORTAGE_TMPDIR:=$(portageq envvar PORTAGE_TMPDIR)}
- export PORTAGE_TMPDIR
-
- if [[ ! -f "${CACHEDIR}"/cache.0 ]]; then
- # 1. Generate cache of java related packages from portage tree.
- [[ -f "${CACHEDIR}"/cache.raw0 ]] || \
- java-ebuilder --refresh-cache -t "${PORTDIR}" --cache-file "${CACHEDIR}"/cache.raw0
-
- # 2. Find corresponding maven groupId, artifactId and version in the cache.
- pushd "${CACHEDIR}" > /dev/null
- ( echo 1.0; tail -n +2 cache.raw0 | parallel -j -1 /usr/lib/java-ebuilder/meta.sh; ) > cache.0
- popd > /dev/null
- fi
-
- # do the same to java overlay
- if [[ ! -f "${CACHEDIR}"/cache.1 ]]; then
- if [[ -n "${JAVA_OVERLAY_DIR}" ]]; then
- [[ -f "${CACHEDIR}"/cache.raw1 ]] || \
- java-ebuilder --refresh-cache -t "${JAVA_OVERLAY_DIR}" --cache-file "${CACHEDIR}"/cache.raw1
- pushd "${CACHEDIR}" > /dev/null
- tail -n +2 cache.raw1 | parallel -j -1 /usr/lib/java-ebuilder/meta.sh > cache.1
- popd > /dev/null
- else
- touch "${CACHEDIR}"/cache.1
- fi
- fi
-
- for M in ${MAVEN_ARTS}; do
- "${tsh}" ${M}
- done
-
- cd "${MAVEN_OVERLAY_DIR}"/app-maven
- parallel ebuild '$(echo {}/*.ebuild | cut -d\ -f1)' digest ::: *
-}
+[[ ${CONFIG} ]] && CONFIG=$(printf "%q\n" "$(realpath "${CONFIG}")")
+export PATH="${PATH}:/usr/lib/java-ebuilder/bin"
+export EROOT=$(dirname /etc)
if [[ $# -gt 0 ]]; then
- funcs=$1
- shift 1
+ if [[ "$1" == "-h" || "$1" == "--help" ]]; then
+ echo This is a helper to automagically generate ebuild for
+ echo Maven artifacts defined in ${EROOT}/etc/java-ebuilder.conf
+ echo
+ echo Usage: movl [options] [target] ...
+ echo Options: please refer to \`make -h\`
+ echo Targets:
+ echo " all alias for stage2 and post-stage2"
+ echo " build alias for stage2 and post-stage2"
+ echo " stage1 resolve the dependency graph of the provided Maven artifact"
+ echo " stage2 generate ebuild files of the whole dep graph"
+ echo " force-stage2 force generate stage2 ebuild files"
+ echo " post-stage2 generate digests for ebuilds"
+ echo " clean-cache remove cache files"
+ echo " clean-stage1 remove stage1-related stuffs"
+ echo " clean-stage2 remove stage2-related stuffs"
+ echo " clean remove all the generated stuffs"
+ echo "Bash Variables:"
+ echo " CONFIG path to the config file"
+ echo " default: ${EROOT}/etc/java-ebuilder.conf"
+ echo " DEFAULT_CATEGORY the default category of the generated ebuilds"
+ echo " default: app-maven"
+ echo " MAVEN_NODEP set this variable to stop tree.sh from recursively resolving"
+ echo " the dependencies of MAVEN_ARTS"
+ echo " REPOSITORY where to find the pom and jar files"
+ echo " default: https://repo1.maven.org/maven2"
+ echo " TSH_NODEBUG set this variable to make \`movl build\` more silent"
+ exit
+ fi
else
- funcs=build
+ movl -h
+ exit 0
fi
-for func in ${funcs}; do
- ${func} $@
-done
+cd "${EROOT}/usr/lib/java-ebuilder/Makefiles"
+make $@
+
diff --git a/scripts.new/resources/Makefiles/Makefile b/scripts/resources/Makefiles/Makefile
index 26e00a1..26e00a1 100644
--- a/scripts.new/resources/Makefiles/Makefile
+++ b/scripts/resources/Makefiles/Makefile
diff --git a/scripts.new/resources/Makefiles/cache.mk b/scripts/resources/Makefiles/cache.mk
index a2d7a29..a2d7a29 100644
--- a/scripts.new/resources/Makefiles/cache.mk
+++ b/scripts/resources/Makefiles/cache.mk
diff --git a/scripts.new/resources/Makefiles/environment.mk b/scripts/resources/Makefiles/environment.mk
index d583cb8..d583cb8 100644
--- a/scripts.new/resources/Makefiles/environment.mk
+++ b/scripts/resources/Makefiles/environment.mk
diff --git a/scripts.new/resources/Makefiles/stage1.mk b/scripts/resources/Makefiles/stage1.mk
index eeaa4d3..363bf4e 100644
--- a/scripts.new/resources/Makefiles/stage1.mk
+++ b/scripts/resources/Makefiles/stage1.mk
@@ -3,13 +3,13 @@
${STAGE2_MAKEFILE}: ${PRE_STAGE1_CACHE}
mkdir -p ${STAGE1_DIR}
- mkdir -p $(shell dirname $@)
- CUR_STAGE_DIR="${STAGE1_DIR}" CUR_STAGE=stage1\
+ mkdir -p "$(shell dirname "$@")"
+ CUR_STAGE_DIR="$(shell echo ${STAGE1_DIR})" CUR_STAGE=stage1\
CACHE_TIMESTAMP="$(shell echo ${CACHE_TIMESTAMP})"\
GENTOO_CACHE="$(shell echo ${PRE_STAGE1_CACHE})"\
TARGET_MAKEFILE="$@"\
- TSH="${TSH}" CONFIG="${CONFIG}"\
- "${TSH_WRAPPER}"
+ TSH=${TSH} CONFIG=${CONFIG}\
+ ${TSH_WRAPPER}
touch "$@"
stage1: ${STAGE2_MAKEFILE}
diff --git a/scripts.new/resources/Makefiles/stage2.mk b/scripts/resources/Makefiles/stage2.mk
index 764bc5c..764bc5c 100644
--- a/scripts.new/resources/Makefiles/stage2.mk
+++ b/scripts/resources/Makefiles/stage2.mk
diff --git a/scripts.new/resources/resources/LUT b/scripts/resources/resources/LUT
index 3c471f3..0a4f02e 100644
--- a/scripts.new/resources/resources/LUT
+++ b/scripts/resources/resources/LUT
@@ -38,31 +38,7 @@
"0": [
[
"org.codehaus.mojo",
- "animal-sniffer"
- ],
- [
- "org.codehaus.mojo",
"animal-sniffer-annotations"
- ],
- [
- "org.codehaus.mojo",
- "animal-sniffer-ant-tasks"
- ],
- [
- "org.codehaus.mojo",
- "animal-sniffer-enforcer-rule"
- ],
- [
- "org.codehaus.mojo",
- "animal-sniffer-maven-plugin"
- ],
- [
- "org.codehaus.mojo",
- "animal-sniffer-parent"
- ],
- [
- "org.codehaus.mojo",
- "java-boot-classpath-detector"
]
]
},
diff --git a/scripts/tree.sh b/scripts/tree.sh
deleted file mode 100755
index 6bb7cc5..0000000
--- a/scripts/tree.sh
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/bin/bash
-# start from the root of a maven artifact and recursively resolve its
-# dependencies.
-
-source /etc/java-ebuilder.conf
-
-mkdir -p "${POMDIR}"
-
-sver() {
- PV=$1
- # com.github.lindenb:jbwa:1.0.0_ppc64
- PV=${PV/_/.}
- # plexus-container-default 1.0-alpha-9-stable-1
- PV=${PV/-stable-/.}
- PV=$(sed -r 's/[.-]?alpha[-.]?/_alpha/' <<< ${PV})
- # wagon-provider-api 1.0-beta-7
- # com.google.cloud.datastore:datastore-v1beta3-proto-client:1.0.0-beta.2
- # com.google.cloud.datastore:datastore-v1beta3-protos:1.0.0-beta
- PV=$(sed -r 's/[.-]?beta[-.]?/_beta/' <<< ${PV})
- # aopalliance-repackaged 2.5.0-b16
- PV=${PV/-b/_beta}
- # com.google.auto.service:auto-service:1.0-rc2
- PV=${PV/-rc/_rc}
- # cdi-api 1.0-SP4
- PV=${PV/-SP/_p}
- # org.seqdoop:cofoja:1.1-r150
- PV=${PV/-rev/_p}
- PV=${PV/-r/_p}
- PV=${PV/.v/_p}
- # javax.xml.stream:stax-api:1.0-2
- PV=${PV//-/.}
- # .Final .GA -incubating means nothing
- PV=${PV%.[a-zA-Z]*}
- # com.google.cloud.genomics:google-genomics-dataflow:v1beta2-0.15 -> 1.2.0.15
- # plexus-container-default 1.0-alpha-9-stable-1 -> 1.0.9.1
- while [[ ${PV} != ${PV0} ]]; do
- PV0=${PV}
- PV=$(sed -r 's/_(rc|beta|alpha|p)(.*\..*)/.\2/' <<< ${PV0})
- done
- # remove all non-numeric charactors before _
- # org.scalamacros:quasiquotes_2.10:2.0.0-M8
- if [[ ${PV} = *_* ]]; then
- echo $(sed 's/[^.0-9]//g' <<< ${PV/_*/})_${PV/*_/}
- else
- sed 's/[^.0-9]//g' <<< ${PV}
- fi
-}
-
-gebd() {
- case ${MA} in
- weld-osgi-bundle)
- # 1.1.0.Final no longer exist
- [[ ${MV} = 1.1.0.Final ]] && MV=1.1.33.Final
- ;;
- esac
-
- local WORKDIR=${PG//./\/}/${MA} MID
- local MID=${PG}:${MA}:${MV}
- local PV=$(sver ${MV}) PA SLOT
-
- case ${MA} in
- opengl-api)
- [[ ${MV} = 2.1.1 ]] && MV=gl1.1-android-2.1_r1
- ;;
- esac
-
- # spark-launcher_2.11 for scala 2.11
- eval $(sed -nr 's,([^_]*)(_(.*))?,PA=\1 SLOT=\3,p' <<< ${MA})
- [[ -z "${SLOT}" ]] && eval $(sed -nr 's,(.*)-(([0-9]+\.)?[0-9]+),PA=\1 SLOT=\2,p' <<< ${MA})
- [[ -z "${SLOT}" ]] && PA=${MA}
- PA=${PA//./-}
- PA=${PA//_/-}
-
- local M=${MA}-${MV}
- local SRC_URI="https://repo.maven.apache.org/maven2/${WORKDIR}/${MV}/${M}-sources.jar"
-
- if [[ ! -f "${POMDIR}"/${M}.pom ]]; then
- pushd "${POMDIR}" > /dev/null
- wget ${SRC_URI/-sources.jar/.pom}
-
- # 3rd party plugin not needed here
- # distributionManagement is invalid for maven 3
- # net.sf.jtidy:jtidy:r938 version is not maven-compliant
- sed -e '/<packaging>bundle/d' \
- -e '/<distributionManagement>/,/<\/distributionManagement>/d' \
- -e '/<build>/,/<\/build>/d' \
- -e '/<modules>/,/<\/modules>/d' \
- -e 's,<version>r938</version>,<version>1.0</version>,' \
- -i ${M}.pom
- popd
- fi
-
- if ! wget -q --spider ${SRC_URI}; then
- SRC_URI=${SRC_URI/-sources.jar/.jar}
- PA=${PA}-bin
- fi
- local P=${PA}-${PV}
- local ebd="${MAVEN_OVERLAY_DIR}"/app-maven/${PA}/${P}.ebuild
-
- line=app-maven:${PA}:${PV}:${SLOT:-0}::${MID}
- if ! grep -q ${line} "${CACHEDIR}"/maven-cache 2>/dev/null ; then
- pushd "${CACHEDIR}" > /dev/null
- echo ${line} >> maven-cache
- cat cache.{0,1} maven-cache > cache
- popd > /dev/null
- fi
-
- if [[ ! -f "${ebd}" ]]; then
- mkdir -p $(dirname ${ebd})
- java-ebuilder -p "${POMDIR}"/${M}.pom -e "${ebd}" -g --workdir . \
- -u ${SRC_URI} --slot ${SLOT:-0} --keywords ~amd64 \
- --cache-file "${CACHEDIR}"/cache
- fi
-
- if [[ -z "${MAVEN_NODEP}" ]] && mfill "${ebd}"; then
- java-ebuilder -p "${POMDIR}"/${M}.pom -e "${ebd}" -g --workdir . \
- -u ${SRC_URI} --slot ${SLOT:-0} --keywords ~amd64 \
- --cache-file "${CACHEDIR}"/cache
- fi
-
- [[ ${SRC_URI} = *-sources.jar ]] || sed -i "/inherit/s/java-pkg-simple/java-pkg-binjar/" "${ebd}"
-}
-
-mfill() {
- # recursively fill missing dependencies
- arts=$(sed -n -r 's,# (test\? )?(.*)-> !!!.*-not-found!!!,\2,p' < $1)
- if [[ -z "${arts}" ]]; then
- false # no need to java-ebuilder again
- else
- for a in ${arts}; do
- eval $(awk -F":" '{print "PG="$1, "MA="$2, "MV="$3}' <<< ${a})
- gebd
- done
- return
- fi
-}
-
-if [[ $1 == *.ebuild ]]; then
- eval $(grep MAVEN_ID $1)
- rm -f $1
-else
- MAVEN_ID=$1
-fi
-eval $(awk -F":" '{print "PG="$1, "MA="$2, "MV="$3}' <<< ${MAVEN_ID})
-gebd