Skip to content

Commit

Permalink
packager.sh aligned with current master and incremented the __version__
Browse files Browse the repository at this point in the history
  • Loading branch information
nastasi-oq committed Mar 19, 2015
1 parent a51208c commit 9749e0a
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 28 deletions.
2 changes: 1 addition & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Michele Simionato]
* Fixed a tricky bug happening when some tectonic region types are filtered
away.

python-oq-engine (1.3.0-1) precise; urgency=low

[Matteo Nastasi]
Expand Down
2 changes: 1 addition & 1 deletion openquake/engine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
# "-" + <pkg-version> + "+dev" + <secs_since_epoch> + "-" + <commit-id>
# NB: the next line is managed by packager.sh script (we retrieve the version
# using sed and optionally replace it)
__version__ = '1.3.0'
__version__ = '1.3.1'
__version__ += git_suffix(__file__)

# The path to the OpenQuake root directory
Expand Down
75 changes: 49 additions & 26 deletions packager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,19 @@ GEM_ALWAYS_YES=false
if [ "$GEM_EPHEM_CMD" = "" ]; then
GEM_EPHEM_CMD="lxc-start-ephemeral"
fi
GEM_EPHEM_NAME="ubuntu-lxc-eph"
if [ "$GEM_EPHEM_NAME" = "" ]; then
GEM_EPHEM_NAME="ubuntu-lxc-eph"
fi

if command -v lxc-shutdown &> /dev/null; then
# Older lxc (< 1.0.0) with lxc-shutdown
LXC_TERM="lxc-shutdown -t 10 -w"
LXC_KILL="lxc-stop"
else
# Newer lxc (>= 1.0.0) with lxc-stop only
LXC_TERM="lxc-stop -t 10"
LXC_KILL="lxc-stop -k"
fi

