Gentoo Archives: gentoo-commits

From: "Miroslav Šulc" <fordfrog@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/java-ebuilder:master commit in: scripts/, scripts.new/, scripts.new/resources/Makefiles/, scripts.new/bin/, ...
Date: Thu, 27 Aug 2020 17:24:15
Message-Id: 1598509355.ecd495b383dc06f1193c22c172b05660f70ddb83.fordfrog@gentoo
1 commit: ecd495b383dc06f1193c22c172b05660f70ddb83
2 Author: zongyu <zzy2529420793 <AT> gmail <DOT> com>
3 AuthorDate: Mon Aug 24 03:39:36 2020 +0000
4 Commit: Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 27 06:22:35 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=ecd495b3
7
8 migrate scripts from scripts.new/ to scripts/
9
10 Signed-off-by: zongyu <zzy2529420793 <AT> gmail.com>
11
12 scripts.new/movl | 43 ------
13 {scripts.new => scripts}/bin/compare-maven-version | 0
14 {scripts.new => scripts}/bin/fill-cache | 0
15 {scripts.new => scripts}/bin/simple-xml-formatter | 0
16 {scripts.new => scripts}/bin/tree-wrapper.sh | 2 +-
17 {scripts.new => scripts}/bin/tree.sh | 4 +-
18 scripts/meta.sh | 121 -----------------
19 scripts/movl | 123 ++++++-----------
20 .../resources/Makefiles/Makefile | 0
21 .../resources/Makefiles/cache.mk | 0
22 .../resources/Makefiles/environment.mk | 0
23 .../resources/Makefiles/stage1.mk | 8 +-
24 .../resources/Makefiles/stage2.mk | 0
25 {scripts.new => scripts}/resources/resources/LUT | 24 ----
26 scripts/tree.sh | 145 ---------------------
27 15 files changed, 44 insertions(+), 426 deletions(-)
28
29 diff --git a/scripts.new/movl b/scripts.new/movl
30 deleted file mode 100755
31 index 793eea9..0000000
32 --- a/scripts.new/movl
33 +++ /dev/null
34 @@ -1,43 +0,0 @@
35 -#!/bin/bash
36 -[[ ${CONFIG} ]] && CONFIG=$(printf "%q\n" "$(realpath "${CONFIG}")")
37 -export PATH="${PATH}:/usr/lib/java-ebuilder/bin"
38 -export EROOT=$(dirname /etc)
39 -
40 -if [[ $# -gt 0 ]]; then
41 - if [[ "$1" == "-h" || "$1" == "--help" ]]; then
42 - echo This is a helper to automagically generate ebuild for
43 - echo Maven artifacts defined in ${EROOT}/etc/java-ebuilder.conf
44 - echo
45 - echo Usage: movl [options] [target] ...
46 - echo Options: please refer to \`make -h\`
47 - echo Targets:
48 - echo " all alias for stage2 and post-stage2"
49 - echo " build alias for stage2 and post-stage2"
50 - echo " stage1 resolve the dependency graph of the provided Maven artifact"
51 - echo " stage2 generate ebuild files of the whole dep graph"
52 - echo " force-stage2 force generate stage2 ebuild files"
53 - echo " post-stage2 generate digests for ebuilds"
54 - echo " clean-cache remove cache files"
55 - echo " clean-stage1 remove stage1-related stuffs"
56 - echo " clean-stage2 remove stage2-related stuffs"
57 - echo " clean remove all the generated stuffs"
58 - echo "Bash Variables:"
59 - echo " CONFIG path to the config file"
60 - echo " default: ${EROOT}/etc/java-ebuilder.conf"
61 - echo " DEFAULT_CATEGORY the default category of the generated ebuilds"
62 - echo " default: app-maven"
63 - echo " MAVEN_NODEP set this variable to stop tree.sh from recursively resolving"
64 - echo " the dependencies of MAVEN_ARTS"
65 - echo " REPOSITORY where to find the pom and jar files"
66 - echo " default: https://repo1.maven.org/maven2"
67 - echo " TSH_NODEBUG set this variable to make \`movl build\` more silent"
68 - exit
69 - fi
70 -else
71 - movl -h
72 - exit 0
73 -fi
74 -
75 -cd "${EROOT}/usr/lib/java-ebuilder/Makefiles"
76 -make $@
77 -
78
79 diff --git a/scripts.new/bin/compare-maven-version b/scripts/bin/compare-maven-version
80 similarity index 100%
81 rename from scripts.new/bin/compare-maven-version
82 rename to scripts/bin/compare-maven-version
83
84 diff --git a/scripts.new/bin/fill-cache b/scripts/bin/fill-cache
85 similarity index 100%
86 rename from scripts.new/bin/fill-cache
87 rename to scripts/bin/fill-cache
88
89 diff --git a/scripts.new/bin/simple-xml-formatter b/scripts/bin/simple-xml-formatter
90 similarity index 100%
91 rename from scripts.new/bin/simple-xml-formatter
92 rename to scripts/bin/simple-xml-formatter
93
94 diff --git a/scripts.new/bin/tree-wrapper.sh b/scripts/bin/tree-wrapper.sh
95 similarity index 94%
96 rename from scripts.new/bin/tree-wrapper.sh
97 rename to scripts/bin/tree-wrapper.sh
98 index 259bf3f..6b29286 100755
99 --- a/scripts.new/bin/tree-wrapper.sh
100 +++ b/scripts/bin/tree-wrapper.sh
101 @@ -11,7 +11,7 @@ mkdir -p "${POMDIR}"
102 mkdir -p "${CUR_STAGE_DIR}"
103
104 for artifact in $MAVEN_ARTS; do
105 - $TSH $artifact
106 + "$TSH" $artifact
107 if [[ $? -ne 0 ]]; then
108 echo [!] While processing $artifact, TSH returned an error
109 exit 1
110
111 diff --git a/scripts.new/bin/tree.sh b/scripts/bin/tree.sh
112 similarity index 98%
113 rename from scripts.new/bin/tree.sh
114 rename to scripts/bin/tree.sh
115 index 00eb870..69dfbd6 100755
116 --- a/scripts.new/bin/tree.sh
117 +++ b/scripts/bin/tree.sh
118 @@ -185,7 +185,7 @@ gebd() {
119
120 # generate ebuild file if it does not exist
121 if [[ ! -f "${cur_stage_ebd}" ]]; then
122 - mkdir -p $(dirname ${cur_stage_ebd})
123 + mkdir -p "$(dirname "${cur_stage_ebd}")"
124 tsh_log "java-ebuilder: generage ebuild files for ${MID} in ${CUR_STAGE}"
125 java-ebuilder -p "${POMDIR}"/${M}.pom -e "${cur_stage_ebd}" -g --workdir "${POMDIR}" \
126 -u ${SRC_URI} --slot ${SLOT:-0} --keywords ~amd64 \
127 @@ -232,7 +232,7 @@ gebd() {
128 [[ -z "${MAVEN_NODEP}" ]] && MAKEFILE_DEP=1 mfill "${cur_stage_ebd}"
129
130 target_line+="\n"
131 - target_line+="\tmkdir -p $(dirname ${final_stage_ebd})\n"
132 + target_line+="\tmkdir -p \"$(dirname "${final_stage_ebd}")\"\n"
133 target_line+="\tjava-ebuilder -p \"${POMDIR}\"/${M}.pom -e \"${final_stage_ebd}\" -g --workdir \"${POMDIR}\""
134 target_line+=" -u ${SRC_URI} --slot ${SLOT:-0} --keywords ~amd64"
135 target_line+=" --cache-file \"${CACHEDIR}\"/post-${CUR_STAGE}-cache"
136
137 diff --git a/scripts/meta.sh b/scripts/meta.sh
138 deleted file mode 100755
139 index 4bd16ba..0000000
140 --- a/scripts/meta.sh
141 +++ /dev/null
142 @@ -1,121 +0,0 @@
143 -#!/bin/bash
144 -# read in cache from java-ebuilder and find out the groupId,
145 -# artifactId and version.
146 -
147 -# example:
148 -# ( echo 1.0; tail -n +2 cache | parallel -j -2 meta.sh; ) > cache.1
149 -source /etc/java-ebuilder.conf
150 -: ${PORTAGE_TMPDIR:=$(portageq envvar PORTAGE_TMPDIR)}
151 -
152 -pkg=$(awk -F ":" '{print $1"/"$2"-"$3}' <<< $1)
153 -spkg=$(cut -d: -f2 <<< $1)
154 -sver=$(cut -d: -f3 <<< $1)
155 -case ${spkg} in
156 - guava)
157 - echo $1:com.google.guava:${spkg}:${sver%%-*}
158 - exit 0
159 - ;;
160 - json|jmock)
161 - echo $1:org.${spkg}:${spkg}:${sver%%-*}
162 - exit 0
163 - ;;
164 - hamcrest-*)
165 - echo $1:org.${spkg%%-*}:${spkg}:${sver%%-*}
166 - exit 0
167 - ;;
168 - xerces)
169 - echo $1:xerces:${spkg}:${sver%%-*}
170 - echo $1:xerces:xercesImpl:${sver%%-*}
171 - echo $1:xerces:xmlParserAPIs:${sver%%-*}
172 - exit 0
173 - ;;
174 - commons-*|classworlds|jdom|xalan*)
175 - echo $1:${spkg}:${spkg}:${sver%%-*}
176 - exit 0
177 - ;;
178 - javax-inject)
179 - spkg=${spkg/-/.}
180 - echo $1:${spkg}:${spkg}:${sver%%-*}
181 - exit 0
182 - ;;
183 - velocity)
184 - echo $1:org.apache.${spkg}:${spkg}:${sver%%-*}
185 - exit 0
186 - ;;
187 - jtidy)
188 - echo $1:net.sf.${spkg}:${spkg}:${sver%%-*}
189 - exit 0
190 - ;;
191 - saxpath)
192 - echo $1:${spkg}:${spkg}:${sver%%-*}-FCS # maven version
193 - echo $1:org.jdom:${spkg}:${sver%%-*}-FCS
194 - exit 0
195 - ;;
196 - ant*)
197 - [[ ${spkg} = ant-core ]] && { spkg=ant; echo $1:ant:${spkg}:${sver%%-*}; }
198 - [[ ${spkg} = ant-ivy ]] && spkg=ivy
199 - echo $1:org.apache.ant:${spkg}:${sver%%-*}
200 - exit 0
201 - ;;
202 - bcpg|bcprov)
203 - echo $1:org.bouncycastle:${spkg}-jdk12:130
204 - for jv in 1{4,5,6}; do
205 - echo $1:org.bouncycastle:${spkg}-jdk${jv}:${sver%%-*}
206 - done
207 - exit 0
208 - ;;
209 - asm)
210 - echo $1:org.ow2.asm:${spkg}:${sver%%-*}
211 - echo $1:org.ow2.asm:${spkg}-all:${sver%%-*}
212 - echo $1:org.ow2.asm:${spkg}-debug-all:${sver%%-*}
213 - exit 0
214 - ;;
215 - cofoja)
216 - echo $1:org.huoc:${spkg}:${sver%%-*}
217 - exit 0
218 - ;;
219 - scala)
220 - echo $1:org.scala-lang:${spkg}-compiler:${sver%%-*}
221 - exit 0
222 - ;;
223 -esac
224 -
225 -touch bebd bpom
226 -grep -q ${pkg} <bebd <bpom && exit 0
227 -
228 -ebd=$(equery w ${pkg} 2>/dev/null)
229 -if [[ -z "${ebd}" ]]; then
230 - echo $1:${pkg} >> bebd
231 - exit 0
232 -fi
233 -
234 -# java-utils-2.eclass:java-pkg_needs-vm()
235 -export JAVA_PKG_NV_DEPEND="nothing"
236 -
237 -if ! ebuild "${ebd}" unpack >/dev/null 2>&1; then
238 - echo $1:${pkg} >> bebd
239 - exit 0
240 -fi
241 -
242 -bad_pom="yes"
243 -for subd in "${PORTAGE_TMPDIR}"/portage/${pkg}/work/*; do
244 - [[ -f ${subd}/pom.xml ]] || continue
245 - bad_pom=""
246 - pushd ${subd} > /dev/null
247 - poms=$(mvn -q --also-make exec:exec -Dexec.executable="pwd" 2> /dev/null | grep ^/)
248 - popd > /dev/null
249 - for pd in ${poms}; do
250 - ppom=$(xml2 < ${pd}/pom.xml | egrep '(groupId|artifactId|version)=')
251 - PG=$(echo "${ppom}" | sed -n -r -e 's,/project/groupId=(.*),\1,p')
252 - [[ -z ${PG} ]] && PG=$(echo "${ppom}" | sed -n -r -e 's,/project/parent/groupId=(.*),\1,p')
253 - PA=$(echo "${ppom}" | sed -n -r -e 's,/project/artifactId=(.*),\1,p')
254 - PV=$(echo "${ppom}" | sed -n -r -e 's,/project/version=(.*),\1,p')
255 - [[ -z ${PV} ]] && PV=$(echo "${ppom}" | sed -n -r -e 's,/project/parent/version=(.*),\1,p')
256 - echo $1:${PG}:${PA}:${PV/-SNAPSHOT/}
257 - done
258 -done
259 -if [[ -n "${bad_pom}" ]]; then
260 - echo $1:${pkg} >> bpom
261 -fi
262 -
263 -ebuild "${ebd}" clean >/dev/null 2>&1
264
265 diff --git a/scripts/movl b/scripts/movl
266 index efc31c7..793eea9 100755
267 --- a/scripts/movl
268 +++ b/scripts/movl
269 @@ -1,92 +1,43 @@
270 #!/bin/bash
271 -source "/etc/java-ebuilder.conf"
272 -tsh="/usr/lib/java-ebuilder/tree.sh"
273 -
274 -clean-maven() {
275 - rm -f "${CACHEDIR}"/maven-cache
276 - rm -rf "${MAVEN_OVERLAY_DIR}"/app-maven
277 -}
278 -
279 -clean-pom() {
280 - rm -f "${POMDIR}"/*.pom
281 -}
282 -
283 -clean-cache() {
284 - rm -f "${CACHEDIR}"/cache.{raw,}{0,1}
285 - rm -f "${CACHEDIR}"/b{ebd,pom}
286 -}
287 -
288 -clean() {
289 - clean-cache
290 - clean-pom
291 - clean-maven
292 -}
293 -
294 -rrdep() {
295 - # regenerate reverse dependencies
296 - for rdep in $(egrep -l "$1.*->" -r "${MAVEN_OVERLAY_DIR}"/app-maven); do
297 - [[ ${rdep} = *.ebuild ]] && "${tsh}" ${rdep}
298 - done
299 -}
300 -
301 -refresh() {
302 - if [[ $1=*:* ]]; then
303 - rrdep $1
304 - else
305 - # input: package name
306 - for ebd in "${MAVEN_OVERLAY_DIR}"/app-maven/$1/*.ebuild; do
307 - mid=$(sed -nr 's,^MAVEN_ID="(.*)",\1,p' "${ebd}")
308 - rm "${ebd}"; "${tsh}" ${mid}
309 - sed "/${mid}/d" -i "${CACHEDIR}"/maven-cache
310 - rrdep ${mid}
311 - done
312 - fi
313 -}
314 -
315 -build() {
316 - : ${PORTDIR:=$(portageq get_repo_path $(portageq envvar EROOT) gentoo)}
317 - : ${PORTAGE_TMPDIR:=$(portageq envvar PORTAGE_TMPDIR)}
318 - export PORTAGE_TMPDIR
319 -
320 - if [[ ! -f "${CACHEDIR}"/cache.0 ]]; then
321 - # 1. Generate cache of java related packages from portage tree.
322 - [[ -f "${CACHEDIR}"/cache.raw0 ]] || \
323 - java-ebuilder --refresh-cache -t "${PORTDIR}" --cache-file "${CACHEDIR}"/cache.raw0
324 -
325 - # 2. Find corresponding maven groupId, artifactId and version in the cache.
326 - pushd "${CACHEDIR}" > /dev/null
327 - ( echo 1.0; tail -n +2 cache.raw0 | parallel -j -1 /usr/lib/java-ebuilder/meta.sh; ) > cache.0
328 - popd > /dev/null
329 - fi
330 -
331 - # do the same to java overlay
332 - if [[ ! -f "${CACHEDIR}"/cache.1 ]]; then
333 - if [[ -n "${JAVA_OVERLAY_DIR}" ]]; then
334 - [[ -f "${CACHEDIR}"/cache.raw1 ]] || \
335 - java-ebuilder --refresh-cache -t "${JAVA_OVERLAY_DIR}" --cache-file "${CACHEDIR}"/cache.raw1
336 - pushd "${CACHEDIR}" > /dev/null
337 - tail -n +2 cache.raw1 | parallel -j -1 /usr/lib/java-ebuilder/meta.sh > cache.1
338 - popd > /dev/null
339 - else
340 - touch "${CACHEDIR}"/cache.1
341 - fi
342 - fi
343 -
344 - for M in ${MAVEN_ARTS}; do
345 - "${tsh}" ${M}
346 - done
347 -
348 - cd "${MAVEN_OVERLAY_DIR}"/app-maven
349 - parallel ebuild '$(echo {}/*.ebuild | cut -d\ -f1)' digest ::: *
350 -}
351 +[[ ${CONFIG} ]] && CONFIG=$(printf "%q\n" "$(realpath "${CONFIG}")")
352 +export PATH="${PATH}:/usr/lib/java-ebuilder/bin"
353 +export EROOT=$(dirname /etc)
354
355 if [[ $# -gt 0 ]]; then
356 - funcs=$1
357 - shift 1
358 + if [[ "$1" == "-h" || "$1" == "--help" ]]; then
359 + echo This is a helper to automagically generate ebuild for
360 + echo Maven artifacts defined in ${EROOT}/etc/java-ebuilder.conf
361 + echo
362 + echo Usage: movl [options] [target] ...
363 + echo Options: please refer to \`make -h\`
364 + echo Targets:
365 + echo " all alias for stage2 and post-stage2"
366 + echo " build alias for stage2 and post-stage2"
367 + echo " stage1 resolve the dependency graph of the provided Maven artifact"
368 + echo " stage2 generate ebuild files of the whole dep graph"
369 + echo " force-stage2 force generate stage2 ebuild files"
370 + echo " post-stage2 generate digests for ebuilds"
371 + echo " clean-cache remove cache files"
372 + echo " clean-stage1 remove stage1-related stuffs"
373 + echo " clean-stage2 remove stage2-related stuffs"
374 + echo " clean remove all the generated stuffs"
375 + echo "Bash Variables:"
376 + echo " CONFIG path to the config file"
377 + echo " default: ${EROOT}/etc/java-ebuilder.conf"
378 + echo " DEFAULT_CATEGORY the default category of the generated ebuilds"
379 + echo " default: app-maven"
380 + echo " MAVEN_NODEP set this variable to stop tree.sh from recursively resolving"
381 + echo " the dependencies of MAVEN_ARTS"
382 + echo " REPOSITORY where to find the pom and jar files"
383 + echo " default: https://repo1.maven.org/maven2"
384 + echo " TSH_NODEBUG set this variable to make \`movl build\` more silent"
385 + exit
386 + fi
387 else
388 - funcs=build
389 + movl -h
390 + exit 0
391 fi
392
393 -for func in ${funcs}; do
394 - ${func} $@
395 -done
396 +cd "${EROOT}/usr/lib/java-ebuilder/Makefiles"
397 +make $@
398 +
399
400 diff --git a/scripts.new/resources/Makefiles/Makefile b/scripts/resources/Makefiles/Makefile
401 similarity index 100%
402 rename from scripts.new/resources/Makefiles/Makefile
403 rename to scripts/resources/Makefiles/Makefile
404
405 diff --git a/scripts.new/resources/Makefiles/cache.mk b/scripts/resources/Makefiles/cache.mk
406 similarity index 100%
407 rename from scripts.new/resources/Makefiles/cache.mk
408 rename to scripts/resources/Makefiles/cache.mk
409
410 diff --git a/scripts.new/resources/Makefiles/environment.mk b/scripts/resources/Makefiles/environment.mk
411 similarity index 100%
412 rename from scripts.new/resources/Makefiles/environment.mk
413 rename to scripts/resources/Makefiles/environment.mk
414
415 diff --git a/scripts.new/resources/Makefiles/stage1.mk b/scripts/resources/Makefiles/stage1.mk
416 similarity index 76%
417 rename from scripts.new/resources/Makefiles/stage1.mk
418 rename to scripts/resources/Makefiles/stage1.mk
419 index eeaa4d3..363bf4e 100644
420 --- a/scripts.new/resources/Makefiles/stage1.mk
421 +++ b/scripts/resources/Makefiles/stage1.mk
422 @@ -3,13 +3,13 @@
423
424 ${STAGE2_MAKEFILE}: ${PRE_STAGE1_CACHE}
425 mkdir -p ${STAGE1_DIR}
426 - mkdir -p $(shell dirname $@)
427 - CUR_STAGE_DIR="${STAGE1_DIR}" CUR_STAGE=stage1\
428 + mkdir -p "$(shell dirname "$@")"
429 + CUR_STAGE_DIR="$(shell echo ${STAGE1_DIR})" CUR_STAGE=stage1\
430 CACHE_TIMESTAMP="$(shell echo ${CACHE_TIMESTAMP})"\
431 GENTOO_CACHE="$(shell echo ${PRE_STAGE1_CACHE})"\
432 TARGET_MAKEFILE="$@"\
433 - TSH="${TSH}" CONFIG="${CONFIG}"\
434 - "${TSH_WRAPPER}"
435 + TSH=${TSH} CONFIG=${CONFIG}\
436 + ${TSH_WRAPPER}
437 touch "$@"
438
439 stage1: ${STAGE2_MAKEFILE}
440
441 diff --git a/scripts.new/resources/Makefiles/stage2.mk b/scripts/resources/Makefiles/stage2.mk
442 similarity index 100%
443 rename from scripts.new/resources/Makefiles/stage2.mk
444 rename to scripts/resources/Makefiles/stage2.mk
445
446 diff --git a/scripts.new/resources/resources/LUT b/scripts/resources/resources/LUT
447 similarity index 99%
448 rename from scripts.new/resources/resources/LUT
449 rename to scripts/resources/resources/LUT
450 index 3c471f3..0a4f02e 100644
451 --- a/scripts.new/resources/resources/LUT
452 +++ b/scripts/resources/resources/LUT
453 @@ -36,33 +36,9 @@
454 },
455 "animal-sniffer-annotations": {
456 "0": [
457 - [
458 - "org.codehaus.mojo",
459 - "animal-sniffer"
460 - ],
461 [
462 "org.codehaus.mojo",
463 "animal-sniffer-annotations"
464 - ],
465 - [
466 - "org.codehaus.mojo",
467 - "animal-sniffer-ant-tasks"
468 - ],
469 - [
470 - "org.codehaus.mojo",
471 - "animal-sniffer-enforcer-rule"
472 - ],
473 - [
474 - "org.codehaus.mojo",
475 - "animal-sniffer-maven-plugin"
476 - ],
477 - [
478 - "org.codehaus.mojo",
479 - "animal-sniffer-parent"
480 - ],
481 - [
482 - "org.codehaus.mojo",
483 - "java-boot-classpath-detector"
484 ]
485 ]
486 },
487
488 diff --git a/scripts/tree.sh b/scripts/tree.sh
489 deleted file mode 100755
490 index 6bb7cc5..0000000
491 --- a/scripts/tree.sh
492 +++ /dev/null
493 @@ -1,145 +0,0 @@
494 -#!/bin/bash
495 -# start from the root of a maven artifact and recursively resolve its
496 -# dependencies.
497 -
498 -source /etc/java-ebuilder.conf
499 -
500 -mkdir -p "${POMDIR}"
501 -
502 -sver() {
503 - PV=$1
504 - # com.github.lindenb:jbwa:1.0.0_ppc64
505 - PV=${PV/_/.}
506 - # plexus-container-default 1.0-alpha-9-stable-1
507 - PV=${PV/-stable-/.}
508 - PV=$(sed -r 's/[.-]?alpha[-.]?/_alpha/' <<< ${PV})
509 - # wagon-provider-api 1.0-beta-7
510 - # com.google.cloud.datastore:datastore-v1beta3-proto-client:1.0.0-beta.2
511 - # com.google.cloud.datastore:datastore-v1beta3-protos:1.0.0-beta
512 - PV=$(sed -r 's/[.-]?beta[-.]?/_beta/' <<< ${PV})
513 - # aopalliance-repackaged 2.5.0-b16
514 - PV=${PV/-b/_beta}
515 - # com.google.auto.service:auto-service:1.0-rc2
516 - PV=${PV/-rc/_rc}
517 - # cdi-api 1.0-SP4
518 - PV=${PV/-SP/_p}
519 - # org.seqdoop:cofoja:1.1-r150
520 - PV=${PV/-rev/_p}
521 - PV=${PV/-r/_p}
522 - PV=${PV/.v/_p}
523 - # javax.xml.stream:stax-api:1.0-2
524 - PV=${PV//-/.}
525 - # .Final .GA -incubating means nothing
526 - PV=${PV%.[a-zA-Z]*}
527 - # com.google.cloud.genomics:google-genomics-dataflow:v1beta2-0.15 -> 1.2.0.15
528 - # plexus-container-default 1.0-alpha-9-stable-1 -> 1.0.9.1
529 - while [[ ${PV} != ${PV0} ]]; do
530 - PV0=${PV}
531 - PV=$(sed -r 's/_(rc|beta|alpha|p)(.*\..*)/.\2/' <<< ${PV0})
532 - done
533 - # remove all non-numeric charactors before _
534 - # org.scalamacros:quasiquotes_2.10:2.0.0-M8
535 - if [[ ${PV} = *_* ]]; then
536 - echo $(sed 's/[^.0-9]//g' <<< ${PV/_*/})_${PV/*_/}
537 - else
538 - sed 's/[^.0-9]//g' <<< ${PV}
539 - fi
540 -}
541 -
542 -gebd() {
543 - case ${MA} in
544 - weld-osgi-bundle)
545 - # 1.1.0.Final no longer exist
546 - [[ ${MV} = 1.1.0.Final ]] && MV=1.1.33.Final
547 - ;;
548 - esac
549 -
550 - local WORKDIR=${PG//./\/}/${MA} MID
551 - local MID=${PG}:${MA}:${MV}
552 - local PV=$(sver ${MV}) PA SLOT
553 -
554 - case ${MA} in
555 - opengl-api)
556 - [[ ${MV} = 2.1.1 ]] && MV=gl1.1-android-2.1_r1
557 - ;;
558 - esac
559 -
560 - # spark-launcher_2.11 for scala 2.11
561 - eval $(sed -nr 's,([^_]*)(_(.*))?,PA=\1 SLOT=\3,p' <<< ${MA})
562 - [[ -z "${SLOT}" ]] && eval $(sed -nr 's,(.*)-(([0-9]+\.)?[0-9]+),PA=\1 SLOT=\2,p' <<< ${MA})
563 - [[ -z "${SLOT}" ]] && PA=${MA}
564 - PA=${PA//./-}
565 - PA=${PA//_/-}
566 -
567 - local M=${MA}-${MV}
568 - local SRC_URI="https://repo.maven.apache.org/maven2/${WORKDIR}/${MV}/${M}-sources.jar"
569 -
570 - if [[ ! -f "${POMDIR}"/${M}.pom ]]; then
571 - pushd "${POMDIR}" > /dev/null
572 - wget ${SRC_URI/-sources.jar/.pom}
573 -
574 - # 3rd party plugin not needed here
575 - # distributionManagement is invalid for maven 3
576 - # net.sf.jtidy:jtidy:r938 version is not maven-compliant
577 - sed -e '/<packaging>bundle/d' \
578 - -e '/<distributionManagement>/,/<\/distributionManagement>/d' \
579 - -e '/<build>/,/<\/build>/d' \
580 - -e '/<modules>/,/<\/modules>/d' \
581 - -e 's,<version>r938</version>,<version>1.0</version>,' \
582 - -i ${M}.pom
583 - popd
584 - fi
585 -
586 - if ! wget -q --spider ${SRC_URI}; then
587 - SRC_URI=${SRC_URI/-sources.jar/.jar}
588 - PA=${PA}-bin
589 - fi
590 - local P=${PA}-${PV}
591 - local ebd="${MAVEN_OVERLAY_DIR}"/app-maven/${PA}/${P}.ebuild
592 -
593 - line=app-maven:${PA}:${PV}:${SLOT:-0}::${MID}
594 - if ! grep -q ${line} "${CACHEDIR}"/maven-cache 2>/dev/null ; then
595 - pushd "${CACHEDIR}" > /dev/null
596 - echo ${line} >> maven-cache
597 - cat cache.{0,1} maven-cache > cache
598 - popd > /dev/null
599 - fi
600 -
601 - if [[ ! -f "${ebd}" ]]; then
602 - mkdir -p $(dirname ${ebd})
603 - java-ebuilder -p "${POMDIR}"/${M}.pom -e "${ebd}" -g --workdir . \
604 - -u ${SRC_URI} --slot ${SLOT:-0} --keywords ~amd64 \
605 - --cache-file "${CACHEDIR}"/cache
606 - fi
607 -
608 - if [[ -z "${MAVEN_NODEP}" ]] && mfill "${ebd}"; then
609 - java-ebuilder -p "${POMDIR}"/${M}.pom -e "${ebd}" -g --workdir . \
610 - -u ${SRC_URI} --slot ${SLOT:-0} --keywords ~amd64 \
611 - --cache-file "${CACHEDIR}"/cache
612 - fi
613 -
614 - [[ ${SRC_URI} = *-sources.jar ]] || sed -i "/inherit/s/java-pkg-simple/java-pkg-binjar/" "${ebd}"
615 -}
616 -
617 -mfill() {
618 - # recursively fill missing dependencies
619 - arts=$(sed -n -r 's,# (test\? )?(.*)-> !!!.*-not-found!!!,\2,p' < $1)
620 - if [[ -z "${arts}" ]]; then
621 - false # no need to java-ebuilder again
622 - else
623 - for a in ${arts}; do
624 - eval $(awk -F":" '{print "PG="$1, "MA="$2, "MV="$3}' <<< ${a})
625 - gebd
626 - done
627 - return
628 - fi
629 -}
630 -
631 -if [[ $1 == *.ebuild ]]; then
632 - eval $(grep MAVEN_ID $1)
633 - rm -f $1
634 -else
635 - MAVEN_ID=$1
636 -fi
637 -eval $(awk -F":" '{print "PG="$1, "MA="$2, "MV="$3}' <<< ${MAVEN_ID})
638 -gebd