diff --git a/mock/docs/mock.1 b/mock/docs/mock.1 index d4319d3c0..2aa031de3 100644 --- a/mock/docs/mock.1 +++ b/mock/docs/mock.1 @@ -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. diff --git a/mock/py/mock.py b/mock/py/mock.py index 3d1a5f42e..75960d1ce 100755 --- a/mock/py/mock.py +++ b/mock/py/mock.py @@ -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', diff --git a/mock/py/mockbuild/util.py b/mock/py/mockbuild/util.py index a8cdd0f39..30dd108c4 100644 --- a/mock/py/mockbuild/util.py +++ b/mock/py/mockbuild/util.py @@ -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 diff --git a/releng/release-notes-next/addrepo-affects-bootstrap.feature b/releng/release-notes-next/addrepo-affects-bootstrap.feature new file mode 100644 index 000000000..a82e71f3a --- /dev/null +++ b/releng/release-notes-next/addrepo-affects-bootstrap.feature @@ -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 --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.