From 29a5fca67c79bb7bfc7e7b3002d1be4eee607203 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Mon, 28 Jul 2014 23:23:06 +0100 Subject: Add some utility scripts to update hdlists. These are the same scripts that were present on the live server and have thus proven useful. That said, common code has been factored out and centralised and the syntax has been neatened up. --- Makefile | 4 ++++ functions | 40 ++++++++++++++++++++++++++++++++++++++++ mga-hdlists | 23 +++++++++++++++++++++++ mga-hdlists-backports | 23 +++++++++++++++++++++++ mga-hdlists-cauldron | 22 ++++++++++++++++++++++ mga-hdlists-updates | 23 +++++++++++++++++++++++ 6 files changed, 135 insertions(+) create mode 100755 mga-hdlists create mode 100755 mga-hdlists-backports create mode 100755 mga-hdlists-cauldron create mode 100755 mga-hdlists-updates diff --git a/Makefile b/Makefile index 48b1fb1..8a0953f 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,10 @@ install: $(ALL) install mgaiso-addmd5 $(DESTDIR)/usr/bin install mgaiso-checkmd5 $(DESTDIR)/usr/bin install clean-rpmsrate $(DESTDIR)/usr/bin + install mga-hdlists $(DESTDIR)/usr/bin + install mga-hdlists-cauldron $(DESTDIR)/usr/bin + install mga-hdlists-updates $(DESTDIR)/usr/bin + install mga-hdlists-backports $(DESTDIR)/usr/bin install -d $(DESTDIR)/$(PERL_VENDORLIB)/MGATools for i in rpmsrate.pm iso.pm; do install pm/MGATools/$$i $(DESTDIR)/$(PERL_VENDORLIB)/MGATools/; done diff --git a/functions b/functions index 53bec75..441eb0a 100644 --- a/functions +++ b/functions @@ -35,6 +35,28 @@ function inlist() return 1 } +function valid_release() +{ + [ "cauldron" = "$1" ] && return 0 + inlist "$1" "$distroreleases" && return 0 + echo "Invalid release '$1'" >&2 + return 1 +} + +function valid_section() +{ + inlist "$1" "$distrosections" && return 0 + echo "Invalid section '$1'" >&2 + return 1 +} + +function valid_subsection() +{ + inlist "$1" "$distrosubsections" && return 0 + echo "Invalid subsection '$1'" >&2 + return 1 +} + function update_hdlist() { repository="$1" @@ -43,6 +65,24 @@ function update_hdlist() /usr/bin/genhdlist2 -v --versioned --allow-empty-media $ofdeps "$repository" } +function update_distro_hdlist() +{ + if [ "$1" = "--nocheck" ]; then + shift + else + valid_release "$1" && valid_section "$2" && valid_subsection "$3" || return 1 + fi + release="$1" + section="$2" + subsection="$3" + + for arch in $arches; do + update_hdlist "$distribdir/$release/$arch/media/$section/$subsection" + update_hdlist "$distribdir/$release/$arch/media/debug/$section/$subsection" + done + update_hdlist "$distribdir/$release/SRPMS/$section/$subsection" +} + function update_common_MD5SUM() { distrorelease="$1" diff --git a/mga-hdlists b/mga-hdlists new file mode 100755 index 0000000..f14407f --- /dev/null +++ b/mga-hdlists @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +. /usr/share/mgatools/functions + +if [ "$1" = "--dry-run" ]; then + dryrun=echo + shift +fi + +if [ $# != 3 ]; then + echo "Usage: $0 [--dry-run]
" >&2 + exit 1 +fi + +release="$1" +section="$2" +subsection="$3" + +update_distro_hdlist "$release" "$section" "$subsection" +update_common_MD5SUM "$release" +mirror_repository "$release" diff --git a/mga-hdlists-backports b/mga-hdlists-backports new file mode 100755 index 0000000..6a0c19b --- /dev/null +++ b/mga-hdlists-backports @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +. /usr/share/mgatools/functions + +if [ "$1" = "--dry-run" ]; then + dryrun=echo + shift +fi + +if [ $# != 2 ]; then + echo "Usage: $0 [--dry-run]
" >&2 + exit 1 +fi + +release="$1" +section="$2" + +update_distro_hdlist "$release" "$section" "backports_testing" +update_distro_hdlist "$release" "$section" "backports" +update_common_MD5SUM "$release" +mirror_repository "$release" diff --git a/mga-hdlists-cauldron b/mga-hdlists-cauldron new file mode 100755 index 0000000..dc4404c --- /dev/null +++ b/mga-hdlists-cauldron @@ -0,0 +1,22 @@ +#!/bin/sh + +set -e + +. /usr/share/mgatools/functions + +if [ "$1" = "--dry-run" ]; then + dryrun=echo + shift +fi + +if [ $# != 2 ]; then + echo "Usage: $0 [--dry-run]
" >&2 + exit 1 +fi + +section="$1" + +update_distro_hdlist "cauldron" "$section" "updates_testing" +update_distro_hdlist "cauldron" "$section" "release" +update_common_MD5SUM "cauldron" +mirror_repository "cauldron" diff --git a/mga-hdlists-updates b/mga-hdlists-updates new file mode 100755 index 0000000..66f3e7e --- /dev/null +++ b/mga-hdlists-updates @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +. /usr/share/mgatools/functions + +if [ "$1" = "--dry-run" ]; then + dryrun=echo + shift +fi + +if [ $# != 2 ]; then + echo "Usage: $0 [--dry-run]
" >&2 + exit 1 +fi + +release="$1" +section="$2" + +update_distro_hdlist "$release" "$section" "updates_testing" +update_distro_hdlist "$release" "$section" "updates" +update_common_MD5SUM "$release" +mirror_repository "$release" -- cgit v1.2.1