#4063 kiwi: Only add buildroot repo if user repositories are not defined
Opened a month ago by tkopecek. Modified 8 days ago
tkopecek/koji pr4061a  into  master

file modified
+6 -6
@@ -351,12 +351,12 @@ 

  

          # user repos

          repos = self.opts.get('repos', [])

-         # buildroot repo

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

-         repos.append(baseurl)

+         if self.opts.get('use_buildroot_repo', True):

+             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)

+             repos.append(baseurl)

  

          base_path = os.path.dirname(desc_path)

          if opts.get('make_prep'):

file modified
+6
@@ -30,6 +30,10 @@ 

      parser.add_option("--type", help="Override default build type from description")

      parser.add_option("--make-prep", action="store_true", default=False,

                        help="Run 'make prep' in checkout before starting the build")

+     parser.add_option("--no-buildroot-repo", action="store_false",

+                       dest="use_buildroot_repo", default=True,

+                       help="Don't add buildroot repo to installation sources, "

+                            "use only those provided by --repo option.")

      parser.add_option("--can-fail", action="store", dest="optional_arches",

                        metavar="ARCH1,ARCH2,...", default="",

                        help="List of archs which are not blocking for build "
@@ -72,6 +76,8 @@ 

          kwargs['arches'] = [canonArch(arch) for arch in options.arches]

      if options.repo:

          kwargs['repos'] = options.repo

+     if not options.use_buildroot_repo:

+         kwargs['use_buildroot_repo'] = False

  

      task_id = session.kiwiBuild(**kwargs)

  

file modified
+3 -1
@@ -17,7 +17,7 @@ 

  @export

  def kiwiBuild(target, arches, desc_url, desc_path, optional_arches=None, profile=None,

                scratch=False, priority=None, make_prep=False, repos=None, release=None,

-               type=None):

+               type=None, use_buildroot_repo=True):

      context.session.assertPerm('image')

      for i in [desc_url, desc_path, profile, release]:

          if i is not None:
@@ -58,6 +58,8 @@ 

          opts['make_prep'] = True

      if type:

          opts['type'] = type

+     if not use_buildroot_repo:

+         opts['use_buildroot_repo'] = False

      return kojihub.make_task('kiwiBuild',

                               [target, arches, desc_url, desc_path, opts],

                               **taskOpts)

Is all the logic right here?

I applied this in our koji and you can see in
https://koji.fedoraproject.org/koji/taskinfo?taskID=116499372

we are passing
repos': ['https://kojipkgs.fedoraproject.org/compose/branched/Fedora-40-20240417.n.0/compose/Everything/$arch/os'],

but the container is building using the buildroot. ;(

I expected it to default to NOT using the buildroot if there is a repo passed...

The flag --no-buildroot-repo needs to be flipped to --use-buildroot-repo instead and default to off when repos is populated.