-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: dnf
module
#377
base: main
Are you sure you want to change the base?
feat: dnf
module
#377
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
shellcheck
Did you forget to close this double quoted string? SC1078
Line 91 in cd91b05
CLASSIC_PKGS+=("${PKG}") |
📝 [shellcheck] reported by reviewdog 🐶
This is actually an end quote, but due to next char it looks suspect. SC1079
Line 98 in cd91b05
echo "Installing: ${CLASSIC_PKGS[*]}" |
🚫 [shellcheck] reported by reviewdog 🐶
'(' is invalid here. Did you forget to escape it? SC1036
Line 100 in cd91b05
echo "Installing package(s) directly from URL: ${HTTPS_PKGS[*]}" |
🚫 [shellcheck] reported by reviewdog 🐶
Expected 'fi' matching previously mentioned 'if'. SC1047
Line 100 in cd91b05
echo "Installing package(s) directly from URL: ${HTTPS_PKGS[*]}" |
🚫 [shellcheck] reported by reviewdog 🐶
Expected 'fi'. Fix any mentioned problems and try again. SC1072
Line 100 in cd91b05
echo "Installing package(s) directly from URL: ${HTTPS_PKGS[*]}" |
modules/rpm-ostree/rpm-ostree.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modules/rpm-ostree/rpm-ostree.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[shellcheck] reported by reviewdog 🐶
modules/modules/rpm-ostree/rpm-ostree.sh
Line 72 in 1137c8b
INSTALL_PKGS[$i]="${PKG//%OS_VERSION%/${OS_VERSION}}" |
modules/rpm-ostree/rpm-ostree.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote this to prevent word splitting. SC2046
modules/modules/rpm-ostree/rpm-ostree.sh
Line 115 in 1137c8b
rpm-ostree override remove "${REMOVE_PKGS[@]}" $(printf -- "--install=%s " "${CLASSIC_PKGS[@]}") |
modules/rpm-ostree/rpm-ostree.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote this to prevent word splitting. SC2046
modules/modules/rpm-ostree/rpm-ostree.sh
Line 117 in 1137c8b
rpm-ostree override remove "${REMOVE_PKGS[@]}" $(printf -- "--install=%s " "${CLASSIC_PKGS[@]}") |
modules/rpm-ostree/rpm-ostree.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote this to prevent word splitting. SC2046
modules/modules/rpm-ostree/rpm-ostree.sh
Line 120 in 1137c8b
rpm-ostree override remove "${REMOVE_PKGS[@]}" $(printf -- "--install=%s " "${CLASSIC_PKGS[@]}") |
modules/rpm-ostree/rpm-ostree.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quote this to prevent word splitting. SC2046
modules/modules/rpm-ostree/rpm-ostree.sh
Line 123 in 1137c8b
rpm-ostree override remove "${REMOVE_PKGS[@]}" $(printf -- "--install=%s " "${CLASSIC_PKGS[@]}") |
modules/rpm-ostree/rpm-ostree.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
modules/modules/rpm-ostree/rpm-ostree.sh
Line 185 in 1137c8b
rpm-ostree override replace --experimental --from "repo=copr:copr.fedorainfracloud.org:${MAINTAINER}:${REPO_NAME}" ${REPLACE_STR} |
Co-authored-by: Gerald Pinder <[email protected]>
Co-authored-by: Gerald Pinder <[email protected]>
Co-authored-by: Gerald Pinder <[email protected]>
Co-authored-by: Gerald Pinder <[email protected]>
Co-authored-by: Gerald Pinder <[email protected]>
for i in "${!REPOS[@]}"; do | ||
repo="${REPOS[$i]}" | ||
repo="${repo//%OS_VERSION%/${OS_VERSION}}" | ||
REPOS[$i]="${repo//[$'\t\r\n ']}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Gerald Pinder <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting an error when running a basic install:
l/jp-desktop-nvidia:latest => #25 0.447 ============================== Start 'dnf' Module ==============================
l/jp-desktop-nvidia:latest => #25 0.531 Installing RPMs
l/jp-desktop-nvidia:latest => #25 0.531 Installing: @kde-desktop
l/jp-desktop-nvidia:latest => #25 0.578 Updating and loading repositories:
l/jp-desktop-nvidia:latest => #25 0.800 Fedora 41 openh264 (From Cisco) - x86_ 100% | 6.5 KiB/s | 989.0 B | 00m00s
l/jp-desktop-nvidia:latest => #25 1.161 Fedora 41 - x86_64 100% | 85.6 KiB/s | 30.8 KiB | 00m00s
l/jp-desktop-nvidia:latest => #25 1.256 Fedora 41 - x86_64 - Updates Archive 100% | 36.2 KiB/s | 3.4 KiB | 00m00s
l/jp-desktop-nvidia:latest => #25 1.416 Fedora 41 - x86_64 - Updates 100% | 184.9 KiB/s | 29.4 KiB | 00m00s
l/jp-desktop-nvidia:latest => #25 1.483 Repositories loaded.
l/jp-desktop-nvidia:latest => #25 1.952 Failed to resolve the transaction:
l/jp-desktop-nvidia:latest => #25 1.952 No match for argument:
l/jp-desktop-nvidia:latest => #25 1.952 No match for argument:
l/jp-desktop-nvidia:latest => #25 1.952 No match for argument:
l/jp-desktop-nvidia:latest => #25 1.952 Package "toolbox-0.1.1-1.fc41.x86_64" is already installed.
l/jp-desktop-nvidia:latest => #25 1.952 Package "udisks2-2.10.1-6.fc41.x86_64" is already installed.
l/jp-desktop-nvidia:latest => #25 1.952 You can try to add to command line:
l/jp-desktop-nvidia:latest => #25 1.952 --skip-unavailable to skip unavailable packages
l/jp-desktop-nvidia:latest => #25 1.963 ============================= Failed 'dnf' Module =============================
This indicates to me that it's seeing the empty args as packages. This might be a case where we actually don't want to encapsulate the args in "
.
Ok just tested my suggested changes locally. They do fix the problem I ran into. |
… part 1 Co-authored-by: Gerald Pinder <[email protected]>
… part 2 Co-authored-by: Gerald Pinder <[email protected]>
… part 3 Co-authored-by: Gerald Pinder <[email protected]>
… part 4 Co-authored-by: Gerald Pinder <[email protected]>
… part 5 Co-authored-by: Gerald Pinder <[email protected]>
… part 6 Co-authored-by: Gerald Pinder <[email protected]>
echo "Removing: ${GROUP_REMOVE[*]}" | ||
echo "Installing: ${GROUP_INSTALL[*]}" | ||
dnf -y group remove "${GROUP_REMOVE[@]}" | ||
dnf -y ${WEAK_DEPS_FLAG} group install --refresh ${SKIP_UNAVAILABLE_FLAG} ${SKIP_BROKEN_FLAG} ${ALLOW_ERASING_FLAG} "${GROUP_INSTALL[@]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "Removing: ${GROUP_REMOVE[*]}" | ||
echo "Installing: ${GROUP_INSTALL[*]}" | ||
dnf -y group remove "${GROUP_REMOVE[@]}" | ||
dnf -y ${WEAK_DEPS_FLAG} group install --refresh ${SKIP_UNAVAILABLE_FLAG} ${SKIP_BROKEN_FLAG} ${ALLOW_ERASING_FLAG} "${GROUP_INSTALL[@]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "Removing: ${GROUP_REMOVE[*]}" | ||
echo "Installing: ${GROUP_INSTALL[*]}" | ||
dnf -y group remove "${GROUP_REMOVE[@]}" | ||
dnf -y ${WEAK_DEPS_FLAG} group install --refresh ${SKIP_UNAVAILABLE_FLAG} ${SKIP_BROKEN_FLAG} ${ALLOW_ERASING_FLAG} "${GROUP_INSTALL[@]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "Removing: ${GROUP_REMOVE[*]}" | ||
echo "Installing: ${GROUP_INSTALL[*]}" | ||
dnf -y group remove "${GROUP_REMOVE[@]}" | ||
dnf -y ${WEAK_DEPS_FLAG} group install --refresh ${SKIP_UNAVAILABLE_FLAG} ${SKIP_BROKEN_FLAG} ${ALLOW_ERASING_FLAG} "${GROUP_INSTALL[@]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elif [[ ${#GROUP_INSTALL[@]} -gt 0 ]]; then | ||
echo "Installing RPM groups" | ||
echo "Installing: ${GROUP_INSTALL[*]}" | ||
dnf -y ${WEAK_DEPS_FLAG} group install --refresh ${SKIP_UNAVAILABLE_FLAG} ${SKIP_BROKEN_FLAG} ${ALLOW_ERASING_FLAG} "${GROUP_INSTALL[@]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elif [[ ${#REMOVE_PKGS[@]} -gt 0 ]]; then | ||
echo "Removing RPMs" | ||
echo "Removing: ${REMOVE_PKGS[*]}" | ||
dnf -y remove ${REMOVE_UNUSED_DEPS_FLAG} "${REMOVE_PKGS[@]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "Replacing packages from repository: '${REPO}'" | ||
echo "Replacing: ${PACKAGES[*]}" | ||
|
||
dnf -y ${WEAK_DEPS_FLAG} distro-sync --refresh ${SKIP_UNAVAILABLE_FLAG} ${SKIP_BROKEN_FLAG} ${ALLOW_ERASING_FLAG} --repo "${REPO}" "${PACKAGES[@]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "Replacing packages from repository: '${REPO}'" | ||
echo "Replacing: ${PACKAGES[*]}" | ||
|
||
dnf -y ${WEAK_DEPS_FLAG} distro-sync --refresh ${SKIP_UNAVAILABLE_FLAG} ${SKIP_BROKEN_FLAG} ${ALLOW_ERASING_FLAG} --repo "${REPO}" "${PACKAGES[@]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "Replacing packages from repository: '${REPO}'" | ||
echo "Replacing: ${PACKAGES[*]}" | ||
|
||
dnf -y ${WEAK_DEPS_FLAG} distro-sync --refresh ${SKIP_UNAVAILABLE_FLAG} ${SKIP_BROKEN_FLAG} ${ALLOW_ERASING_FLAG} --repo "${REPO}" "${PACKAGES[@]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "Replacing packages from repository: '${REPO}'" | ||
echo "Replacing: ${PACKAGES[*]}" | ||
|
||
dnf -y ${WEAK_DEPS_FLAG} distro-sync --refresh ${SKIP_UNAVAILABLE_FLAG} ${SKIP_BROKEN_FLAG} ${ALLOW_ERASING_FLAG} --repo "${REPO}" "${PACKAGES[@]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes
Recipe format
Existing features code changes
dnf -y config-manager addrepo --from-repofile=$repo
for repo URLs & repo files, while COPR repos are using nativednf -y copr enable user/project
.COPR repos are written in separate
copr:
array & in simpleruser/project
format in recipe, instead of long URL inrepos:
array.rpm-ostree override remove --install=$pkg
is replaced with 2 operations ofdnf
removal & then install.Single operation of removal + installation of
dnf
doesn't currently exist, but it's not a breaking behavior to not have it.rpm-ostree override replace
is replaced withdnf -y distro-sync --refresh --repo $repo $packages
, which is compatible with all repos.Adding the repository along with replacement is disabled, so it must be done before replacement in
repos:
array if repo doesn't exist./opt/
if it's already symlinked in bothdnf
&rpm-ostree
module (thanks to @lorduskordus for the fix)New features
dnf group
removal & installation. Those are declared asgroup-remove
&group-install
array in recipe.They run before the packages installation.
install-weak-dependencies:
option for declaring if weak dependencies (such as Recommended) should be installed.It modifies the install & replace commands itself using
--setopt=install_weak_deps=True/False
flag, it doesn't modify thednf
config file. It defaults totrue
(reflectingdnf
defaults).skip-unavailable-packages:
option for skipping unavailable packages when not available in repositories, or when not available on the system in case of replacing. Passes--skip-unavailable
flag. Defaults to false.skip-broken-packages:
option for skipping the installation/replacement of broken packages. Passes--skip-broken
flag. Defaults to false.allow-erasing-packages
: option for erasing/removing the problematic packages during dependency problems. Passes--allowerasing
flag. Defaults to false.remove-unused-dependencies
is true by default. If false is specified, it passes the--no-autoremove
flag, which won't remove any unused dependencies during removal operation.Issues to be closed
Fixes: #361
Fixes: #370
Fixes: #365
Fixes: #325
Fixes: #282