#55 adding --lookaside-structure param
Closed 2 years ago by tdawson. Opened 2 years ago by lrossett.
centos/ lrossett/centpkg lookaside-cli-param  into  develop

file modified
+9 -1
@@ -30,6 +30,7 @@ 

  

      """

      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 @@ 

                          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 @@ 

      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.

file modified
+7
@@ -35,6 +35,13 @@ 

  

          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()]

Changes

  • Adds an optional parameter --lookaside-structure(centos-sig cli only) - defaults to hash if not used
  • This parameter will overwrite the value from the config file if used
  • It is added twice due to how rpkg works

rpkg now automatically correctly identifies if something requires a dist-git or explodedSRPM layout.
This means we don't really need a lookaside-structure option, because it will be automatic.
But the is-sig variable looks useful.

I'm working on getting centpkg-sig working properly. I'm getting close. When I'm done I'll re-look at this pull request.

This functionality has been implemented with a different pull request. Thank you for this, but I'm closing it without merging.

Pull-Request has been closed by tdawson

2 years ago