#6 Add centpkg-sig
Merged 6 months ago by bstinson. Opened 7 months ago by zlopez.
centos/ zlopez/centpkg centpkg-sig  into  develop

Add centpkg-sig
Michal Konečný • 7 months ago  
file modified
+15 -3

@@ -10,6 +10,14 @@ 

  Exception handling at the top level has been disabled for now to get better

  tracebacks during development. 

  

+ This repository provides two executable scripts centpkg and centpkg-sig.

+ 

+ ## centpkg

+ Executable centpkg allows you to interact with CentOS Stream dist-git and CentOS Stream koji instance.

+ 

+ ## centpkg-sig

+ Executable centpkg-sig allows you to interact with CentOS Linux dist-git and CentOS Linux koji instance.

+ 

  ## Supported commands

  Here is the list currently supported commands by centpkg:

  

@@ -17,17 +25,21 @@ 

  * sources

  * new-sources

  

+ Here is the list currently supported commands by centpkg-sig:

+ 

+ * clone

+ 

  ## Current workflow

  For a sig working on a package in git.centos.org, the following workflow is

  recommended:

  

      # In this example a member of the virt sig would like to scratch-build a2ps on EL6

-     $ centpkg clone -b virt6 a2ps

+     $ centpkg-sig clone -b virt6 a2ps

      $ cd a2ps

-     $ centpkg build --srpm --scratch 

+     $ centpkg-sig build --srpm --scratch 

  

      # Tagged builds can be done also 

-     $ centpkg build --srpm

+     $ centpkg-sig build --srpm

  

  

  ## License

file modified
+5 -1

@@ -28,7 +28,7 @@ 

  BuildRequires: pyrpkg

  

  %description

- Provides the centpkg command for working with dist-git

+ Provides the centpkg and centpkg-sig commands for working with dist-git

  

  %prep

  %setup -q -c

@@ -48,11 +48,15 @@ 

  %defattr(-,root,root,-)

  %doc README.md COPYING

  %config %{_sysconfdir}/rpkg/centpkg.conf

+ %config %{_sysconfdir}/rpkg/centpkg-sig.conf

  %{_bindir}/%{name}

  %{python_sitelib}/*

  

  

  %changelog

+ * Thu Feb 25 2021 mkonecny@redhat.com 0.5.0-1

+ - Add centpkg-sig command

+ 

  * Mon Nov 28 2016 brian@bstinson.com 0.4.6-1

  - Tracking updates to rpkg (thanks pavlix)

  - Fix the URL building code in the sources method

file modified
+2 -2

@@ -40,6 +40,6 @@ 

      package_dir={'': 'src'},

      packages=['centpkg'],

      install_requires=get_requirements(),

-     scripts=['src/bin/centpkg'],

-     data_files=[('/etc/rpkg',['src/centpkg.conf']),]

+     scripts=['src/bin/centpkg', 'src/bin/centpkg-sig'],

+     data_files=[('/etc/rpkg',['src/centpkg.conf', 'src/centpkg-sig.conf']),]

  )

file modified
+1 -1

@@ -16,5 +16,5 @@ 

  from centpkg.__main__ import main

  

  if __name__ == "__main__":

-     main()

+     main(sig=False)

  

file added
+21

@@ -0,0 +1,21 @@ 

+ #!/usr/bin/env python

+ '''

+    centpkg - a script to interact with CentOS Packages

+ '''

+ #

+ # Author(s):

+ #            Brian Stinson <bstinson@ksu.edu>

+ #            Pat Riehecky <riehecky@fnal.gov>

+ #            Michal Konecny <michal.konecny@psmail.xyz>

+ #

+ # 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.  See http://www.gnu.org/copyleft/gpl.html for

+ # the full text of the license.

+ 

+ from centpkg.__main__ import main

+ 

+ if __name__ == "__main__":

+     main(sig=True)

+ 

file modified
+1 -1

@@ -1,4 +1,4 @@ 

- [centpkg]

+ [centpkg-sig]

  lookaside = https://git.centos.org/sources

  lookasidehash = sha512

  lookaside_cgi = https://git.centos.org/sources/upload.cgi

file modified
+17 -12

@@ -24,7 +24,13 @@ 

  import centpkg.cli

  

  

- def main():

+ def main(sig: bool):

+     """

+     Centpkg main.

+ 

+     Params:

+       sig: Flag to switch between centpkg-sig and centpkg.

+     """

      # Setup an argparser and parse the known commands to get the config file

      program_name = os.path.basename(sys.argv[0])

  

@@ -32,20 +38,16 @@ 

      # of commandline arguments with common prefix). Generaly it is available since python3.6.

      # This enables "allow_abbrev" for older python versions.

      parser = pyrpkg.cli.ArgumentParser(add_help=False)

-     parser.add_argument('-S', '--sig', help='Operate as a CentOS SIG user instead of using the Stream distro environment',

-                         default=False,

-                         action='store_true')

-     parser.add_argument('-C', '--config', help='Specify a config file to use')

+     if sig:

+         parser.add_argument('-C', '--config', help='Specify a config file to use',

+                             default='/etc/rpkg/centpkg-sig.conf')

+     else:

+         parser.add_argument('-C', '--config', help='Specify a config file to use',

+                             default='/etc/rpkg/centpkg.conf')

  

  

      (args, other) = parser.parse_known_args()

  

-     if not args.config:

-         if args.sig:

-             args.config = '/etc/rpkg/centpkg-sig.conf'

-         else:

-             args.config = '/etc/rpkg/centpkg.conf'

- 

      # Make sure we have a sane config file

      if not os.path.exists(args.config) and not other[-1] in ['--help', '-h', 'help']:

          sys.stderr.write('Invalid config file %s\n' % args.config)

@@ -55,7 +57,10 @@ 

      config = ConfigParser.SafeConfigParser()

      config.read(args.config)

  

-     client = centpkg.cli.centpkgClient(config)

+     if sig:

+         client = centpkg.cli.centpkgClientSig(config)

+     else:

+         client = centpkg.cli.centpkgClient(config)

      client.do_imports(site='centpkg')

      client.parse_cmdline()

  

file modified
+14 -3

@@ -28,7 +28,18 @@ 

          self.register_parser()

  

      def register_parser(self):

-         self.parser.add_argument('-S', '--sig', help='Operate as a CentOS SIG user instead of using the Stream distro environment',

-                                  default=False,

-                                  action='store_true')

+         pass

  

+ 

+ class centpkgClientSig(cliClient):

+     def __init__(self, config, name=None):

+         self.DEFAULT_CLI_NAME = 'centpkg-sig'

+         super(centpkgClientSig, self).__init__(config, name)

+ 

+         self.setup_centos_subparsers()

+ 

+     def setup_centos_subparsers(self):

+         self.register_parser()

+ 

+     def register_parser(self):

+         pass

Add executable centpkg-sig which allows user to interact with CentOS
Linux dist-git and CentOS Linux koji instance.

Signed-off-by: Michal Kone?ný mkonecny@redhat.com

I think we need to deal with the SOURCES folder as if it was the usual "sources" file.

Pull-Request has been merged by bstinson

6 months ago