-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reimplement repoquery in a more generic way
This approach is based on rpmdist-repoquery where a certain directory structure is used to track repositories. That is then selected, together with a releasever. Our own repositories are made generic by using DNF_VAR_$var, which makes branching easier. It also uses true modularity. For that it hacks together a temporary installroot and uses fakeroot to pretend to be root, because dnf insists you need to be root to enable a module. Due to only using real DNF, we can rely on the modulary metadata and dependency resolution to select the correct modules. Again, reducing duplication. A major motivation for this is the upcoming CentOS Stream 8 EOL where the repositories will be archived. This new repository structure allows easy switching to another Enterprise Linux for repoclosure checks. This needs a different approach in how we configure repoclosure in obal and the wrapper scripts should probably live in another repository as well. Another excercise is the EL7 repoclosure check.
- Loading branch information
Showing
9 changed files
with
131 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/usr/share/rpmdistro-repoquery/distros/centos-stream-legacy/centos-stream-legacy.repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../centos-stream/foreman-staging.repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../centos-stream/puppet.repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[foreman-$foremanver-staging] | ||
name=Foreman $foremanver staging EL$releasever | ||
baseurl=https://stagingyum.theforeman.org/foreman/$foremanver/el$releasever/$basearch/ | ||
module_hotfixes=1 | ||
enable=0 | ||
gpgcheck=0 | ||
|
||
[foreman-plugins-$foremanver-staging] | ||
name=Foreman Plugins $foremanver staging EL$releasever | ||
baseurl=https://stagingyum.theforeman.org/plugins/$foremanver/el$releasever/$basearch/ | ||
module_hotfixes=1 | ||
enable=0 | ||
gpgcheck=0 | ||
|
||
[foreman-client-$foremanver-staging] | ||
name=Foreman Client $foremanver staging EL$releasever | ||
baseurl=https://stagingyum.theforeman.org/client/$foremanver/el$releasever/$basearch/ | ||
enable=0 | ||
gpgcheck=0 | ||
|
||
[katello-$katellover-staging] | ||
name=Katello $katellover staging EL$releasever | ||
baseurl=https://stagingyum.theforeman.org/katello/$katellover/el$releasever/$basearch/ | ||
module_hotfixes=1 | ||
enable=0 | ||
gpgcheck=0 | ||
|
||
[candlepin-$candlepinver-staging] | ||
name=Candlepin $candlepinver staging EL$releasever | ||
baseurl=https://stagingyum.theforeman.org/candlepin/$candlepinver/el$releasever/$basearch/ | ||
module_hotfixes=1 | ||
enable=0 | ||
gpgcheck=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[puppet$puppetver] | ||
name=Puppet $puppetver Repository el $releasever - $basearch | ||
baseurl=http://yum.puppet.com/puppet$puppetver/el/$releasever/$basearch | ||
gpgkey=https://yum.puppet.com/RPM-GPG-KEY-puppet-20250406 | ||
enabled=0 | ||
gpgcheck=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[main] | ||
keepcache=1 | ||
debuglevel=2 | ||
reposdir=/dev/null | ||
logdir=/tmp/log/dnf | ||
retries=20 | ||
obsoletes=1 | ||
gpgcheck=0 | ||
best=1 | ||
install_weak_deps=0 | ||
metadata_expire=6h | ||
mdpolicy=group:primary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/bash | ||
|
||
# Script to configure across different RPM-based distributions | ||
# Based on rpmdistro-repoquery | ||
# License: MIT | ||
# See LICENSE for license information | ||
|
||
if (( $# < 2 )); then | ||
echo "Usage: $0 <distro> <releasever> [<options> ...]" | ||
exit 1 | ||
fi | ||
repos=$1 | ||
releasever=$2 | ||
module_platform="" | ||
repos_loc=$(dirname "$1") | ||
# if config is a path to an directory, use it | ||
# otherwise use the system installation | ||
if [ -d "${repos}" ]; then | ||
repos_loc=$(dirname "$1") | ||
repos=$(basename "$1") | ||
elif [[ "${repos}" =~ "/" ]]; then | ||
echo "ERROR: specified repos path does not exist" | ||
exit 1 | ||
else | ||
repos_loc=/usr/share/rpmdistro-repoquery/distros | ||
fi | ||
|
||
if [[ "${repos}" =~ "centos" ]]; then | ||
module_platform="--setopt=module_platform_id=platform:el${2}" | ||
fi | ||
|
||
if [[ "${repos}" =~ "mageia" ]]; then | ||
DNF_VAR_distarch=$(rpm --eval "%{_target_cpu}") | ||
export DNF_VAR_distarch | ||
fi | ||
|
||
if [[ "${repos}" =~ "sle-bci" ]]; then | ||
arr=(${releasever//./ }) | ||
if [ "${#arr[@]}" -gt "1" ]; then | ||
DNF_VAR_releaseversp="${arr[0]}-SP${arr[1]}" | ||
else | ||
DNF_VAR_releaseversp="${arr[0]}" | ||
fi | ||
export DNF_VAR_releaseversp | ||
fi | ||
|
||
dnf --config="${repos_loc}/dnf.conf" --setopt=reposdir="${repos_loc}/${repos}" --releasever="${releasever}" ${module_platform} --nogpgcheck "${@:3}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
DNF_VAR_foremanver=nightly | ||
DNF_VAR_katellover=nightly | ||
DNF_VAR_candlepinver=nightly | ||
DNF_VAR_puppetver=7 | ||
|
||
export DNF_VAR_foremanver DNF_VAR_katellover DNF_VAR_candlepinver DNF_VAR_puppetver | ||
|
||
repoclosure() { | ||
local distro releasever module | ||
distro=./distros/$1 | ||
releasever=$2 | ||
module=$3 | ||
|
||
if [[ -n $module ]] ; then | ||
# DNF needs root to enable modules | ||
INSTALLROOT=$(mktemp -d) | ||
|
||
fakeroot ./dnfwrapper "$distro" "$releasever" module enable "$module" -y --installroot "$INSTALLROOT" | ||
fakeroot ./dnfwrapper "$distro" "$releasever" repoclosure --installroot "$INSTALLROOT" "${@:4}" | ||
|
||
rm -rf "$INSTALLROOT" | ||
else | ||
./dnfwrapper "$distro" "$releasever" repoclosure "${@:4}" | ||
fi | ||
} | ||
|
||
repoclosure centos-stream 9 "" --check foreman-${DNF_VAR_foremanver}-staging --enablerepo puppet7 | ||
repoclosure centos-stream-legacy 8 foreman-devel:el8 --check foreman-${DNF_VAR_foremanver}-staging --enablerepo puppet7 |
This file was deleted.
Oops, something went wrong.