#2571 Add option to use repos from kickstart for livemedia builds
Merged 2 years ago by tkopecek. Opened 2 years ago by breilly.
breilly/koji repodefaults-2260  into  master

file modified
+19 -18
@@ -3023,25 +3023,26 @@ 

          # in the kickstart file. If --repo wasn't specified, then we use the

          # repo associated with the target passed in initially.

          repo_class = kscontrol.dataMap[self.ks.version]['RepoData']

-         self.ks.handler.repo.repoList = []  # delete whatever the ks file told us

-         if opts.get('repo'):

-             user_repos = opts['repo']

-             if isinstance(user_repos, six.string_types):

-                 user_repos = user_repos.split(',')

-             index = 0

-             for user_repo in user_repos:

+         if not opts.get('ksrepo'):

+             self.ks.handler.repo.repoList = []  # delete whatever the ks file told us

+             if opts.get('repo'):

+                 user_repos = opts['repo']

+                 if isinstance(user_repos, six.string_types):

+                     user_repos = user_repos.split(',')

+                 index = 0

+                 for user_repo in user_repos:

+                     self.ks.handler.repo.repoList.append(repo_class(

+                         baseurl=user_repo, name='koji-override-%i' % index))

+                     index += 1

+             else:

+                 path_info = koji.PathInfo(topdir=self.options.topurl)

+                 repopath = path_info.repo(repo_info['id'],

+                                           target_info['build_tag_name'])

+                 baseurl = '%s/%s' % (repopath, arch)

+                 self.logger.debug('BASEURL: %s' % baseurl)

                  self.ks.handler.repo.repoList.append(repo_class(

-                     baseurl=user_repo, name='koji-override-%i' % index))

-                 index += 1

-         else:

-             path_info = koji.PathInfo(topdir=self.options.topurl)

-             repopath = path_info.repo(repo_info['id'],

-                                       target_info['build_tag_name'])

-             baseurl = '%s/%s' % (repopath, arch)

-             self.logger.debug('BASEURL: %s' % baseurl)

-             self.ks.handler.repo.repoList.append(repo_class(

-                 baseurl=baseurl, name='koji-%s-%i' % (target_info['build_tag_name'],

-                                                       repo_info['id'])))

+                     baseurl=baseurl, name='koji-%s-%i' % (target_info['build_tag_name'],

+                                                           repo_info['id'])))

          # inject url if provided

          if opts.get('install_tree_url'):

              self.ks.handler.url(url=opts['install_tree_url'])

file modified
+3 -1
@@ -5703,6 +5703,8 @@ 

                               'default templates.'))

      parser.add_option('--nomacboot', action="store_true",

                        help=_("Pass the nomacboot option to livemedia-creator"))

+     parser.add_option('--ksrepo', action="store_true",

+                       help=_("Do not overwrite repos in the kickstart"))

      (task_options, args) = parser.parse_args(args)

  

      # Make sure the target and kickstart is specified.
@@ -6085,7 +6087,7 @@ 

          'format', 'install_tree_url', 'isoname', 'ksurl',

          'ksversion', 'release', 'repo', 'scratch', 'skip_tag',

          'specfile', 'vcpu', 'vmem', 'volid', 'optional_arches',

-         'lorax_dir', 'lorax_url', 'nomacboot',

+         'lorax_dir', 'lorax_url', 'nomacboot', 'ksrepo',

      ]

      for opt in passthru_opts:

          val = getattr(task_opts, opt, None)

@@ -38,6 +38,7 @@ 

      "lorax_dir": None,

      "lorax_url": None,

      "nomacboot": False,

+     "ksrepo": False,

      "optional_arches": None,

      "volid": None,

  }
@@ -424,6 +425,7 @@ 

                          templates that are to be used to override the default

                          templates.

    --nomacboot           Pass the nomacboot option to livemedia-creator

+   --ksrepo              Do not overwrite repos in the kickstart

  """ % (self.progname))

  

  

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

2 years ago

rebased onto b8c59e0

2 years ago

Updated the logic for ksrepo - initial logic would have used the kickstart repos if they did not exist regardless of the ksrepo option. I was trying to avoid the user attempting to build with no repos defined, but I'm not sure if it's correct to explicitly fail in koji in that circumstance.

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

2 years ago

Commit 3b2b7ce fixes this pull-request

Pull-Request has been merged by tkopecek

2 years ago