|
22 | 22 | source $CJE_ROOT/scripts/common-functions.shsource |
23 | 23 | source $1 |
24 | 24 |
|
| 25 | +compositeTargetSize=3 |
25 | 26 | epUpdateDir=/home/data/httpd/download.eclipse.org/eclipse/updates |
26 | 27 | dropsPath=${epUpdateDir}/${STREAMMajor}.${STREAMMinor}-${BUILD_TYPE}-builds |
27 | 28 | latestRelDir=/home/data/httpd/download.eclipse.org/eclipse/downloads/drops4 |
|
48 | 49 | ssh [email protected] tar -C ${workspace} -xzf ${epRelDir}/eclipse-platform- *-linux-gtk-x86_64.tar.gz |
49 | 50 |
|
50 | 51 | #get requisite tools |
51 | | -ssh [email protected] wget -O ${workspace}/addToComposite.xml https://download.eclipse.org/eclipse/relengScripts/cje-production/scripts/addToComposite.xml |
| 52 | +# Enhance the addToComposite ANT script to remove the oldest/earliest children to ensure the target-size is not exceeded |
| 53 | +scp [email protected]: ${dropsPath}/compositeArtifacts.jar compositeArtifacts.jar |
| 54 | +#Unzip compositeArtifacts.xml and read the current children from it |
| 55 | +currentChildren=$(unzip -p compositeArtifacts.jar compositeArtifacts.xml |\ |
| 56 | + xmllint - --xpath '/repository/children/child/@location' |\ |
| 57 | + sed --expression 's|location="||g' --expression 's|"||g') |
| 58 | +rm compositeArtifacts.jar |
| 59 | +childrenArray=(${currentChildren}) |
| 60 | +echo "Current children of composite repository: ${childrenArray[@]}" |
| 61 | + |
| 62 | +addToComposite_xml=$(curl https://download.eclipse.org/eclipse/relengScripts/cje-production/scripts/addToComposite.xml) |
| 63 | +extraTasksMarker='<!--EXTRA_TASKS-->' |
| 64 | + |
| 65 | +# One more child is about to be added to the composite. |
| 66 | +# Remove those children from the beginning of the list if the target-size would be exceeded. |
| 67 | +removalCount=$(( ${#childrenArray[@]} + 1 - compositeTargetSize )) |
| 68 | +if [ "${removalCount}" -gt 0 ]; then |
| 69 | + childrenToRemove="${childrenArray[@]:0:${removalCount}}" |
| 70 | + echo "Remove from composite repsitory: ${childrenToRemove}" |
| 71 | + extraAntTask='' |
| 72 | + for child in ${childrenToRemove}; do |
| 73 | + extraAntTask+="<remove><repository location=\\\"${child}\\\"/></remove>\\n " |
| 74 | + done |
| 75 | + addToComposite_xml=$(cat <<<"${addToComposite_xml}" | sed --expression "s|${extraTasksMarker}|${extraAntTask}|g") |
| 76 | +else |
| 77 | + echo "Composite p2-repository contains only ${#childrenArray[@]} children and adding one will not exceed its target size of ${compositeTargetSize}: ${dropsPath}" |
| 78 | +fi |
| 79 | + |
| 80 | +ssh [email protected] "cat<<<'${addToComposite_xml}' > ${workspace}/addToComposite.xml" |
52 | 81 |
|
53 | 82 | #triggering ant runner |
54 | 83 | baseBuilderDir=${workspace}/eclipse |
|
0 commit comments