From c7c2392058c629afc1c652228cb83ff52d30f071 Mon Sep 17 00:00:00 2001 From: Leonardo Rossetti Date: Apr 22 2022 16:25:25 +0000 Subject: adding --lookaside-structure param --- diff --git a/src/centpkg/__main__.py b/src/centpkg/__main__.py index c696c69..de61b8c 100644 --- a/src/centpkg/__main__.py +++ b/src/centpkg/__main__.py @@ -30,6 +30,7 @@ def main(): """ program_name = os.path.basename(sys.argv[0]) + is_sig = program_name.endswith('-sig') default_user_config_path = os.path.join( os.path.expanduser('~'), '.config', 'rpkg', '%s.conf' % program_name) @@ -45,6 +46,10 @@ def main(): default='/etc/rpkg/%s.conf' % program_name) parser.add_argument('--user-config', help='Specify a user config file to use', default=default_user_config_path) + parser.add_argument('--lookaside-structure', + help='set the lookaside cache structure type use', + choices=['branch', 'hash'], + default='hash') (args, other) = parser.parse_known_args() @@ -57,9 +62,12 @@ def main(): config = ConfigParser.SafeConfigParser() config.read(args.config) config.read(args.user_config) + if is_sig: + config[program_name]['lookaside_structure'] = args.lookaside_structure - client = centpkg.cli.centpkgClient(config, name=program_name) + client = centpkg.cli.centpkgClient(config, name=program_name) client.do_imports(site='centpkg') + client.update_argparser(is_sig=is_sig) client.parse_cmdline() # This is due to a difference argparse behavior to Python 2 version. diff --git a/src/centpkg/cli.py b/src/centpkg/cli.py index faebb0d..d01b969 100755 --- a/src/centpkg/cli.py +++ b/src/centpkg/cli.py @@ -35,6 +35,13 @@ class centpkgClient(cliClient): self.setup_centos_subparsers() + def update_argparser(self, is_sig=False): + if is_sig: + self.parser.add_argument('--lookaside-structure', + help='set the lookaside cache structure type use', + choices=['branch', 'hash'], + default='hash') + def load_cmd(self): super(centpkgClient, self).load_cmd() cfg = self.config[self.get_name()]