Skip to content

Commit

Permalink
fix bug 1161812 - put revision files in root of package
Browse files Browse the repository at this point in the history
  • Loading branch information
rhelmer committed May 20, 2015
1 parent 1dd1e01 commit 22316fc
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 17 deletions.
9 changes: 5 additions & 4 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ source "$VIRTUAL_ENV/bin/activate"
${VIRTUAL_ENV}/bin/pip install tools/peep-2.4.tar.gz
${VIRTUAL_ENV}/bin/peep install --download-cache=./pip-cache -r requirements.txt

if [ ! -n "${SOCORRO_DEVELOPMENT_ENV+1}" ]; then
# install socorro in local virtualenv
${VIRTUAL_ENV}/bin/python setup.py install
else
if [ -n "${SOCORRO_DEVELOPMENT_ENV+1}" ]; then
# install development egg in local virtualenv
${VIRTUAL_ENV}/bin/python setup.py develop
fi
Expand Down Expand Up @@ -51,6 +48,10 @@ done
popd

# bootstrap webapp
OLD_PYTHONPATH=$PYTHONPATH
export PYTHONPATH=$(pwd):$PYTHONPATH
pushd webapp-django
./bin/bootstrap.sh
export PYTHONPATH=$OLD_PYTHONPATH

popd
14 changes: 10 additions & 4 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,22 @@ if [ "$BUILD_TYPE" == "tar" ]; then
popd
fi

# record current git revision in install dir
git rev-parse HEAD > $BUILD_DIR/application/socorro/external/postgresql/socorro_revision.txt
cp $BUILD_DIR/stackwalk/revision.txt $BUILD_DIR/application/socorro/external/postgresql/breakpad_revision.txt
# record current git revision in root of install dir
git rev-parse HEAD > socorro_revision.txt
cp $BUILD_DIR/stackwalk/revision.txt breakpad_revision.txt

# Write down build number, if ran by Jenkins
if [ -n "$BUILD_NUMBER" ]
then
echo "$BUILD_NUMBER" > $BUILD_DIR/JENKINS_BUILD_NUMBER
echo "$BUILD_NUMBER" > JENKINS_BUILD_NUMBER
else
echo "unknown" > JENKINS_BUILD_NUMBER
fi

if [ "$BUILD_TYPE" != "tar" ]; then
BUILD_DIR=${BUILD_DIR%%/data/socorro}
fi

# install socorro in local virtualenv
# this must run at the end to capture any generated files above
${VIRTUAL_ENV}/bin/python setup.py install
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,7 @@ def read(fname):
glob.glob('socorro/external/postgresql/raw_sql/views/*.sql')),
('socorro/external/postgresql/raw_sql/types',
glob.glob('socorro/external/postgresql/raw_sql/types/*.sql')),
('socorro', ['socorro_revision.txt', 'breakpad_revision.txt',
'JENKINS_BUILD_NUMBER'])
],
),
11 changes: 4 additions & 7 deletions socorro/external/postgresql/server_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import logging
import os

from pkg_resources import resource_string

from socorro.external.postgresql.base import PostgreSQLBase
from socorro.lib import datetimeutil, external_common

Expand Down Expand Up @@ -83,13 +85,8 @@ def get(self, **kwargs):
schema_revision = "Unknown"

# Find the current breakpad and socorro revisions
basedir = os.path.dirname(__file__)
socorro_revision = open(
os.path.join(basedir, 'socorro_revision.txt')
).read().strip()
breakpad_revision = open(
os.path.join(basedir, 'breakpad_revision.txt')
).read().strip()
socorro_revision = resource_string('socorro', 'socorro_revision.txt')
breakpad_revision = resource_string('socorro', 'breakpad_revision.txt')

return {
"hits": stats,
Expand Down
3 changes: 2 additions & 1 deletion socorro/unittest/external/postgresql/test_server_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import datetime
import os
import socorro
from nose.plugins.attrib import attr
from nose.tools import eq_

Expand All @@ -23,7 +24,7 @@ def setUp(self):
super(IntegrationTestServerStatus, self).setUp()

# Create fake revision files
self.basedir = os.path.dirname(server_status.__file__)
self.basedir = os.path.dirname(socorro.__file__)
open(os.path.join(
self.basedir, 'socorro_revision.txt'
), 'w').write('42')
Expand Down
4 changes: 3 additions & 1 deletion socorro/unittest/middleware/test_middleware_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import urllib
import re

import socorro

from paste.fixture import TestApp, AppError
from nose.plugins.attrib import attr
from nose.tools import eq_, ok_, assert_raises
Expand Down Expand Up @@ -945,7 +947,7 @@ def test_server_status(self):
from socorro.external.postgresql import server_status

# Create fake revision files
self.basedir = os.path.dirname(server_status.__file__)
self.basedir = os.path.dirname(socorro.__file__)
open(os.path.join(
self.basedir, 'socorro_revision.txt'
), 'w').write(socorro_revision)
Expand Down
3 changes: 3 additions & 0 deletions webapp-django/bin/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ echo "Starting tests..."
export SECRET_KEY="doesn't matter, tests"
export CACHE_BACKEND="django.core.cache.backends.locmem.LocMemCache"
export CACHE_LOCATION="crashstats"
export OLD_PYTHONPATH=$PYTHONPATH
export PYTHONPATH=../:$PYTHONPATH
FORCE_DB=true python manage.py test --noinput
export PYTHONPATH=$OLD_PYTHONPATH
echo "Tests finished."

0 comments on commit 22316fc

Please sign in to comment.