From: Markus Lehtonen Date: Thu, 25 Sep 2014 10:03:28 +0000 (+0300) Subject: WIP: Introduce obs-service-gbp-adm command X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e86df2ceec8030a521ca7e6e5bb86f16d7abfbea;p=services%2Fobs-service-git-buildpackage.git WIP: Introduce obs-service-gbp-adm command Change-Id: I82c468f618a5921c3e57af5aafcde2ffb6b5da2a Signed-off-by: Markus Lehtonen --- diff --git a/obs_service_gbp/adm.py b/obs_service_gbp/adm.py new file mode 100755 index 0000000..2ee05b3 --- /dev/null +++ b/obs_service_gbp/adm.py @@ -0,0 +1,41 @@ +#!/usr/bin/python -u +# vim:fileencoding=utf-8:et:ts=4:sw=4:sts=4 +# +# Copyright (C) 2013 Intel Corporation +# +# 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. +"""The repocache-adm tool specific for obs-service-git-buildpackage""" + +import sys + +from repocache_adm.adm import MainCommand as BaseCommand +from obs_service_gbp.command import read_config + +class MainCommand(BaseCommand): + """Class for the command line script""" + @staticmethod + def add_arguments(parser): + """Add arguments""" + # Parse config files + config = read_config() + # Add arguments + parser.set_defaults(cache_dir=config['repo-cache-dir']) + + +if __name__ == '__main__': + sys.exit(MainCommand.main()) + + diff --git a/setup.py b/setup.py index 1f16160..b7c3766 100644 --- a/setup.py +++ b/setup.py @@ -43,6 +43,7 @@ setup(name='obs_service_gbp', 'service/git-buildpackage.service']), ('/etc/obs/services', ['config/git-buildpackage'])], entry_points={ - 'console_scripts': ['repocache-adm = repocache_adm.adm:main'] + 'console_scripts': ['repocache-adm = repocache_adm.adm:main', + 'obs-service-gbp-adm = obs_service_gbp.adm'] } ) diff --git a/tests/test_repocache_adm.py b/tests/test_repocache_adm.py index 30cf9aa..867272e 100644 --- a/tests/test_repocache_adm.py +++ b/tests/test_repocache_adm.py @@ -21,10 +21,11 @@ import mock import os import shutil -from nose.tools import assert_raises, eq_ # pylint: disable=E0611 +from nose.tools import assert_raises, eq_, nottest # pylint: disable=E0611 +import obs_service_gbp.adm +import repocache_adm.adm from gbp_repocache import CachedRepo -from repocache_adm.adm import MainCommand from repocache_adm.common import SubcommandBase from tests import UnitTestsBase @@ -41,7 +42,7 @@ class BadSubcommand(SubcommandBase): class TestRepocacheAdm(UnitTestsBase): """Test repocache-adm command line tool""" - adm = MainCommand.main + adm = repocache_adm.adm.MainCommand.main @classmethod def setup_class(cls): @@ -96,3 +97,14 @@ class TestRepocacheAdm(UnitTestsBase): # Non-existent cache dir eq_(self.adm(['-c', 'non-existent', 'stat']), 1) + +class TestGbpRepocacheAdm(TestRepocacheAdm): + """Test obs-service-gbp-adm command line tool""" + + adm = obs_service_gbp.adm.MainCommand.main + + @nottest + def test_not_implemented(self): + """Skip this test""" + pass +