aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenda Xu <heroxbd@gentoo.org>2016-10-06 13:29:20 +0900
committerBenda Xu <heroxbd@gentoo.org>2016-10-06 13:47:19 +0900
commit1b456bef3c706d1cc9e26bc237a5bbba365e2907 (patch)
tree51a22cf0b9e58e174ca269fcad7dcdd8f1745cee /scripts
parenttree.sh: use dirs from conf file. (diff)
downloadjava-ebuilder-1b456bef3c706d1cc9e26bc237a5bbba365e2907.tar.gz
java-ebuilder-1b456bef3c706d1cc9e26bc237a5bbba365e2907.tar.bz2
java-ebuilder-1b456bef3c706d1cc9e26bc237a5bbba365e2907.zip
meta.sh also use configuration file, create movl wrapper script.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/meta.sh11
-rwxr-xr-xscripts/movl62
2 files changed, 68 insertions, 5 deletions
diff --git a/scripts/meta.sh b/scripts/meta.sh
index 4917098..10c317f 100755
--- a/scripts/meta.sh
+++ b/scripts/meta.sh
@@ -2,15 +2,15 @@
# read in cache from java-ebuilder and find out the groupId,
# artifactId and version.
-# cache is by default at $HOME/.java-ebuilder/cache
# example:
# ( echo 1.0; tail -n +2 cache | parallel -j -2 meta.sh; ) > cache.1
+source /etc/java-ebuilder.conf
pkg=$(awk -F ":" '{print $1"/"$2"-"$3}' <<< $1)
spkg=$(cut -d: -f2 <<< $1)
sver=$(cut -d: -f3 <<< $1)
case ${spkg} in
- guava)
+ guava)
echo $1:com.google.guava:${spkg}:${sver%%-*}
exit 0
;;
@@ -70,6 +70,7 @@ case ${spkg} in
exit 0
esac
+touch bebd bpom
grep -q ${pkg} <bebd <bpom && exit 0
ebd=$(equery w ${pkg} 2>/dev/null)
@@ -81,13 +82,13 @@ fi
# java-utils-2.eclass:java-pkg_needs-vm()
export JAVA_PKG_NV_DEPEND="nothing"
-if ! ebuild ${ebd} unpack >/dev/null 2>&1; then
+if ! ebuild "${ebd}" unpack >/dev/null 2>&1; then
echo $1:${pkg} >> bebd
exit 0
fi
bad_pom="yes"
-for subd in /dev/shm/portage/${pkg}/work/*; do
+for subd in "${PORTAGE_TMPDIR}"/portage/${pkg}/work/*; do
[[ -f ${subd}/pom.xml ]] || continue
bad_pom=""
pushd ${subd} > /dev/null
@@ -107,4 +108,4 @@ if [[ -n "${bad_pom}" ]]; then
echo $1:${pkg} >> bpom
fi
-ebuild ${ebd} clean >/dev/null 2>&1
+ebuild "${ebd}" clean >/dev/null 2>&1
diff --git a/scripts/movl b/scripts/movl
new file mode 100755
index 0000000..c2f7c0d
--- /dev/null
+++ b/scripts/movl
@@ -0,0 +1,62 @@
+#!/usr/bin/env bash
+source /etc/java-ebuilder.conf
+
+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
+}
+
+build() {
+ 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 scripts/meta.sh > cache.1
+ popd > /dev/null
+ else
+ touch "${CACHEDIR}"/cache.1
+ fi
+ fi
+
+ for M in ${MAVEN_ARTS}; do
+ /usr/lib/java-ebuilder/tree.sh ${M}
+ done
+}
+
+if [[ $# -gt 0 ]]; then
+ funcs=$@
+else
+ funcs=build
+fi
+
+for func in ${funcs}; do
+ ${func}
+done