Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/java-ebuilder:master commit in: /, scripts/
Date: Wed, 30 Oct 2019 17:35:23
Message-Id: 1475729239.1b456bef3c706d1cc9e26bc237a5bbba365e2907.mgorny@gentoo
1 commit: 1b456bef3c706d1cc9e26bc237a5bbba365e2907
2 Author: Benda Xu <heroxbd <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 6 04:29:20 2016 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 6 04:47:19 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=1b456bef
7
8 meta.sh also use configuration file, create movl wrapper script.
9
10 README | 22 +++----------------
11 java-ebuilder.conf | 7 ++++++
12 maven.conf | 2 ++
13 scripts/meta.sh | 11 +++++-----
14 scripts/movl | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
15 5 files changed, 80 insertions(+), 24 deletions(-)
16
17 diff --git a/README b/README
18 index e74f482..febc04d 100644
19 --- a/README
20 +++ b/README
21 @@ -1,23 +1,7 @@
22 Java team tool for semi-automatic creation of ebuilds from pom.xml.
23
24 -Use example:
25 +1. Edit /etc/java-ebuilder.conf to add the artifact you want to MAVEN_ARTS, separated by space.
26
27 -1. Generate cache of java related packages from portage tree.
28 -java-ebuilder --refresh-cache -t /usr/portage
29 -
30 -2. Find corresponding maven groupId, artifactId and version in the cache.
31 -cd $HOME/.java-ebuilder
32 -mv cache cache.raw0
33 -( echo 1.0; tail -n +2 cache.raw0 | parallel -j -2 scripts/meta.sh; ) > cache.0
34 -
35 -3. Generate cache of java related packages from java overaly.
36 -java-ebuilder --refresh-cache -t /var/lib/layman/java
37 -
38 -4. Find corresponding maven groupId, artifactId and version in the cache.
39 -cd $HOME/.java-ebuilder
40 -mv cache cache.raw1
41 -( echo 1.0; tail -n +2 cache.raw1 | parallel -j -2 scripts/meta.sh; ) > cache.1
42 -
43 -5. Create ebuild recursively.
44 -script/tree.sh org.apache.spark:spark-core_2.11:2.0.0
45 +2. Run `movl build`
46
47 +To start over, run `movl clean` first.
48
49 diff --git a/java-ebuilder.conf b/java-ebuilder.conf
50 new file mode 100644
51 index 0000000..1bf7e33
52 --- /dev/null
53 +++ b/java-ebuilder.conf
54 @@ -0,0 +1,7 @@
55 +PORTDIR=/usr/portage
56 +PORTAGE_TMPDIR=/var/tmp
57 +# JAVA_OVERLAY_DIR=/var/lib/layman/java
58 +POMDIR=/var/lib/java-ebuilder/poms
59 +MAVEN_OVERLAY_DIR=/var/lib/java-ebuilder/maven
60 +CACHEDIR=/var/lib/java-ebuilder/cache
61 +# MAVEN_ARTS="org.apache.spark:spark-core_2.11:2.0.0"
62
63 diff --git a/maven.conf b/maven.conf
64 new file mode 100644
65 index 0000000..7621417
66 --- /dev/null
67 +++ b/maven.conf
68 @@ -0,0 +1,2 @@
69 +[maven]
70 +location = /var/lib/java-ebuilder/maven
71
72 diff --git a/scripts/meta.sh b/scripts/meta.sh
73 index 4917098..10c317f 100755
74 --- a/scripts/meta.sh
75 +++ b/scripts/meta.sh
76 @@ -2,15 +2,15 @@
77 # read in cache from java-ebuilder and find out the groupId,
78 # artifactId and version.
79
80 -# cache is by default at $HOME/.java-ebuilder/cache
81 # example:
82 # ( echo 1.0; tail -n +2 cache | parallel -j -2 meta.sh; ) > cache.1
83 +source /etc/java-ebuilder.conf
84
85 pkg=$(awk -F ":" '{print $1"/"$2"-"$3}' <<< $1)
86 spkg=$(cut -d: -f2 <<< $1)
87 sver=$(cut -d: -f3 <<< $1)
88 case ${spkg} in
89 - guava)
90 + guava)
91 echo $1:com.google.guava:${spkg}:${sver%%-*}
92 exit 0
93 ;;
94 @@ -70,6 +70,7 @@ case ${spkg} in
95 exit 0
96 esac
97
98 +touch bebd bpom
99 grep -q ${pkg} <bebd <bpom && exit 0
100
101 ebd=$(equery w ${pkg} 2>/dev/null)
102 @@ -81,13 +82,13 @@ fi
103 # java-utils-2.eclass:java-pkg_needs-vm()
104 export JAVA_PKG_NV_DEPEND="nothing"
105
106 -if ! ebuild ${ebd} unpack >/dev/null 2>&1; then
107 +if ! ebuild "${ebd}" unpack >/dev/null 2>&1; then
108 echo $1:${pkg} >> bebd
109 exit 0
110 fi
111
112 bad_pom="yes"
113 -for subd in /dev/shm/portage/${pkg}/work/*; do
114 +for subd in "${PORTAGE_TMPDIR}"/portage/${pkg}/work/*; do
115 [[ -f ${subd}/pom.xml ]] || continue
116 bad_pom=""
117 pushd ${subd} > /dev/null
118 @@ -107,4 +108,4 @@ if [[ -n "${bad_pom}" ]]; then
119 echo $1:${pkg} >> bpom
120 fi
121
122 -ebuild ${ebd} clean >/dev/null 2>&1
123 +ebuild "${ebd}" clean >/dev/null 2>&1
124
125 diff --git a/scripts/movl b/scripts/movl
126 new file mode 100755
127 index 0000000..c2f7c0d
128 --- /dev/null
129 +++ b/scripts/movl
130 @@ -0,0 +1,62 @@
131 +#!/usr/bin/env bash
132 +source /etc/java-ebuilder.conf
133 +
134 +clean-maven() {
135 + rm -f "${CACHEDIR}"/maven-cache
136 + rm -rf "${MAVEN_OVERLAY_DIR}"/app-maven
137 +}
138 +
139 +clean-pom() {
140 + rm -f "${POMDIR}"/*.pom
141 +}
142 +
143 +clean-cache() {
144 + rm -f "${CACHEDIR}"/cache.{raw,}{0,1}
145 + rm -f "${CACHEDIR}"/b{ebd,pom}
146 +}
147 +
148 +clean() {
149 + clean-cache
150 + clean-pom
151 + clean-maven
152 +}
153 +
154 +build() {
155 + if [[ ! -f "${CACHEDIR}"/cache.0 ]]; then
156 + # 1. Generate cache of java related packages from portage tree.
157 + [[ -f "${CACHEDIR}"/cache.raw0 ]] || \
158 + java-ebuilder --refresh-cache -t "${PORTDIR}" --cache-file "${CACHEDIR}"/cache.raw0
159 +
160 + # 2. Find corresponding maven groupId, artifactId and version in the cache.
161 + pushd "${CACHEDIR}" > /dev/null
162 + ( echo 1.0; tail -n +2 cache.raw0 | parallel -j -1 /usr/lib/java-ebuilder/meta.sh; ) > cache.0
163 + popd > /dev/null
164 + fi
165 +
166 + # do the same to java overlay
167 + if [[ ! -f "${CACHEDIR}"/cache.1 ]]; then
168 + if [[ -n "${JAVA_OVERLAY_DIR}" ]]; then
169 + [[ -f "${CACHEDIR}"/cache.raw1 ]] || \
170 + java-ebuilder --refresh-cache -t "${JAVA_OVERLAY_DIR}" --cache-file "${CACHEDIR}"/cache.raw1
171 + pushd "${CACHEDIR}" > /dev/null
172 + tail -n +2 cache.raw1 | parallel -j -1 scripts/meta.sh > cache.1
173 + popd > /dev/null
174 + else
175 + touch "${CACHEDIR}"/cache.1
176 + fi
177 + fi
178 +
179 + for M in ${MAVEN_ARTS}; do
180 + /usr/lib/java-ebuilder/tree.sh ${M}
181 + done
182 +}
183 +
184 +if [[ $# -gt 0 ]]; then
185 + funcs=$@
186 +else
187 + funcs=build
188 +fi
189 +
190 +for func in ${funcs}; do
191 + ${func}
192 +done