Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/feature-hermetic-builds.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ that Mock performs.
components from the internet and places them into a single local
directory—let's call it an *offline repository*.

This repository is also available during the build for inspection or use
inside the buildroot in the `/hermetic_repo` directory.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this note!


**Note:** This step doesn't necessarily have to be done by the Mock project
itself. The *lockfile* is concise enough for further processing and
validation (e.g., ensuring the set of RPMs and the buildroot image come from
Expand Down
6 changes: 6 additions & 0 deletions mock/py/mockbuild/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,12 @@ def process_hermetic_build_config(cmdline_opts, config_opts):

config_opts["offline_local_repository"] = final_offline_repo

# Provide build access to buildroot packages solving same issue as
# https://lists.fedorahosted.org/archives/list/koji-devel@lists.fedorahosted.org/thread/ZIBY53JAURLT3QRBBJIJJ7EZWLZDE3TI/
# keepcache=1 for local repos work only in dnf5 not dnf4
config_opts['plugin_conf']['bind_mount_enable'] = True
config_opts['plugin_conf']['bind_mount_opts']['dirs'].append((final_offline_repo, '/hermetic_repo' ))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The hardcoded string '/hermetic_repo' is a magic string. To improve readability and maintainability, it's better to define this as a constant at the module or function level. For example: HERMETIC_REPO_MOUNT_PATH = '/hermetic_repo'.

References
  1. The repository style guide recommends using uppercase with underscores for constants. Defining '/hermetic_repo' as a constant like HERMETIC_REPO_MOUNT_PATH would align with this convention. (link)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a terrible idea, it would introduce a long range dependency into the code completely unnecessarily.


# We install all the packages at once (for now?). We could inherit the
# command from the previous "online" run, but it often employs a group
# installation command - and we have no groups in the offline repo.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Hermetic build [now|PR#1712] provides access to buildroot repo in
`/hermetic_repo` directory. Normal behaviour for package maintainers is to
expect that `/var/cache/{dnf|yum}` is populated by these packages. Anyway, in
case of "offline" repo which is used by hermetic builds, `dnf4` doesn't
populate that directory, while `dnf5` yes (with `keepcache=1`). Providing also
`/hermetic_repo` in every case would make looking for buildroot packages a bit
easier.
Loading