Author: nickboldt
Date: 2012-10-02 11:12:53 -0400 (Tue, 02 Oct 2012)
New Revision: 44220
Modified:
branches/jbosstools-4.0.0.Alpha2/build/publish/promote.sh
branches/jbosstools-4.0.0.Alpha2/build/publish/publish.sh
branches/jbosstools-4.0.0.Alpha2/build/util/cleanup/jbosstools-cleanup.sh
Log:
backport changes to promote, publish, and cleanup scripts from trunk so we're
consistent in the 40x branch
Modified: branches/jbosstools-4.0.0.Alpha2/build/publish/promote.sh
===================================================================
--- branches/jbosstools-4.0.0.Alpha2/build/publish/promote.sh 2012-10-02 14:58:07 UTC (rev
44219)
+++ branches/jbosstools-4.0.0.Alpha2/build/publish/promote.sh 2012-10-02 15:12:53 UTC (rev
44220)
@@ -3,40 +3,48 @@
# these should not need to change
DESTINATION=tools@filemgmt.jboss.org:/downloads_htdocs/tools/
-PARENT_FOLDER=soa-tooling/
OPERATION=COPY
-# develoment or stable
-BUILD_TYPE=$1
+if [[ $# -lt 1 ]]; then
+ echo "Usage : $0 -BUILD_TYPE build_type -TARGET_PLATFORM target_platform
-PROJECT_NAME project_name -TARGET_FOLDER target_folder -SOURCE_PATH source_path"
+ echo "Example: $0 -BUILD_TYPE integration -TARGET_PLATFORM juno -PROJECT_NAME base
-TARGET_FOLDER as_4.0.juno -SOURCE_PATH
jbosstools-4.0_stable_branch.component--as/all/repo"
+ echo "Example: $0 -BUILD_TYPE integration -TARGET_PLATFORM juno -PROJECT_NAME base
-TARGET_FOLDER archives_4.0.juno -SOURCE_PATH
jbosstools-4.0_stable_branch.component--archives/all/repo"
+ echo "Example: $0 -BUILD_TYPE integration -TARGET_PLATFORM juno -PROJECT_NAME base
-TARGET_FOLDER jmx_4.0.juno -SOURCE_PATH
jbosstools-4.0_stable_branch.component--jmx/all/repo"
+ echo "Example: $0 -BUILD_TYPE development -TARGET_PLATFORM juno -PROJECT_NAME
modeshape -TARGET_FOLDER 3.3.0.Beta3 -SOURCE_PATH
modeshape-tools-continuous/all/repo"
+ echo "Example: $0 -BUILD_TYPE stable -TARGET_PLATFORM indigo -PROJECT_NAME
switchyard -TARGET_FOLDER 0.5.0.Final -SOURCE_PATH SwitchYard-Tools/eclipse"
+ exit 1
+fi
-# indigo, juno, kepler, ...
-TARGET_PLATFORM=$2
+# read commandline args
+while [[ "$#" -gt 0 ]]; do
+ case $1 in
+ '-SOURCE_PATH') SOURCE_PATH="$2"; shift 1;; #
jbosstools-4.0_stable_branch.component--as/all/repo, modeshape-tools-continuous/all/repo,
SwitchYard-Tools/eclipse
-# 0.5.0.Beta3, 0.6.0.Final, ...
-TARGET_FOLDER=$3
+ '-BUILD_TYPE') BUILD_TYPE="$2"; shift 1;; # integration, develoment
or stable
+ '-TARGET_PLATFORM') TARGET_PLATFORM="$2"; shift 1;; # indigo, juno,
kepler, ...
+ '-PARENT_FOLDER') PARENT_FOLDER="$2"; shift 1;; # soa-tooling,
core
+ '-PROJECT_NAME') PROJECT_NAME="$2"; shift 1;; # switchyard,
modeshape, droolsjbpm, ...
+ '-TARGET_FOLDER') TARGET_FOLDER="$2"; shift 1;; # 0.5.0.Beta3,
0.6.0.Final, ...
+ esac
+ shift 1
+done
-# switchyard, modeshape, droolsjbpm, ...
-PROJECT_NAME=$4
-
-# should be ${JOB_NAME}/all/repo, but may also be something else, eg., for
SwitchYard-Tools, use ${JOB_NAME}/eclipse
-if [[ ${JOB_NAME} ]]; then PUBLISH_PATH=${JOB_NAME//-publish};
PUBLISH_PATH=${PUBLISH_PATH//-promote}/all/repo; fi
-if [[ $5 ]]; then PUBLISH_PATH=$5; fi
-
-if [[ $4 ]]; then
+if [[ ${PROJECT_NAME} ]]; then
echo "mkdir ${BUILD_TYPE}" | sftp
tools@filemgmt.jboss.org:/downloads_htdocs/tools/updates/
echo "mkdir ${BUILD_TYPE}/${TARGET_PLATFORM}" | sftp
tools@filemgmt.jboss.org:/downloads_htdocs/tools/updates/
echo "mkdir ${BUILD_TYPE}/${TARGET_PLATFORM}/${PARENT_FOLDER}" | sftp
tools@filemgmt.jboss.org:/downloads_htdocs/tools/updates/
- echo "mkdir ${BUILD_TYPE}/${TARGET_PLATFORM}/${PARENT_FOLDER}${PROJECT_NAME}"
| sftp tools@filemgmt.jboss.org:/downloads_htdocs/tools/updates/
+ echo "mkdir
${BUILD_TYPE}/${TARGET_PLATFORM}/${PARENT_FOLDER}/${PROJECT_NAME}" | sftp
tools@filemgmt.jboss.org:/downloads_htdocs/tools/updates/
if [[ ${OPERATION} == "MOVE" ]]; then
- echo -e "rename builds/staging/${PUBLISH_PATH}
updates/${BUILD_TYPE}/${TARGET_PLATFORM}/${PARENT_FOLDER}${PROJECT_NAME}/${TARGET_FOLDER}"
| sftp ${DESTINATION}
+ echo -e "rename builds/staging/${SOURCE_PATH}
updates/${BUILD_TYPE}/${TARGET_PLATFORM}/${PARENT_FOLDER}/${PROJECT_NAME}/${TARGET_FOLDER}"
| sftp ${DESTINATION}
else
- rsync -arzq --protocol=28 ${DESTINATION}/builds/staging/${PUBLISH_PATH}/*
${WORKSPACE}/${JOB_NAME}/
- rsync -arzq --protocol=28 --delete ${WORKSPACE}/${JOB_NAME}/*
${DESTINATION}/updates/${BUILD_TYPE}/${TARGET_PLATFORM}/${PARENT_FOLDER}${PROJECT_NAME}/${TARGET_FOLDER}/
+ rsync -arzq --protocol=28 ${DESTINATION}/builds/staging/${SOURCE_PATH}/*
${WORKSPACE}/${JOB_NAME}/
+ rsync -arzq --protocol=28 --delete ${WORKSPACE}/${JOB_NAME}/*
${DESTINATION}/updates/${BUILD_TYPE}/${TARGET_PLATFORM}/${PARENT_FOLDER}/${PROJECT_NAME}/${TARGET_FOLDER}/
fi
- echo "Site promoted by ${OPERATION} to:
http://download.jboss.org/jbosstools/updates/${BUILD_TYPE}/${TARGET_PLATF...
-else
- echo "Usage : $0 \${BUILD_TYPE} \${TARGET_PLATFORM} \${TARGET_FOLDER}
\${PROJECT_NAME} [PUBLISH_PATH]"
- echo "Example: $0 development juno 3.3.0.Beta3 modeshape"
- echo "Example: $0 stable indigo 0.5.0.Final switchyard ${JOB_NAME}/eclipse"
- exit 1
+ echo "Site promoted by ${OPERATION} to:
http://download.jboss.org/jbosstools/updates/${BUILD_TYPE}/${TARGET_PLATF...
fi
+
+# JBIDE-12662: regenerate composite metadata in
updates/${BUILD_TYPE}/${TARGET_PLATFORM}/${PARENT_FOLDER}/${PROJECT_NAME} folder for all
children
+wget
http://anonsvn.jboss.org/repos/jbosstools/trunk/build/util/cleanup/jbosst...
--no-check-certificate
+chmod +x jbosstools-cleanup.sh
+./jbosstools-cleanup.sh --dirs-to-scan
"updates/${BUILD_TYPE}/${TARGET_PLATFORM}/${PARENT_FOLDER}"
--regen-metadata-only
+rm -f jbosstools-cleanup.sh
Modified: branches/jbosstools-4.0.0.Alpha2/build/publish/publish.sh
===================================================================
--- branches/jbosstools-4.0.0.Alpha2/build/publish/publish.sh 2012-10-02 14:58:07 UTC (rev
44219)
+++ branches/jbosstools-4.0.0.Alpha2/build/publish/publish.sh 2012-10-02 15:12:53 UTC (rev
44220)
@@ -2,7 +2,7 @@
# Hudson script used to publish Tycho-built p2 update sites
# NOTE: sources MUST be checked out into ${WORKSPACE}/sources
-# to use timestamp when naming dirs instead of ${BUILD_ID}-H${BUILD_NUMBER}, use:
+# to use timestamp when naming dirs instead of ${BUILD_ID}-B${BUILD_NUMBER}, use:
# BUILD_ID=2010-08-31_19-16-10; timestamp=$(echo $BUILD_ID | tr -d "_-");
timestamp=${timestamp:0:12}; echo $timestamp; # 201008311916
#set up tmpdir
@@ -20,7 +20,7 @@
# releases get named differently than snapshots
if [[ ${RELEASE} == "Yes" ]]; then
- ZIPSUFFIX="${BUILD_ID}-H${BUILD_NUMBER}"
+ ZIPSUFFIX="${BUILD_ID}-B${BUILD_NUMBER}"
else
ZIPSUFFIX="SNAPSHOT"
fi
@@ -75,6 +75,9 @@
bl=${STAGINGDIR}/logs/BUILDLOG.txt
rm -f ${bl}; wget -q
http://hudson.qa.jboss.com/hudson/job/${JOB_NAME}/${BUILD_NUMBER}/console... -O ${bl}
--timeout=900 --wait=10 --random-wait --tries=10 --retry-connrefused
--no-check-certificate
+# calculate BUILD_ALIAS from parent pom version as recorded in the build log, eg., from
org/jboss/tools/parent/4.0.0.Alpha2-SNAPSHOT get Alpha2
+BUILD_ALIAS=$(cat ${bl} | grep "org/jboss/tools/parent/" | head -1 | sed -e
"s#.\+org/jboss/tools/parent/\(.\+\)/\(maven-metadata.xml\|parent.\+\)#\1#" |
sed -e "s#-SNAPSHOT##" | sed -e "s#[0-9].[0-9].[0-9].##")
+
# JBDS-1361 - fetch XML and then sed it into plain text
wgetParams="--timeout=900 --wait=10 --random-wait --tries=30 --retry-connrefused
--no-check-certificate --server-response"
rl=${STAGINGDIR}/logs/REVISION
@@ -97,10 +100,11 @@
echo "UNKNOWN REVISION(S)" > ${rl}.txt
fi
-METAFILE="${BUILD_ID}-H${BUILD_NUMBER}.txt"
+METAFILE="${BUILD_ID}-B${BUILD_NUMBER}.txt"
touch ${STAGINGDIR}/logs/${METAFILE}
METAFILE=build.properties
+echo "BUILD_ALIAS = ${BUILD_ALIAS}" >> ${STAGINGDIR}/logs/${METAFILE}
echo "JOB_NAME = ${JOB_NAME}" >> ${STAGINGDIR}/logs/${METAFILE}
echo "BUILD_NUMBER = ${BUILD_NUMBER}" >> ${STAGINGDIR}/logs/${METAFILE}
echo "BUILD_ID = ${BUILD_ID}" >> ${STAGINGDIR}/logs/${METAFILE}
@@ -279,7 +283,7 @@
export JAVA_HOME=$(find /qa/tools/opt -maxdepth 1 -mindepth 1 -type d -name
"jdk1.6.0_*" | sort | tail -1)
export M2_HOME=$(find /qa/tools/opt -maxdepth 1 -mindepth 1 -type d -name
"apache-maven-3.0.*" | sort | tail -1)
- ${M2_HOME}/bin/mvn -q -B install -DJOB_NAME=${JOB_NAME} -DBUILD_NUMBER=${BUILD_NUMBER}
-DBUILD_ID=${BUILD_ID}
+ ${M2_HOME}/bin/mvn -q -B install -DJOB_NAME=${JOB_NAME} -DBUILD_NUMBER=${BUILD_NUMBER}
-DBUILD_ID=${BUILD_ID} -DBUILD_ALIAS=${BUILD_ALIAS}
mv target/index.html ${STAGINGDIR}/index.html; rm -fr target
popd >/dev/null
fi
@@ -319,7 +323,7 @@
# if an aggregate build, put output elsewhere on disk
if [[ ${JOB_NAME/.aggregate} != ${JOB_NAME} ]]; then
- echo "<meta http-equiv=\"refresh\"
content=\"0;url=${BUILD_ID}-H${BUILD_NUMBER}/\">" >
$tmpdir/latestBuild.html
+ echo "<meta http-equiv=\"refresh\"
content=\"0;url=${BUILD_ID}-B${BUILD_NUMBER}/\">" >
$tmpdir/latestBuild.html
if [[ ${PUBLISHPATHSUFFIX} ]]; then
date
# create folders if not already there
@@ -328,17 +332,17 @@
else
mkdir -p $DESTINATION/builds/nightly/${PUBLISHPATHSUFFIX}
fi
- date; rsync -arzq --protocol=28 --delete ${STAGINGDIR}/*
$DESTINATION/builds/nightly/${PUBLISHPATHSUFFIX}/${BUILD_ID}-H${BUILD_NUMBER}/
+ date; rsync -arzq --protocol=28 --delete ${STAGINGDIR}/*
$DESTINATION/builds/nightly/${PUBLISHPATHSUFFIX}/${BUILD_ID}-B${BUILD_NUMBER}/
# sftp only works with user@server, not with local $DESTINATIONS, so use rsync to
push symlink instead
- # echo -e "rm latest\nln ${BUILD_ID}-H${BUILD_NUMBER} latest" | sftp
${DESTINATIONREDUX}/builds/nightly/${PUBLISHPATHSUFFIX}/
- pushd $tmpdir >/dev/null; ln -s ${BUILD_ID}-H${BUILD_NUMBER} latest; rsync
--protocol=28 -l latest ${DESTINATION}/builds/nightly/${PUBLISHPATHSUFFIX}/; rm -f latest;
popd >/dev/null
+ # echo -e "rm latest\nln ${BUILD_ID}-B${BUILD_NUMBER} latest" | sftp
${DESTINATIONREDUX}/builds/nightly/${PUBLISHPATHSUFFIX}/
+ pushd $tmpdir >/dev/null; ln -s ${BUILD_ID}-B${BUILD_NUMBER} latest; rsync
--protocol=28 -l latest ${DESTINATION}/builds/nightly/${PUBLISHPATHSUFFIX}/; rm -f latest;
popd >/dev/null
date; rsync -arzq --protocol=28 --delete $tmpdir/latestBuild.html
$DESTINATION/builds/nightly/${PUBLISHPATHSUFFIX}/
else
date; rsync -arzq --protocol=28 --delete $tmpdir/latestBuild.html
$DESTINATION/builds/nightly/${JOBNAMEREDUX}/
# sftp only works with user@server, not with local $DESTINATIONS, so use rsync to
push symlink instead
- # echo -e "rm latest\nln ${BUILD_ID}-H${BUILD_NUMBER} latest" | sftp
${DESTINATIONREDUX}/builds/nightly/${JOBNAMEREDUX}/
- pushd $tmpdir >/dev/null; ln -s ${BUILD_ID}-H${BUILD_NUMBER} latest; rsync
--protocol=28 -l latest ${DESTINATION}/builds/nightly/${JOBNAMEREDUX}/; rm -f latest; popd
>/dev/null
- date; rsync -arzq --protocol=28 --delete ${STAGINGDIR}/*
$DESTINATION/builds/nightly/${JOBNAMEREDUX}/${BUILD_ID}-H${BUILD_NUMBER}/
+ # echo -e "rm latest\nln ${BUILD_ID}-B${BUILD_NUMBER} latest" | sftp
${DESTINATIONREDUX}/builds/nightly/${JOBNAMEREDUX}/
+ pushd $tmpdir >/dev/null; ln -s ${BUILD_ID}-B${BUILD_NUMBER} latest; rsync
--protocol=28 -l latest ${DESTINATION}/builds/nightly/${JOBNAMEREDUX}/; rm -f latest; popd
>/dev/null
+ date; rsync -arzq --protocol=28 --delete ${STAGINGDIR}/*
$DESTINATION/builds/nightly/${JOBNAMEREDUX}/${BUILD_ID}-B${BUILD_NUMBER}/
fi
rm -f $tmpdir/latestBuild.html
#else
@@ -482,7 +486,7 @@
# regenerate
http://download.jboss.org/jbosstools/builds/nightly/*/*/composite*.xml
files for up to 5 builds, cleaning anything older than 5 days old
wget
http://anonsvn.jboss.org/repos/jbosstools/trunk/build/util/cleanup/jbosst...
--no-check-certificate
chmod +x jbosstools-cleanup.sh
- ./jbosstools-cleanup.sh 5 5
+ ./jbosstools-cleanup.sh --keep 5 --age-to-delete 5 --childFolderSuffix /all/repo/
rm -f jbosstools-cleanup.sh
fi
Modified: branches/jbosstools-4.0.0.Alpha2/build/util/cleanup/jbosstools-cleanup.sh
===================================================================
--- branches/jbosstools-4.0.0.Alpha2/build/util/cleanup/jbosstools-cleanup.sh 2012-10-02
14:58:07 UTC (rev 44219)
+++ branches/jbosstools-4.0.0.Alpha2/build/util/cleanup/jbosstools-cleanup.sh 2012-10-02
15:12:53 UTC (rev 44220)
@@ -10,10 +10,41 @@
echo "Logfile: $log" | tee -a $log
echo "" | tee -a $log
-#commandline options so we can call this by itself using `jbosstools-cleanup.sh 1 2` or
call it from within publish.sh using `jbosstools-cleanup.sh 5 5`
-if [[ $1 ]] && [[ $1 -gt 0 ]]; then numbuildstokeep=$1; else numbuildstokeep=1;
fi # number of builds to keep per branch
-if [[ $2 ]] && [[ $2 -gt 0 ]]; then threshholdwhendelete=$2; else
threshholdwhendelete=2; fi # age at which a build is available for delete
+# commandline options so we can call it from jbosstools-cleanup Jenkins job using
+# `jbosstools-cleanup.sh -k 1 -a 2 -S /all/repo/`
+# or call it from within publish.sh using
+# `jbosstools-cleanup.sh -k 5 -a 5 -S /all/repo/`
+# or call it from within promote.sh using
+# `jbosstools-cleanup.sh --dirs-to-scan
"updates/${BUILD_TYPE}/${TARGET_PLATFORM}/${PARENT_FOLDER}"
--regen-metadata-only`
+#defauls
+numbuildstokeep=1000 # keep X builds per branch
+threshholdwhendelete=365 # purge builds more than X days old
+dirsToScan="builds/nightly/core builds/nightly/coretests builds/nightly/soa-tooling
builds/nightly/soatests builds/nightly/webtools"
+delete=1 # if 1, files will be deleted. if 0, files will be listed for delete but not
actually removed
+checkTimeStamps=1 # if 1, check for timestamped folders, eg., 2012-09-30_04-01-36-H5622
and deduce the age from name. if 0, skip name-to-age parsing and delete nothing
+childFolderSuffix="/" # for component update sites, set to "/"; for
aggregate builds (not update sites) use "/all/repo/"
+
+if [[ $# -lt 1 ]]; then
+ echo "Usage: $0 [-k num-builds-to-keep] [-a num-days-at-which-to-delete] [-d
dirs-to-scan] [--regen-metadata-only] [--childFolderSuffix /all/repo/]"
+ echo "Example (Jenkins job): $0 --keep 1 --age-to-delete 2 --childFolderSuffix
/all/repo/"
+ echo "Example (publish.sh): $0 -k 5 -a 5 -S /all/repo/"
+ echo "Example (promote.sh): $0 --dirs-to-scan
'updates/integration/indigo/soa-tooling/' --regen-metadata-only"
+ exit 1;
+fi
+
+# read commandline args
+while [[ "$#" -gt 0 ]]; do
+ case $1 in
+ '-k'|'--keep') numbuildstokeep="$2"; shift 1;;
+ '-a'|'--age-to-delete') threshholdwhendelete="$2"; shift 1;;
+ '-d'|'--dirs-to-scan') dirsToScan="$2"; shift 1;;
+ '-M'|'--regen-metadata-only') delete=0; checkTimeStamps=0; shift 0;;
+ '-S'|'--childFolderSuffix') childFolderSuffix="$2"
+ esac
+ shift 1
+done
+
getSubDirs ()
{
getSubDirsReturn="";
@@ -32,7 +63,7 @@
dirs=$(sftp -b $tmp tools(a)filemgmt.jboss.org 2>/dev/null)
i=0
for c in $dirs; do
- if [[ $i -gt 2 ]] && [[ $c != "sftp>" ]] && [[ ${c##*.} !=
"" ]]; then # valid dir
+ if [[ $i -gt 2 ]] && [[ $c != "sftp>" ]] && [[ ${c##*.} !=
"" ]] && [[ ${c##*/*.*ml} != "" ]]; then # valid dir; exclude
*.xml, *.html files
getSubDirsReturn=$getSubDirsReturn" "$c
fi
(( i++ ))
@@ -43,12 +74,12 @@
# Check for $type builds more than $threshhold days old; keep minimum $numkeep builds per
branch
clean ()
{
- type=$1 # nightly or release
+ type=$1 # builds/nightly or updates/development/juno/soa-tooling, etc.
numkeep=$2 # number of builds to keep per branch
- threshhold=$3 # age at which a build is available for delete
+ threshhold=$3 # purge builds more than $threshhold days old
echo "Check for $type builds more than $threshhold days old; keep minimum $numkeep
builds per branch" | tee -a $log
- getSubDirs /downloads_htdocs/tools/builds/$type/ 0
+ getSubDirs /downloads_htdocs/tools/$type/ 0
subdirs=$getSubDirsReturn
for sd in $subdirs; do
getSubDirs $sd 1
@@ -56,39 +87,45 @@
#echo $subsubdirs
tmp=`mktemp`
for ssd in $subsubdirs; do
- if [[ ${ssd##$sd/201*} == "" ]]; then # a build dir
+ if [[ ${ssd##$sd/201*} == "" ]] || [[ $checkTimeStamps -eq 0 ]]; then # a
build dir
buildid=${ssd##*/};
echo $buildid >> $tmp
fi
done
- newest=$(cat $tmp | sort -r | head -$numkeep) # keep these
- all=$(cat $tmp | sort -r) # check these
- rm -f $tmp
- for dd in $all; do
- keep=0;
- # sec=$(date -d "$(echo $dd | perl -pe
"s/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/\1-\2-\3\ \4:\5/")" +%s) # convert
buildID (folder) to timestamp, then to # seconds since epoch ## OLD FOLDER FORMAT
- sec=$(date -d "$(echo $dd | perl -pe
"s/(\d{4})-(\d{2})-(\d{2})_(\d{2})-(\d{2})-(\d{2})-H(\d+)/\1-\2-\3\
\4:\5:\6/")" +%s) # convert buildID (folder) to timestamp, then to # seconds
since epoch ## NEW FOLDER FORMAT
- (( day = now - sec ))
- (( day = day / 3600 / 24 ))
- for n in $newest; do
- if [[ $dd == $n ]] || [[ $day -le $threshhold ]]; then
- keep=1
+ if [[ $checkTimeStamps -eq 1 ]]; then
+ newest=$(cat $tmp | sort -r | head -$numkeep) # keep these
+ all=$(cat $tmp | sort -r) # check these
+ rm -f $tmp
+ for dd in $all; do
+ keep=0;
+ # sec=$(date -d "$(echo $dd | perl -pe
"s/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/\1-\2-\3\ \4:\5/")" +%s) # convert
buildID (folder) to timestamp, then to # seconds since epoch ## OLD FOLDER FORMAT
+ sec=$(date -d "$(echo $dd | perl -pe
"s/(\d{4})-(\d{2})-(\d{2})_(\d{2})-(\d{2})-(\d{2})-H(\d+)/\1-\2-\3\
\4:\5:\6/")" +%s) # convert buildID (folder) to timestamp, then to # seconds
since epoch ## NEW FOLDER FORMAT
+ (( day = now - sec ))
+ (( day = day / 3600 / 24 ))
+ for n in $newest; do
+ if [[ $dd == $n ]] || [[ $day -le $threshhold ]]; then
+ keep=1
+ fi
+ done
+ if [[ $keep -eq 0 ]]; then
+ echo -n "- $sd/$dd (${day}d)... " | tee -a $log
+ if [[ $delete -eq 1 ]]; then
+ if [[ $USER == "hudson" ]]; then
+ # can't delete the dir, but can at least purge its contents
+ rm -fr /tmp/$dd; mkdir /tmp/$dd; pushd /tmp/$dd >/dev/null
+ rsync --rsh=ssh --protocol=28 -r --delete . tools@filemgmt.jboss.org:$sd/$dd
2>&1 | tee -a $log
+ echo -e "rmdir $dd" | sftp tools@filemgmt.jboss.org:$sd/
+ popd >/dev/null; rm -fr /tmp/$dd
+ fi
+ echo "" | tee -a $log
+ else
+ echo " SKIPPED."
+ fi
+ else
+ echo "+ $sd/$dd (${day}d)" | tee -a $log
fi
done
- if [[ $keep -eq 0 ]]; then
- echo -n "- $sd/$dd (${day}d)... " | tee -a $log
- if [[ $USER == "hudson" ]]; then
- # can't delete the dir, but can at least purge its contents
- rm -fr /tmp/$dd; mkdir /tmp/$dd; pushd /tmp/$dd >/dev/null
- rsync --rsh=ssh --protocol=28 -r --delete . tools@filemgmt.jboss.org:$sd/$dd
2>&1 | tee -a $log
- echo -e "rmdir $dd" | sftp tools@filemgmt.jboss.org:$sd/
- popd >/dev/null; rm -fr /tmp/$dd
- fi
- echo "" | tee -a $log
- else
- echo "+ $sd/$dd (${day}d)" | tee -a $log
- fi
- done
+ fi
# generate metadata in the nightly/core/trunk/ folder to composite the remaining sites
into one
getSubDirs $sd 1; #return #getSubDirsReturn
@@ -96,7 +133,7 @@
#echo $subsubdirs
tmp=`mktemp`
for ssd in $subsubdirs; do
- if [[ ${ssd##$sd/201*} == "" ]]; then # a build dir
+ if [[ ${ssd##$sd/201*} == "" ]] || [[ $checkTimeStamps -eq 0 ]]; then # a
build dir
buildid=${ssd##*/};
echo $buildid >> $tmp
fi
@@ -108,8 +145,9 @@
if [[ $getListSizeReturn -gt 0 ]]; then
echo "Generate metadata for ${getListSizeReturn} subdir(s) in $sd/" | tee -a
$log
mkdir -p /tmp/cleanup-fresh-metadata/
- regenCompositeMetadata "$all" "$getListSizeReturn"
"org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository"
"/tmp/cleanup-fresh-metadata/compositeContent.xml"
- regenCompositeMetadata "$all" "$getListSizeReturn"
"org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository"
"/tmp/cleanup-fresh-metadata/compositeArtifacts.xml"
+ siteName=${sd##*/downloads_htdocs/tools/}
+ regenCompositeMetadata "$siteName" "$all"
"$getListSizeReturn"
"org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository"
"/tmp/cleanup-fresh-metadata/compositeContent.xml"
+ regenCompositeMetadata "$siteName" "$all"
"$getListSizeReturn"
"org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository"
"/tmp/cleanup-fresh-metadata/compositeArtifacts.xml"
rsync --rsh=ssh --protocol=28 -q /tmp/cleanup-fresh-metadata/composite*.xml
tools@filemgmt.jboss.org:$sd/
rm -fr /tmp/cleanup-fresh-metadata/
else
@@ -133,18 +171,19 @@
#regen metadata for remaining subdirs in this folder
regenCompositeMetadata ()
{
- subsubdirs=$1
- countChildren=$2
- fileType=$3
- fileName=$4
+ siteName=$1
+ subsubdirs=$2
+ countChildren=$3
+ fileType=$4
+ fileName=$5
now=$(date +%s000)
echo "<?xml version='1.0'
encoding='UTF-8'?><?compositeArtifactRepository
version='1.0.0'?>
-<repository name='JBoss Tools Builds - ${type}' type='${fileType}'
version='1.0.0'>
+<repository name='JBoss Tools Builds - ${siteName}' type='${fileType}'
version='1.0.0'>
<properties size='2'><property name='p2.timestamp'
value='${now}'/><property name='p2.compressed'
value='true'/></properties>
<children size='${countChildren}'>" > ${fileName}
for ssd in $subsubdirs; do
- echo "<child location='${ssd}/all/repo/'/>" >>
${fileName}
+ echo "<child location='${ssd}${childFolderSuffix}'/>" >>
${fileName}
done
echo "</children>
</repository>
@@ -152,6 +191,6 @@
}
# now that we have all the methods and vars defined, let's do some cleaning!
-for dir in nightly/core nightly/coretests nightly/soa-tooling nightly/soatests
nightly/webtools; do
+for dir in $dirsToScan; do
clean $dir $numbuildstokeep $threshholdwhendelete
done