#3417 save source for wrapperRPM
Opened 2 months ago by tkopecek. Modified 8 days ago
tkopecek/koji issue3409  into  master

file modified
+8 -1
@@ -2065,6 +2065,8 @@ 

                             srcdir=specdir,

                             buildroot=buildroot)

  

+         # get the source before chown, git > 2.35.2 would refuse to that later

+         source = scm.get_source()

          spec_template = None

          for path, dir, files in os.walk(specdir):

              files.sort()
@@ -2132,6 +2134,10 @@ 

              h = koji.get_rpm_header(srpm)

              data = koji.get_header_fields(h, ['name', 'version', 'release', 'epoch'])

              data['task_id'] = self.id

+             data['source'] = source['source']

+             data['extra'] = {'source': {'original_url': source['url']}}

+             if opts.get('custom_user_metadata'):

+                 data['extra']['custom_user_metadata'] = opts['custom_user_metadata']

              self.logger.info("Reading package config for %(name)s" % data)

              pkg_cfg = self.session.getPackageConfig(build_target['dest_tag'], data['name'])

              if not opts.get('skip_tag'):
@@ -2201,7 +2207,8 @@ 

          results = {'buildroot_id': buildroot.id,

                     'srpm': srpm,

                     'rpms': rpms,

-                    'logs': logs}

+                    'logs': logs,

+                    'source': source}

  

          if not task:

              # Called as a standalone top-level task, so handle the rpms now.

rebased onto 26bf705

2 months ago

pretty please pagure-ci rebuild

17 days ago

Overall notion of enhancing the saved data for WrapperRPM builds is find and the code looks good overall.

This PR does more than it says. The title only mentions saving source, but it also:

  • saves logs
  • saves custom_user_metadata

Saving the logs isn't mentioned here or in the original issue, though it is certainly a valid feature to add. We should make sure the title/description of the PR is accurate.

The bit with custom_user_metadata probably needs some adjustment. This change propagates the field from the task opts to extra, as the build task does. However, we don't provide a way to set that opt, short of calling the api directly. We should probably add the --custom-user-metadata option to the wrapper-rpm command.

It's also worth noting that many wrapperRPM tasks are triggered as subtasks of other tasks, and this makes me wonder if we need to propagate that option (granted, none of those tasks have a --custom-user-metadata option either. This sort of propagation might be out of scope for this issue.

I'm a little uncertain how we want custom-user-metadata to work outside the fairly narrow scope where it was first introduced. It might be best to leave this out and revisit it later.

Metadata