diff --git a/README.md b/README.md index 7645536..35210d2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ # RepoCompare -Code to compare Rocky Linux repositories against RHEL 8 ones and produce status information \ No newline at end of file +Code to compare Rocky Linux repositories against RHEL 8 ones and produce status information + +So far, a simple script that you can call to compare like-for-like RHEL 8 vs. Rocky 8 Repos. + +Example call: ```./repo_compare_html.sh RHEL8_BaseOS Rocky8_BaseOS``` + +WARNING: only compares default modules right now! Non-default module comparisons coming soon(tm) + +WARNING: The order of the arguments VERY MUCH MATTERS! For Rocky 8 comparisons, RHEL repos should ALWAYS come first, they are the source to compare against! diff --git a/repo_compare_html.sh b/repo_compare_html.sh new file mode 100755 index 0000000..34cdae1 --- /dev/null +++ b/repo_compare_html.sh @@ -0,0 +1,115 @@ +#!/bin/bash + +# Script takes 2 arguments: SOURCEREPO and TARGETREPO (ex: ./repo_compare_html.sh RHEL8_BaseOS Rocky8_BaseOS ) +# The arguments must be named dnf/yum repos on the system +# +# We will loop through the RPM names from SOURCEREPO, and attempt to find name/version/release matches in TARGETREPO +# An HTML table page will be output showing the differences +# +# -Skip Grube, 2021-06-29 + +REPO1="$1" +REPO2="$2" + +pkglist1=`dnf repoquery --latest-limit 1 --repo ${REPO1} --queryformat "%{name} %{version} %{release}" | grep -vi " subscription "` #| tr '\n' ','` +pkglist2=`dnf repoquery --latest-limit 1 --repo ${REPO2} --queryformat "%{name} %{version} %{release}" | grep -vi " subscription "` + +# Strip ending moduleXYZ and .el8* information away from the release info, as +# They may not match (or will never match in the module's case) +pkglist1=`echo "${pkglist1}" | sed -e 's/\.module.*$/\.module/g' | sed -e 's/\.el.*$//g'` +pkglist2=`echo "${pkglist2}" | sed -e 's/\.module.*$/\.module/g' | sed -e 's/\.el.*$//g'` + + +# Turn the first pkg list into a comma-separated list (instead of newline-separated) +# (makes it easier to use IFS=',' in all of our for loops) +pkglist1=`echo "${pkglist1}" | tr '\n' ','` + + +#echo "$pkglist1" > debug1.txt +#echo "$pkglist2" > debug2.txt + + +# HTML style header for table: +echo "
${REPO1} Version | ${REPO2} Version |
---|---|
${_name}-${_version}-${_tag} | (DOES NOT EXIST) |
${_name}-${_version}-${_tag} | ${pkgmatches} |