Skip to content

Commit

Permalink
chore: Rename weak-dependencies to install-weak-dependencies & ad…
Browse files Browse the repository at this point in the history
…d `--refresh` for install operation
  • Loading branch information
fiftydinar authored Dec 22, 2024
1 parent 1137c8b commit eb522e3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion modules/dnf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Specific COPR repositories can also be specified in `copr: user/project` format

If you use a repo that requires adding custom keys (eg. Brave Browser), you can import the keys by declaring the key URLs under `keys:`. The magic string acts the same as it does in `repos`.

Then the module installs the packages declared under `install:` using `dnf -y install`, it removes the packages declared under `remove:` using `dnf -y remove`. If there are packages declared under both `install:` and `remove:` then removal is performed 1st & install 2nd.
Then the module installs the packages declared under `install:` using `dnf -y install --refresh`, it removes the packages declared under `remove:` using `dnf -y remove`. If there are packages declared under both `install:` and `remove:` then removal is performed 1st & install 2nd.

Installing RPM packages directly from a `http(s)` url that points to the RPM file is also supported, you can just put the URLs under `install:` and they'll be installed along with the other packages. The magic string `%OS_VERSION%` is substituted with the current VERSION_ID (major Fedora version) like with the `repos:` property.

Expand Down
6 changes: 3 additions & 3 deletions modules/dnf/dnf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if ! rpm -q dnf5-plugins &>/dev/null; then
fi

# Check if option for weak dependencies is enabled or disabled
WEAK_DEPENDENCIES=$(echo "${1}" | jq -r 'try .["weak-dependencies"]')
WEAK_DEPENDENCIES=$(echo "${1}" | jq -r 'try .["install-weak-dependencies"]')

if [[ -z "${WEAK_DEPENDENCIES}" ]] || [[ "${WEAK_DEPENDENCIES}" == "null" ]] || [[ "${WEAK_DEPENDENCIES}" == "true" ]]; then
WEAK_DEPS_FLAG="--setopt=install_weak_deps=True"
Expand Down Expand Up @@ -138,11 +138,11 @@ if [[ ${#INSTALL_PKGS[@]} -gt 0 && ${#REMOVE_PKGS[@]} -gt 0 ]]; then
echo "Removing: ${REMOVE_PKGS[*]}"
echo_rpm_install
dnf -y "${WEAK_DEPS_FLAG}" remove "${REMOVE_PKGS[@]}"
dnf -y "${WEAK_DEPS_FLAG}" install "${INSTALL_PKGS[@]}"
dnf -y "${WEAK_DEPS_FLAG}" install --refresh "${INSTALL_PKGS[@]}"
elif [[ ${#INSTALL_PKGS[@]} -gt 0 ]]; then
echo "Installing RPMs"
echo_rpm_install
dnf -y "${WEAK_DEPS_FLAG}" install "${INSTALL_PKGS[@]}"
dnf -y "${WEAK_DEPS_FLAG}" install --refresh "${INSTALL_PKGS[@]}"
elif [[ ${#REMOVE_PKGS[@]} -gt 0 ]]; then
echo "Removing RPMs"
echo "Removing: ${REMOVE_PKGS[*]}"
Expand Down
2 changes: 1 addition & 1 deletion modules/dnf/dnf.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ model RpmOstreeModule {
}>;

/** Whether to install weak dependencies during install operation or not. */
"weak-dependencies"?: boolean = true;
"install-weak-dependencies"?: boolean = true;
}
4 changes: 2 additions & 2 deletions modules/dnf/module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: dnf
shortdesc: The dnf module offers pseudo-declarative package and repository management using dnf.
example: |
type: dnf
weak-dependencies: true
install-weak-dependencies: true
repos:
- copr: atim/starship
- https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo
keys:
- https://brave-browser-rpm-release.s3.brave.com/brave-core.asc
optfix:
- Tabby # needed because tabby installs into /opt/Tabby
- Tabby # needed because tabby installs into /opt/Tabby/
- brave.com
install:
- starship
Expand Down

0 comments on commit eb522e3

Please sign in to comment.