turn 'filterlist' into 'imagelist', using productmd

This adopts https://pagure.io/quick-fedora-mirror/pull-request/27
and adapts to it, so we get `imagelist` files rather than
`filterlist` files (see recent commits for this). The rationale
is more fully explained in that PR (and in PR #26 also) - on
further inspection it turns out that we have to filter out an
awful lot of extensions to create small filterlists for all
three modules, and I'm worried that other file extensions may
appear in the future and cause the filterlists to suddenly get
bigger again. Instead, we have create-filelist use the productmd
constant that defines valid image formats, and only include files
that match those formats in the list. The downside of this
approach is we have to ensure productmd on all the systems that
run `create-filelist` is kept up to date if the list of valid
image formats changes.
This commit is contained in:
Adam Williamson 2016-11-21 19:36:49 -08:00
parent 49dd063d22
commit 2e09ca2d00
5 changed files with 32 additions and 20 deletions

View file

@ -25,7 +25,7 @@ CREATE=/usr/local/bin/create-filelist
# context.
FILELIST=fullfilelist
TIMELIST='fullfiletimelist-$mod'
FILTERLIST='filterlist-$mod'
IMAGELIST='imagelist-$mod'
usage () {
echo
@ -108,12 +108,12 @@ cd $tmpd
for mod in $MODS; do
currentfl=$TOPD/$mod/${FILELIST/'$mod'/$mod}
currenttl=$TOPD/$mod/${TIMELIST/'$mod'/$mod}
currentsl=$TOPD/$mod/${FILTERLIST/'$mod'/$mod}
currentil=$TOPD/$mod/${IMAGELIST/'$mod'/$mod}
flname=$(basename $currentfl)
tlname=$(basename $currenttl)
slname=$(basename $currentsl)
ilname=$(basename $currentil)
$CREATE -c -s -d $TOPD/$mod -f $flname -t $tlname -F $slname
$CREATE -c -s -d $TOPD/$mod -f $flname -t $tlname -i $ilname
# If a file list exists and doesn't differ from what we just generated,
# delete the latter.
@ -123,8 +123,8 @@ cd $tmpd
if [[ -f $currenttl ]] && diff -q $currenttl $tlname > /dev/null; then
rm -f $tlname
fi
if [[ -f $currentsl ]] && diff -q $currentsl $slname > /dev/null; then
rm -f $slname
if [[ -f $currentil ]] && diff -q $currentil $ilname > /dev/null; then
rm -f $ilname
fi
done
@ -134,13 +134,13 @@ cd $tmpd
for mod in $MODS; do
currentfl=$TOPD/$mod/${FILELIST/'$mod'/$mod}
currenttl=$TOPD/$mod/${TIMELIST/'$mod'/$mod}
currentsl=$TOPD/$mod/${FILTERLIST/'$mod'/$mod}
currentil=$TOPD/$mod/${IMAGELIST/'$mod'/$mod}
flname=$(basename $currentfl)
fldir=$(dirname $currentfl)
tlname=$(basename $currenttl)
tldir=$(dirname $currenttl)
slname=$(basename $currentsl)
sldir=$(dirname $currentsl)
ilname=$(basename $currentil)
ildir=$(dirname $currentil)
if [[ -f $flname ]]; then
tmpf=$(mktemp -p $fldir $flname.XXXXXXXXXX)
@ -154,11 +154,11 @@ cd $tmpd
chmod 644 $tmpf
mv $tmpf $currenttl
fi
if [[ -f $slname ]]; then
tmpf=$(mktemp -p $sldir $slname.XXXXXXXXXX)
cp -p $slname $tmpf
if [[ -f $ilname ]]; then
tmpf=$(mktemp -p $ildir $ilname.XXXXXXXXXX)
cp -p $ilname $tmpf
chmod 644 $tmpf
mv $tmpf $currentsl
mv $tmpf $currentil
fi
done