aboutsummaryrefslogtreecommitdiff
blob: 4bd16bad0057561bcd5936ef75ade86b91ecf72a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/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