2222source $CJE_ROOT /scripts/common-functions.shsource
2323source $1
2424
25+ compositeTargetSize=3
2526epUpdateDir=/home/data/httpd/download.eclipse.org/eclipse/updates
2627dropsPath=${epUpdateDir} /${STREAMMajor} .${STREAMMinor} -${BUILD_TYPE} -builds
2728latestRelDir=/home/data/httpd/download.eclipse.org/eclipse/downloads/drops4
@@ -48,7 +49,35 @@ epRelDir=$(ssh genie.releng@projects-storage.eclipse.org ls -d --format=single-c
4849ssh genie.releng@projects-storage.eclipse.org tar -C ${workspace} -xzf ${epRelDir} /eclipse-platform-* -linux-gtk-x86_64.tar.gz
4950
5051# get requisite tools
51- ssh genie.releng@projects-storage.eclipse.org 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 genie.releng@projects-storage.eclipse.org:${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 genie.releng@projects-storage.eclipse.org " cat<<<'${addToComposite_xml} ' > ${workspace} /addToComposite.xml"
5281
5382# triggering ant runner
5483baseBuilderDir=${workspace} /eclipse
0 commit comments