forked from 0x2620/pandora
add postupdate hook
This commit is contained in:
parent
46bd0ff3bf
commit
8577ec7a77
1 changed files with 15 additions and 0 deletions
15
update.py
15
update.py
|
@ -75,6 +75,14 @@ if __name__ == "__main__":
|
||||||
elif len(sys.argv) == 2 and sys.argv[1] == 'static':
|
elif len(sys.argv) == 2 and sys.argv[1] == 'static':
|
||||||
os.chdir(join(base, 'pandora'))
|
os.chdir(join(base, 'pandora'))
|
||||||
run('./manage.py', 'update_static')
|
run('./manage.py', 'update_static')
|
||||||
|
elif len(sys.argv) == 4 and sys.argv[1] == 'postupdate':
|
||||||
|
os.chdir(base)
|
||||||
|
old = int(sys.argv[2])
|
||||||
|
new = int(sys.argv[3])
|
||||||
|
if old < 3111:
|
||||||
|
run('bzr', 'resolved', 'pandora/moneky_patch', 'pandora/monkey_patch/migrations')
|
||||||
|
if os.path.exists('pandora/monkey_patch'):
|
||||||
|
run('rm', '-r', 'pandora/monkey_patch')
|
||||||
else:
|
else:
|
||||||
|
|
||||||
if len(sys.argv) == 1:
|
if len(sys.argv) == 1:
|
||||||
|
@ -94,6 +102,8 @@ if __name__ == "__main__":
|
||||||
if exists(path):
|
if exists(path):
|
||||||
os.chdir(path)
|
os.chdir(path)
|
||||||
revno = get('bzr', 'revno')
|
revno = get('bzr', 'revno')
|
||||||
|
if repo == 'pandora':
|
||||||
|
pandora_old_revno = revno
|
||||||
current += revno
|
current += revno
|
||||||
url = repos[repo]['url']
|
url = repos[repo]['url']
|
||||||
if 'revision' in repos[repo]:
|
if 'revision' in repos[repo]:
|
||||||
|
@ -103,6 +113,8 @@ if __name__ == "__main__":
|
||||||
run('bzr', 'pull', url)
|
run('bzr', 'pull', url)
|
||||||
revno = get('bzr', 'revno')
|
revno = get('bzr', 'revno')
|
||||||
new += revno
|
new += revno
|
||||||
|
if repo == 'pandora':
|
||||||
|
pandora_new_revno = revno
|
||||||
else:
|
else:
|
||||||
os.chdir(os.path.dirname(path))
|
os.chdir(os.path.dirname(path))
|
||||||
cmd = ['bzr', 'branch', repos[repo]['url']]
|
cmd = ['bzr', 'branch', repos[repo]['url']]
|
||||||
|
@ -124,4 +136,7 @@ if __name__ == "__main__":
|
||||||
if diff != '-- No differences':
|
if diff != '-- No differences':
|
||||||
print 'Database has changed, please make a backup and run ./update.py db'
|
print 'Database has changed, please make a backup and run ./update.py db'
|
||||||
elif current != new:
|
elif current != new:
|
||||||
|
if pandora_old_revno != pandora_new_revno:
|
||||||
|
os.chdir(base)
|
||||||
|
run('./update.py', 'postupdate', pandora_old_revno, pandora_new_revno)
|
||||||
reload_notice(base)
|
reload_notice(base)
|
||||||
|
|
Loading…
Reference in a new issue