From 6550bc066e1f3353464f311fcfcd73dea90ff1db Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Wed, 29 Nov 2006 21:21:44 +0000 Subject: [PATCH] * external helper script to set default repo. do not wanted to add this as command to pisi. Because it is clearly a workaround for multirepo problems. Multirepo problems will be handled after the release. --- scripts/pisisdr | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 scripts/pisisdr diff --git a/scripts/pisisdr b/scripts/pisisdr new file mode 100755 index 00000000..4aa83fb5 --- /dev/null +++ b/scripts/pisisdr @@ -0,0 +1,42 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2006, TUBITAK/UEKAE +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# Please read the COPYING file. + +# a Simple helper script for PiSi to set default repo + +import os +import sys + +import pisi +import pisi.context as ctx + +def usage(): + print """ + Usage: + pisisdr reponame + """ + sys.exit(1) + +def main(): + if len(sys.argv) < 2: + usage() + + repo = sys.argv[1] + + try: + pisi.api.init(write=True) + ctx.repodb.set_default_repo(repo) + pisi.api.finalize() + except pisi.lockeddbshelve.Error, e: + print e + +if __name__ == "__main__": + sys.exit(main())