NL="
"
Expand All @@ -86,7 +98,7 @@ sig_hand () {
if [ -f "${upper}.dsk" ]; then
loop_dev="$(sudo losetup -a | grep "(${upper}.dsk)$" | cut -d ':' -f1)"
fi
sudo lxc-stop -n $lxc_name
sudo $LXC_KILL -n $lxc_name
sudo umount /var/lib/lxc/$lxc_name/rootfs
sudo umount /var/lib/lxc/$lxc_name/ephemeralbind
echo "$upper" | grep -q '^/tmp/'
Expand All @@ -105,6 +117,7 @@ sig_hand () {
if [ -f /tmp/packager.eph.$$.log ]; then
rm /tmp/packager.eph.$$.log
fi
exit 1
}


Expand Down Expand Up @@ -310,32 +323,37 @@ celeryd_wait() {
celeryd_wait $GEM_MAXLOOP"

if [ -n "$GEM_DEVTEST_SKIP_SLOW_TESTS" ]; then
# skip slow tests
skip_tests="!slow,"
fi

# run tests (in this case we omit 'set -e' to be able to read all tests outputs)
ssh $lxc_ip "export PYTHONPATH=\"\$PWD/oq-engine:\$PWD/oq-hazardlib:\$PWD/oq-risklib\" ;
cd oq-engine
DJANGO_SETTINGS_MODULE=openquake.server.settings nosetests -v --with-xunit --xunit-file=xunit-server.xml --with-coverage --cover-package=openquake.server --with-doctest openquake/server/tests/
nosetests -v --with-xunit --xunit-file=xunit-engine.xml --with-coverage --cover-package=openquake.engine --with-doctest openquake/engine/tests/
DJANGO_SETTINGS_MODULE=openquake.server.settings nosetests -v -a '${skip_tests}' --with-xunit --xunit-file=xunit-server.xml --with-coverage --cover-package=openquake.server --with-doctest openquake/server/tests/
nosetests -v -a '${skip_tests}' --with-xunit --xunit-file=xunit-engine.xml --with-coverage --cover-package=openquake.engine --with-doctest openquake/engine/tests/
# OQ Engine QA tests (splitted into multiple execution to track the performance)
nosetests -a 'qa,hazard,classical' -v --with-xunit --xunit-file=xunit-qa-hazard-classical.xml
nosetests -a 'qa,hazard,event_based' -v --with-xunit --xunit-file=xunit-qa-hazard-event-based.xml
nosetests -a 'qa,hazard,disagg' -v --with-xunit --xunit-file=xunit-qa-hazard-disagg.xml
nosetests -a 'qa,hazard,scenario' -v --with-xunit --xunit-file=xunit-qa-hazard-scenario.xml
nosetests -a 'qa,risk,classical' -v --with-xunit --xunit-file=xunit-qa-risk-classical.xml
nosetests -a 'qa,risk,event_based' -v --with-xunit --xunit-file=xunit-qa-risk-event-based.xml
nosetests -a 'qa,risk,classical_bcr' -v --with-xunit --xunit-file=xunit-qa-risk-classical-bcr.xml
nosetests -a 'qa,risk,event_based_bcr' -v --with-xunit --xunit-file=xunit-qa-risk-event-based-bcr.xml
nosetests -a 'qa,risk,scenario_damage' -v --with-xunit --xunit-file=xunit-qa-risk-scenario-damage.xml
nosetests -a 'qa,risk,scenario' -v --with-xunit --xunit-file=xunit-qa-risk-scenario.xml
nosetests -a '${skip_tests}qa,hazard,classical' -v --with-xunit --xunit-file=xunit-qa-hazard-classical.xml
nosetests -a '${skip_tests}qa,hazard,event_based' -v --with-xunit --xunit-file=xunit-qa-hazard-event-based.xml
nosetests -a '${skip_tests}qa,hazard,disagg' -v --with-xunit --xunit-file=xunit-qa-hazard-disagg.xml
nosetests -a '${skip_tests}qa,hazard,scenario' -v --with-xunit --xunit-file=xunit-qa-hazard-scenario.xml
nosetests -a '${skip_tests}qa,risk,classical' -v --with-xunit --xunit-file=xunit-qa-risk-classical.xml
nosetests -a '${skip_tests}qa,risk,event_based' -v --with-xunit --xunit-file=xunit-qa-risk-event-based.xml
nosetests -a '${skip_tests}qa,risk,classical_bcr' -v --with-xunit --xunit-file=xunit-qa-risk-classical-bcr.xml
nosetests -a '${skip_tests}qa,risk,event_based_bcr' -v --with-xunit --xunit-file=xunit-qa-risk-event-based-bcr.xml
nosetests -a '${skip_tests}qa,risk,scenario_damage' -v --with-xunit --xunit-file=xunit-qa-risk-scenario-damage.xml
nosetests -a '${skip_tests}qa,risk,scenario' -v --with-xunit --xunit-file=xunit-qa-risk-scenario.xml
python-coverage xml --include=\"openquake/*\"
"
scp "${lxc_ip}:oq-engine/xunit-*.xml" .
scp "${lxc_ip}:oq-engine/coverage.xml" .
scp "${lxc_ip}:oq-engine/xunit-*.xml" . || true
scp "${lxc_ip}:oq-engine/coverage.xml" . || true
else
if [ -d $HOME/fake-data/oq-engine ]; then
cp $HOME/fake-data/oq-engine/* .
cp $HOME/fake-data/oq-engine/* . || true
fi
fi

Expand Down Expand Up @@ -468,6 +486,9 @@ _pkgtest_innervm_run () {
fi
ssh $lxc_ip "oq-engine --make-html-report today"
scp "${lxc_ip}:jobs-*.html" .

scp -r "$lxc_ip:/usr/share/doc/${GEM_DEB_PACKAGE}/changelog*" .

trap ERR

return
Expand Down Expand Up @@ -544,8 +565,8 @@ _lxc_name_and_ip_get()
lxc_name="$(grep "sudo lxc-console -n $GEM_EPHEM_NAME" $filename | sed "s/.*sudo lxc-console -n \($GEM_EPHEM_NAME\)/\1/g")"
for e in $(seq 1 40); do
sleep 2
if grep -q "$lxc_name" /var/lib/misc/dnsmasq.leases ; then
lxc_ip="$(grep " $lxc_name " /var/lib/misc/dnsmasq.leases | cut -d ' ' -f 3)"
if grep -q "$lxc_name" /var/lib/misc/dnsmasq*.leases ; then
lxc_ip="$(grep " $lxc_name " /var/lib/misc/dnsmasq*.leases | tail -n 1 | cut -d ' ' -f 3)"
break
fi
done
Expand Down Expand Up @@ -630,7 +651,7 @@ devtest_run () {
scp "${lxc_ip}:/tmp/celeryd.log" celeryd.log
scp "${lxc_ip}:ssh.log" devtest.history

sudo lxc-shutdown -n $lxc_name -w -t 10
sudo $LXC_TERM -n $lxc_name

# NOTE: pylint returns errors too frequently to consider them a critical event
if pylint --rcfile pylintrc -f parseable openquake > pylint.txt ; then
Expand Down Expand Up @@ -704,7 +725,7 @@ EOF
scp "${lxc_ip}:/tmp/celeryd.log" celeryd.log
scp "${lxc_ip}:ssh.log" pkgtest.history

sudo lxc-shutdown -n $lxc_name -w -t 10
sudo $LXC_TERM -n $lxc_name
set -e

if [ $inner_ret -ne 0 ]; then
Expand Down Expand Up @@ -849,7 +870,7 @@ ini_suf="$(echo "$ini_vers" | sed -n 's/^[0-9]\+\.[0-9]\+\.[0-9]\+\(.*\)/\1/gp')
# echo "ini [] [$ini_maj] [$ini_min] [$ini_bfx] [$ini_suf]"

# version info from debian/changelog
h="$(head -n1 debian/changelog)"
h="$(grep "^$GEM_DEB_PACKAGE" debian/changelog | head -n 1)"
# pkg_vers="$(echo "$h" | cut -d ' ' -f 2 | cut -d '(' -f 2 | cut -d ')' -f 1 | sed -n 's/[-+].*//gp')"
pkg_name="$(echo "$h" | cut -d ' ' -f 1)"
pkg_vers="$(echo "$h" | cut -d ' ' -f 2 | cut -d '(' -f 2 | cut -d ')' -f 1)"
Expand All @@ -872,22 +893,24 @@ if [ $BUILD_DEVEL -eq 1 ]; then
if [ "$pkg_maj" = "$ini_maj" -a "$pkg_min" = "$ini_min" -a \
"$pkg_bfx" = "$ini_bfx" -a "$pkg_deb" != "" ]; then
deb_ct="$(echo "$pkg_deb" | sed 's/^-//g')"
pkg_deb="-$(( deb_ct + 1 ))"
pkg_deb="-$(( deb_ct ))"
else
pkg_maj="$ini_maj"
pkg_min="$ini_min"
pkg_bfx="$ini_bfx"
pkg_deb="-1"
pkg_deb="-0"
fi

( echo "$pkg_name (${pkg_maj}.${pkg_min}.${pkg_bfx}${pkg_deb}~dev${dt}-${hash}) $pkg_rest"
echo
echo " [Automatic Script]"
echo " * Development version from $hash commit"
echo
cat debian/changelog.orig | sed -n "/^$GEM_DEB_PACKAGE/q;p"
echo " -- $DEBFULLNAME <$DEBEMAIL> $(date -d@$dt -R)"
echo
) > debian/changelog
cat debian/changelog.orig >> debian/changelog
cat debian/changelog.orig | sed -n "/^$GEM_DEB_PACKAGE/,\$ p" >> debian/changelog
rm debian/changelog.orig

sed -i "s/^__version__[ ]*=.*/__version__ = '${pkg_maj}.${pkg_min}.${pkg_bfx}${pkg_deb}~dev${dt}-${hash}'/g" openquake/engine/__init__.py
Expand Down

0 comments on commit 9749e0a

Please sign in to comment.