Skip to content
Snippets Groups Projects

update generaterepolist to not be dependent on log files

Merged Ben Morrice requested to merge generaterepolistm2 into master
1 file
+ 15
31
Compare changes
  • Side-by-side
  • Inline
+ 15
31
#!/bin/bash
days=7
includetesting=false
repos=()
usage()
{
cat << EOF
usage: $0 -d [distribution]
usage: $0
This script parses the log files of previous testing runs to determine which repos should be synced on the production (Thursday) run.
This script determines which repos should be updated/synced on the production
(Thursday) run.
Only CC7 is supported
OPTIONS:
-d dist distribution: slc6 cc7
-h display this help
-t include 'testing' repos
EOF
}
while getopts "htd:" option
while getopts "ht" option 2>/dev/null
do
case $option in
h)
@@ -28,36 +29,19 @@ do
t)
includetesting=true
;;
d)
dist=$OPTARG
;;
esac
done
if [ -z $dist ]; then
usage
exit 1
fi
files=`find /mnt/data2/home/build/packages/logs/build2test -mtime -$days ! -size 0 -type f -exec basename {} \; | cut -d. -f1,2`
for file in $files
basedir=/mnt/data1/dist/cern/centos/7/
sourcerepos=`ls -1d $basedir/*testing | xargs -n1 basename |grep -v cr-testing`
for repo in $sourcerepos
do
repo=`echo $file | cut -d. -f2`
# check repo is not a date
date -d "$repo" > /dev/null 2>&1
if [ $? -eq 1 ]; then
if [[ $file == *"${dist}"* ]]; then
repos+=($repo)
if [ "$includetesting" = true ]; then
if [ $dist != "slc6" ]; then
repos+=("$repo-testing")
else
repos+=("testing")
fi
fi
if [[ `find $basedir/$repo/ -name *rpm -not -path "*.~tmp~/*" |wc -l` -gt 0 ]]; then
repos+=("${repo::-8}")
if [ "$includetesting" = true ]; then
repos+=("$repo")
fi
fi
done
# remove duplicates
unique_repos=($(echo "${repos[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' '))
echo REPOLIST=\"${unique_repos[@]}\"
echo REPOLIST=\"${repos[@]}\"
Loading