#4376 dist-repo, optionally include or exclude drafts
Opened 2 months ago by stevetraylen. Modified 14 days ago
stevetraylen/koji distdraft  into  master

file modified
+3 -3
@@ -6576,11 +6576,11 @@ 

                                                             arch=a,

                                                             latest=opts['latest'],

                                                             inherit=opts['inherit'],

-                                                            rpmsigs=True)

+                                                            rpmsigs=True,

+                                                            draft=None if opts['with_draft'] in (None, True) else False)

  

              for build in builds:

-                 # disable draft for distRepo so far

-                 if build.get('draft'):

+                 if opts['with_draft'] == None and build.get('draft'):

                      raise koji.BuildError("Draft build: %s is not allowed" % build['nvr'])

                  builddirs[build['id']] = koji.pathinfo.build(build)

              rpms += list(rpm_iter)

@@ -7790,6 +7790,10 @@ 

      parser.add_option("--no-skip-stat", action='store_false', default=None, dest='skip_stat',

                        help="Don't skip rpm stat during createrepo "

                             "(override default builder setting)")

+     parser.add_option("--with-draft", action='store_true', default=None, dest='with_draft',

+                       help="Include any draft builds in the tag")

+     parser.add_option("--without-draft", action='store_false', default=None, dest='with_draft',

+                       help="Exclude any draft builds in the tag")

      task_opts, args = parser.parse_args(args)

      if len(args) < 1:

          parser.error('You must provide a tag to generate the repo from')
@@ -7879,6 +7883,7 @@ 

          'zck': task_opts.zck,

          'zck_dict_dir': task_opts.zck_dict_dir,

          'write_signed_rpms': task_opts.write_signed_rpms,

+         'with_draft': task_opts.with_draft,

      }

      if task_opts.skip_stat is not None:

          opts['createrepo_skip_stat'] = task_opts.skip_stat

@@ -360,6 +360,8 @@ 

                          builder setting)

    --no-skip-stat        Don't skip rpm stat during createrepo (override

                          default builder setting)

+   --with-draft          Include any draft builds in the tag

+   --without-draft       Exclude any draft builds in the tag

  """ % self.progname)

  

  

Two new options to koji dist-repo.

  • --with-draft will consider a draft build as the latest build.
  • --without-draft will ignore draft builds and just typically take
    the latest non-draft build.

The default remains and if dist-repo encounters a draft build with
out one of the above options dist-repo will continue to exit.

Motivation here is to allow dist-repo to be used against tags containing
draft builds which is currently not possible.

Examples:

A tag containing two builds:
* myrpm-1.1-37.el9.x86_64.rpm NOT DRAFT
* myrpm-1.1-38.el9.x86_64.rpm DRAFT

koji dist-repo mytag9al-testing
        FAILED: BuildError: Draft build: myrpm-1.1-38.el9,draft_4 is not allowed
koji dist-repo mytag9al-testing --with-draft
         Deploys the DRAFT one.
koji dist-repo mytag9al-testing --without-draft
         Deploys the NOT DRAFT one.

rebased onto fca44b5

14 days ago