Skip to content

Commit

Permalink
Ensure --addrepo option also affects bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
praiskup authored and xsuchy committed Sep 24, 2024
1 parent f67293f commit d4c1269
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
7 changes: 3 additions & 4 deletions mock/docs/mock.1
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,9 @@ Note: While you can specify more commands on a command line, only one can be exe
.LP
.TP
\fB\-a\fR, \fB\-\-addrepo\fR=\fIREPO\fP
Add this repo baseurl to the yumconfig for the chroot. This can be specified
multiple times. Let's you point to multiple paths beyond the default to pull
build deps from.

Add a repo baseurl to the DNF/YUM configuration for both the build chroot and
the bootstrap chroot. This option can be specified multiple times, allowing you
to reference multiple repositories in addition to the default repository set.
.TP
\fB\-\-arch\fR=\fIARCH\fP
Calls the Linux personality() syscall to tell the kernel to emulate a secondary architecture. For example, building i386 packages on an x86_64 buildhost.
Expand Down
10 changes: 7 additions & 3 deletions mock/py/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,13 @@ def command_parse():
parser.add_option('-c', '--continue', default=False, action='store_true',
dest='cont',
help="if a pkg fails to build, continue to the next one")
parser.add_option('-a', '--addrepo', default=[], action='append',
dest='repos',
help="add these repo baseurls to the chroot's yum config")
parser.add_option(
'-a', '--addrepo', default=[], action='append', dest='repos',
metavar="REPO", help=(
"Add a repo baseurl to the DNF/YUM configuration for both the "
"build chroot and the bootstrap chroot. This option can be "
"specified multiple times, allowing you to reference multiple "
"repositories in addition to the default repository set."))
parser.add_option('--recurse', default=False, action='store_true',
help="if more than one pkg and it fails to build, try to build the rest and come back to it")
parser.add_option('--tmp_prefix', default=None, dest='tmp_prefix',
Expand Down
7 changes: 6 additions & 1 deletion mock/py/mockbuild/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,11 +991,16 @@ def add_local_repo(config_opts, baseurl, repoid=None, bootstrap=None):
best=1
""".format(repoid=repoid, baseurl=baseurl)

config_opts['{0}.conf'.format(config_opts['package_manager'])] += localyumrepo
def _fix_cfg(cfg):
cfg['dnf.conf'] += localyumrepo

_fix_cfg(config_opts)

if bootstrap is None:
return

_fix_cfg(bootstrap.config)

if not baseurl.startswith("file:///") and not baseurl.startswith("/"):
return

Expand Down
8 changes: 8 additions & 0 deletions releng/release-notes-next/addrepo-affects-bootstrap.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The `--addrepo` option has been updated to affect both the bootstrap chroot
installation and the buildroot installation, as requested in [issue#1414][].
However, be cautious, as Mock [aggressively caches the bootstrap][issue#1289].
Always remember to run `mock -r <chroot> --scrub=bootstrap` first.
Additionally, as more chroots are being switched to `bootstrap_image_ready =
True`, you'll likely need to use `--addrepo` **in combination with**
`--no-bootstrap-image`; otherwise, the bootstrap chroot installation will remain
unaffected.

0 comments on commit d4c1269

Please sign in to comment.