Add script for individual package comparisons #1

Open
raktajino wants to merge 1 commits from manual_compare into main
2 changed files with 35 additions and 6 deletions

View File

@ -11,7 +11,7 @@ These scripts can be called against any repositories, but are designed to compar
## QuickStart:
How to get a friendly HTML menu comparison of RHEL vs. Rocky (like the one published on https://repocompare.rockylinux.org ):
How to get a friendly HTML menu comparison of RHEL vs. Rocky (like the one published on https://repocompare.rockylinux.org ):
1. Have a subscribed Red Hat Enterprise Linux 8 or 9 machine you are running this on, with root access.
2. Clone or copy this repository on to the subscribed machine.
@ -29,8 +29,8 @@ How to get a friendly HTML menu comparison of RHEL vs. Rocky (like the one publi
## Base repocompare script:
The base script is **repo_compare_html.sh**, and takes a source repo and destination repo as arguments:
The base script is **repo_compare_html.sh**, and takes a source repo and destination repo as arguments:
```./repo_compare_html.sh RepoA RepoB > output.html```
@ -66,7 +66,7 @@ WARNING: As with the above script, the order of the arguments absolutely matter
## Running Comparisons Across Entire Distro
Some support scripts and HTML templates have been included
Some support scripts and HTML templates have been included
A couple support scripts are also in the repository:
**mkrepofile.sh :** Create repo files for Rocky and duplicate ones with friendly names for the RHEL repos (and extract+place subscription entitlement info from RHEL, which rotates regularly)
@ -76,13 +76,18 @@ A couple support scripts are also in the repository:
**repo_compare_launcher.sh :** Run all combinations of repocompare RHEL <---> Rocky. Compares 8 and 9 production, staging, source, modules, RHEL Beta, etc.
## Sample Cron:
## Sample Cron:
```
# Run full repocompare script every 4 hours
# Run full repocompare script every 4 hours
5 */4 * * * root /opt/repocompare/repo_compare_launcher.sh; rsync -av --delete /opt/repocompare_results/ /var/www/html/repocompare_results/
# Delete HTML repocompare pages more than 10 days old:
10 2 * * * root find /opt/repocompare_results/ -iname "*.html" -type f -mtime +7 -exec rm -f {} \;
```
(things might be cleaned up, to make results location more flexible)
## Manual Comparisons
The repocompare output generally includes false positives and might require further scrutiny to determine which packages actually need updates.
Please see the [documentation](https://testing.rocky.page/) for an overview of the process.

24
manual_compare.sh Normal file
View File

@ -0,0 +1,24 @@
#!/bin/bash
# Script to do "manual" repocompare of a single package.
# This script must run on a RHEL 8 box with a valid entitlement.
# Usage:
# ./repocompare.sh [version] [repo] [package]
#
# Examples:
# ./repocompare.sh 9 BaseOS grub2
# ./repocompare.sh 8 AppStream ansible-core
version="$1"
repo="$2" # BaseOS, AppStream, CodeReady, ResilientStorage, HighAvailability
package="$3"
# TODO only if /etc/yum.repos.d/rocky_repocompare.repo is more than 4 hours old
./mkrepofile.sh
for distro in "Rocky" "RHEL"; do
dnf download --refresh --source --repo ${distro}${version}_${repo}_Source ${package}
done
find ./ -name "$package*" -exec sh -c "rpm -qp --qf '%-18{DISTRIBUTION} %{NAME} %{VERSION} %{RELEASE} ' {} && rpm -qp --changelog {} | head -n 1" \;