User:Dale/koji2wiki.sh

From FedoraProject

Jump to: navigation, search
  • Script to create table of latest koji builds for given package list.
#!/bin/bash
# dale at fedoraproject.org

DISTS="f10 f11"
# each line has package name <space> release notes URL
PKGS=pkgs.in
DATE=`date +%Y%m%d`

echo '{| class="wikitable" border="1"'
echo '|+ Virtualization Package Versions'
echo '|-'
echo -n -e "! Package\t"
for dist in $DISTS; do
        echo -n -e "!! $dist Release\t"
        echo -n -e "!! $dist Updates ($DATE) \t"
done
echo -e "!! Rawhide\t!! Rel Notes"

grep -v '^#' $PKGS | while read line; do
        echo "|-"
        pkg=`echo $line | awk '{print $1}'`
        notes=`echo $line | awk '{print $2}'`
        echo -n -e "| {{package|$pkg}}\t"

        for dist in $DISTS; do
                dist_tag="dist-$dist"
                pkg_ver=`koji latest-pkg "$dist_tag" "$pkg" | tail -1 | awk '{print $1}' \
                    | sed -e "s/^$pkg-//"`
                echo $pkg_ver | grep '^---' > /dev/null
                if [ $? -eq 0 ]; then pkg_ver='n/a'; fi

                echo -n -e "|| $pkg_ver\t"

                dist_tag="dist-$dist-updates"
                pkg_ver=`koji latest-pkg "$dist_tag" "$pkg" | tail -1 | awk '{print $1}' \
                    | sed -e "s/^$pkg-//"`
                echo $pkg_ver | grep '^---' > /dev/null
                if [ $? -eq 0 ]; then pkg_ver='n/a'; fi

                echo -n -e "|| $pkg_ver\t"
        done

        dist_tag=dist-rawhide
        pkg_ver=`koji latest-pkg "$dist_tag" "$pkg" | tail -1 | awk '{print $1}' \
            | sed -e "s/^$pkg-//"`
        echo $pkg_ver | grep '^---' > /dev/null
        if [ $? -eq 0 ]; then pkg_ver='n/a'; fi

        echo -n -e "|| $pkg_ver\t"
        echo "|| $notes"
done
echo "|}"
  • Input from pkgs.in looks like this"
# Package, Release Notes
kvm           http://kvm.qumranet.com/kvmwiki/ChangeLog
libvirt       http://www.libvirt.org/news.html
libguestfs    http://et.redhat.com/~rjones/libguestfs/
python-virtinst http://virt-manager.et.redhat.com/download.html
virt-df       http://et.redhat.com/~rjones/virt-df/
virt-manager  http://virt-manager.et.redhat.com/download.html
virt-mem      http://et.redhat.com/~rjones/virt-mem/faq.html
virt-top      http://et.redhat.com/~rjones/virt-top/ChangeLog.txt
virt-viewer  
qemu	      http://www.nongnu.org/qemu/changelog.html
xen           http://www.xen.org/download/
xenner        http://cvs.bytesex.org/xenner.html
xenwatch      http://cvs.bytesex.org/xenwatch.html