Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cross-project-issues-dev] Stable URLs for latest Orbit builds

Hi all,

I find it cumbersome and error-prone that I have to look up the latest Orbit build on http://download.eclipse.org/tools/orbit/downloads modify my various build scripts accordingly before I can kick a build. So I've created a cron job that updates the following p2 composite repos in 5 minute intervals:

	http://download.eclipse.org/modeling/emf/cdo/orbit/latest-R
	http://download.eclipse.org/modeling/emf/cdo/orbit/latest-S
	http://download.eclipse.org/modeling/emf/cdo/orbit/latest-I (currently empty)
	http://download.eclipse.org/modeling/emf/cdo/orbit/latest-M (currently empty)

Each composite contains at most one child repo which is the latest Orbit repo of the respective build type, i.e., R, S, I or M-build. The p2.timestamp of a composite only changes when the child location changes.

Please feel free to use these stable URLs yourself if you find them handy ;-)

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


P.S.: I'm not a bash expert, so I attach the used bash scripts to this post. Please provide feedback if there's something wrong with them.
#!/usr/bin/env bash

if [ "$1" == "--force" ]
then
	force=true
	shift
fi

prefix="$1"
suffix="$2"

target="$3"
test ! -d $target && mkdir $target

latest=`ls -d $prefix* 2>/dev/null | tail -1`

if [ -z "$latest" ]
then
	rm $target/build.id $target/composite*.xml 2>/dev/null
	exit
fi

if [ -z "$force" ]
then
	test -f $target/build.id && . $target/build.id
	test "$latest" == "$build_id" && exit
fi

timestamp=`date +%s000`
location=`pwd -P`/$latest$suffix
child=`/home/data/users/estepper/bin/relpath $target $location`

cat <<EOF > $target/compositeContent.xml
<?xml version='1.0' encoding='UTF-8'?>
<?compositeMetadataRepository version='1.0.0'?>
<repository name='Latest Orbit $prefix-Build ($latest)' type='org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository' version='1.0.0'>
    <properties size='2'>
        <property name='p2.timestamp' value='$timestamp'/>
        <property name='p2.compressed' value='true'/>
    </properties>
    <children size='1'>
        <child location='$child'/>
    </children>    
</repository>
EOF

cat <<EOF > $target/compositeArtifacts.xml
<?xml version='1.0' encoding='UTF-8'?>
<?compositeMetadataRepository version='1.0.0'?>
<repository name='Latest Orbit $prefix-Build ($latest)' type='org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository' version='1.0.0'>
    <properties size='2'>
        <property name='p2.timestamp' value='$timestamp'/>
        <property name='p2.compressed' value='true'/>
    </properties>
    <children size='1'>
        <child location='$child'/>
    </children>    
</repository>
EOF

echo "build_id=$latest" > $target/build.id
#!/usr/bin/env bash

cd /home/data/httpd/download.eclipse.org/tools/orbit/downloads/drops
target=/home/data/httpd/download.eclipse.org/modeling/emf/cdo/orbit

/home/data/users/estepper/bin/compose-latest R /repository $target/latest-R
/home/data/users/estepper/bin/compose-latest S /repository $target/latest-S
/home/data/users/estepper/bin/compose-latest I /repository $target/latest-I
/home/data/users/estepper/bin/compose-latest M /repository $target/latest-M
#!/usr/bin/env bash

# Taken from http://stackoverflow.com/questions/2564634/bash-convert-absolute-path-into-relative-path-given-a-current-directory

# both $1 and $2 are absolute paths beginning with /
# returns relative path to $2/$target from $1/$source
source=$1
target=$2

common_part=$source # for now
result="" # for now

while [[ "${target#$common_part}" == "${target}" ]]; do
    # no match, means that candidate common part is not correct
    # go up one level (reduce common part)
    common_part="$(dirname $common_part)"
    # and record that we went back, with correct / handling
    if [[ -z $result ]]; then
        result=".."
    else
        result="../$result"
    fi
done

if [[ $common_part == "/" ]]; then
    # special case for root (no common path)
    result="$result/"
fi

# since we now have identified the common part,
# compute the non-common part
forward_part="${target#$common_part}"

# and now stick all parts together
if [[ -n $result ]] && [[ -n $forward_part ]]; then
    result="$result$forward_part"
elif [[ -n $forward_part ]]; then
    # extra slash removal
    result="${forward_part:1}"
fi

echo $result

Back to the top