Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions check-repository-repodata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/bash

#
# Usage: check-repository-metadata.sh VERSION PATH_TO_REPOSITORY
#
# check-repository-metadata.sh 6.0.0 ../fluent-package-release/lts/6
#
# Note: Requires dnf-plugins-core to be installed to use the download command
#
# dnf install dnf-plugins-core

VERSION=$1
REPOSITORY_DIR=$2

function usage() {
echo "Usage: check-repository-metadata.sh VERSION PATH_TO_REPOSITORY"
}

if [ -z "$(command -v dnf)" ]; then
echo "ERROR: dnf command must be available"
exit 1
fi

if [ ! -d "$REPOSITORY_DIR" ]; then
echo "ERROR: $REPOSITORY_DIR does not exist"
usage
exit 1
fi

# Clean temporary files and dnf cache
rm -f *.rpm
dnf --disableplugin=system_upgrade clean all

for path in $(find $REPOSITORY_DIR -name 'repodata'); do
relative_dir=${path%/*}
echo $relative_dir
rpm_file=$(find "$relative_dir" -maxdepth 1 -name "fluent-package-${VERSION}*.rpm" | head -n 1)
if [ -z "$rpm_file" ]; then
echo "Warning: No RPM file found in $relative_dir"
continue
fi
target_arch=$(basename "$relative_dir")
base_name=$(basename "$rpm_file")
pkg_name="${base_name%.${target_arch}.rpm}"
echo "Package name: ${pkg_name}"
LANG=C dnf --disableplugin=system_upgrade --releasever=$VERSION --disablerepo="*" --repofrompath wip,$relative_dir --enablerepo wip download $pkg_name
done