convert hackage-status.sh to hackage-fedora.py which reads package list straight from pkgdb

This commit is contained in:
Jens Petersen 2010-12-08 17:47:26 +10:00
parent 8843244384
commit eed0f8bfc5
2 changed files with 24 additions and 21 deletions

24
hackage-fedora.py Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/python
# generates a Fedora distro package status file for hackage.haskell.org
from fedora.client import PackageDB
import koji
pkgdb = PackageDB()
p = pkgdb.user_packages('haskell-sig')
# exclude packages not in Hackage
packages = [pkg['name'] for pkg in p.pkgs if pkg['name'] not in ['cabal2spec','emacs-haskell-mode','ghc','ghc-gtk2hs','ghc-rpm-macros','haddock','haskell-platform','hugs98']]
session = koji.ClientSession('http://koji.fedoraproject.org/kojihub')
for pkg in packages:
latest = session.getLatestBuilds('dist-rawhide', package=pkg)
if latest:
ver = latest[0]['version']
name = pkg.replace('ghc-','',1)
print "(\"%s\",\"%s\",Just \"https://admin.fedoraproject.org/pkgdb/acls/name/%s\")" % (name,ver,pkg)
# todo
## sort output

View File

@ -1,21 +0,0 @@
#!/bin/sh
# generates a Fedora distro package status file for hackage.haskell.org
PKGS="ghc-Boolean ghc-GLUT ghc-HTTP ghc-HUnit ghc-OpenGL ghc-QuickCheck ghc-X11 ghc-X11-xft alex ghc-attoparsec ghc-base64-bytestring ghc-binary ghc-bytestring-trie cabal-install ghc-cairo ghc-cgi ghc-chalmers-lava2000 ghc-cmdargs ghc-colour cpphs ghc-csv darcs ghc-dataenc ghc-deepseq ghc-editline ghc-feldspar-language ghc-fgl ghc-ghc-paths ghc-gio ghc-glade ghc-glib ghc-gtk gtk2hs-buildtools ghc-gtksourceview2 happy ghc-hashed-storage ghc-haskeline ghc-haskell-src ghc-haskell-src-exts ghc-hinotify hlint hscolour ghc-hslogger ghc-html ghc-libmpd ghc-mmap ghc-mtl ghc-network ghc-pango ghc-parallel ghc-parsec ghc-regex-base ghc-regex-compat ghc-regex-posix ghc-regex-tdfa ghc-split ghc-stm ghc-syb ghc-tagsoup ghc-tar ghc-terminfo ghc-text ghc-transformers ghc-type-level ghc-uniplate ghc-utf8-string ghc-xhtml xmobar xmonad ghc-xmonad-contrib ghc-zlib"
if [ -f Fedora ]; then
mv -f Fedora Fedora.previous
fi
for p in $PKGS; do
LATEST=$(koji latest-pkg --quiet dist-rawhide $p | cut -f1 -d' ' | sed -e "s/\(.*\)-.*/\1/")
HACKAGE=$(echo $p | sed -e "s/^ghc-//")
VERSION=$(echo $LATEST | sed -e "s/^$p-//")
if [ -n "$VERSION" ]; then
echo $HACKAGE-$VERSION
echo "(\"$HACKAGE\",\"$VERSION\",Just \"https://admin.fedoraproject.org/pkgdb/acls/name/$p\")" >> Fedora
else
echo ** No version for: $HACKAGE **
fi
done