#4063 kiwi: Only add buildroot repo if user repositories are not defined
Merged by tkopecek. Opened by tkopecek.
tkopecek/koji pr4061a  into  master

Download 4063.patch

Issue #4062, extended PR #4061

:thumbsup:

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.

The change itself looks fine, but does not match the description -- "Only add buildroot repo if user repositories are not defined". We either need to update the description or the code.

Implicitly changing the behavior when repos != [] is a backwards-incompatible change. That said, this is a plugin with specialized uses, so perhaps we can make a such a change. Open to discussion here.

Metadata Update from @mikem:
- Pull-request tagged with: discussion

If you are passing repos, I would expect it to use just those... if you needed those repos + buildroot, you could just pass that as an additional repo right?
The only time you should enable buildroot repos is no repos at all are passed it, and I'd be fine if that case was just an error personally.

rebased onto 02d814fbf46184aa007c1b07e3f4fd466951adea

Ok, I've changed it to:
1) use buildroot repo by default if no --repo is used
2) If --repo is used, still allow --buildroot-repo to add the current buildroot repo. (You can still refer to some other/older existing buildroot repo via --repo)

3 new commits added

  • Don't use buildroot repo by default
  • kiwi: option for not using buildroot repo
  • kiwi: Only add buildroot repo if user repositories are not defined

Seems reasonable. Just to be super clear:

3) If --repo is used and --buildroot-repo is not passed, only repo is used (buildroot is not).

Right?

    parser.add_option("--buildroot-repo", action="store_false",
                      dest="use_buildroot_repo", default=False,
                      help="Add buildroot repo to installation sources. This is off by default, "
                           "but uf there is no --repo used, it will be turned on automatically.")
  • should be store_true
  • s/uf/if/
    if options.use_buildroot_repo or not options.repo:
        kwargs['use_buildroot_repo'] = True

Maybe worth printing a message/warning in not options.repo case? E.g. "no repos given, using buildroot repo"

It's worth noting that this will error on an old hub if no repos are given. Probably worth checking the hub version to avoid confusion.

If --repo is used and --buildroot-repo is not passed, only repo is used (buildroot is not).

That is what the current logic says. The option must be explicitly passed and we only pass it if options.use_buildroot_repo or not options.repo

1 new commit added

  • version check + typo fixes

updated

Redundant warning for old hub

$ lkoji --plugin-paths plugins/cli kiwi-build f24 foo bar 
no repos given, using buildroot repo
hub version is < 1.35, buildroot repo is always used in addition to specified repos

Perhaps this?

    if session.hub_version < (1, 35, 0):
        warn("hub version is < 1.35, buildroot repo is always used in addition to specified repos")
    elif options.use_buildroot_repo:
        kwargs['use_buildroot_repo'] = True
    elif not options.repo:
        warn("no repos given, using buildroot repo")
        kwargs['use_buildroot_repo'] = True

1 new commit added

  • improve warnings for older hub

:thumbsup:

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

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

rebased onto faf3d937f4bb4f95f26c1c6c3db5acf32ca4d35c

Commit e18e4006 fixes this pull-request

Pull-Request has been merged by tkopecek

Metadata