bodhi/config/app.cfg | 5 +++++
bodhi/model.py | 11 +++++------
bodhi/util.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
3 files changed, 58 insertions(+), 8 deletions(-)
New commits:
commit 38be693881dedf8b67b5e5fb35687c01ef120ecc
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Nov 21 22:20:26 2011 -0500
The PackageDB call returns Bunch(collection=[]), so only return a list.
diff --git a/bodhi/util.py b/bodhi/util.py
index 54f15a2..97615df 100644
--- a/bodhi/util.py
+++ b/bodhi/util.py
@@ -331,6 +331,7 @@ def get_critpath_pkgs(collection='devel'):
if critpath_type == 'pkgdb':
pkgdb = PackageDB(config.get('pkgdb_url'))
critpath_pkgs = pkgdb.get_critpath_pkgs([collection])
+ critpath_pkgs = getattr(critpath_pkgs, collection, [])
else:
critpath_pkgs = []
# HACK: Avoid the current critpath policy for EPEL
commit b98e27a3bd345f565f499009cfff0477fbd42935
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Nov 21 22:20:12 2011 -0500
Currently, only the 'devel' collection returns critpath packages
diff --git a/bodhi/model.py b/bodhi/model.py
index dd8e13f..9215299 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -1077,7 +1077,7 @@ class PackageUpdate(SQLObject):
def critpath(self):
""" Return whether or not this update is in the critical path
"""
critical = False
- critpath_pkgs = get_critpath_pkgs(self.release.name)
+ critpath_pkgs = get_critpath_pkgs()
if not critpath_pkgs:
# Optimize case where there's no critpath packages
return False
diff --git a/bodhi/util.py b/bodhi/util.py
index 62c6a28..54f15a2 100644
--- a/bodhi/util.py
+++ b/bodhi/util.py
@@ -326,7 +326,7 @@ def cache_with_expire(expire=600):
return decorator(cached)
@cache_with_expire()
-def get_critpath_pkgs(collection):
+def get_critpath_pkgs(collection='devel'):
critpath_type = config.get('critpath.type', None)
if critpath_type == 'pkgdb':
pkgdb = PackageDB(config.get('pkgdb_url'))
commit 03ea808b0f5587824e86660b4d61d02563365a58
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Nov 21 22:04:02 2011 -0500
Don't use a single PackageDB instance.
Our config is not initialized before the PackageDB object is instantiated, thus
it passes it None.
diff --git a/bodhi/util.py b/bodhi/util.py
index 07efb80..62c6a28 100644
--- a/bodhi/util.py
+++ b/bodhi/util.py
@@ -52,9 +52,6 @@ header = lambda x: "%s\n %s\n%s\n" % ('=' * 80, x,
'=' * 80)
pluralize = lambda val, name: val == 1 and name or "%ss" % name
-# Setup one pkgdb client instance to use with any function here
-pkgdb = PackageDB(config.get('pkgdb_url'))
-
def rpm_fileheader(pkgpath):
log.debug("Grabbing the rpm header of %s" % pkgpath)
is_oldrpm = hasattr(rpm, 'opendb')
@@ -264,8 +261,10 @@ def get_pkg_pushers(pkgName, collectionName='Fedora',
collectionVersion='devel')
if config.get('acl_system') == 'dummy':
return (['guest'], ['guest']), (['guest'],
['guest'])
+
# Note if AppError is raised (for no pkgNamme or other server errors) we
# do not catch the exception here.
+ pkgdb = PackageDB(config.get('pkgdb_url'))
pkg = pkgdb.get_owners(pkgName, collectionName, collectionVersion)
# Owner is allowed to commit and gets notified of pushes
@@ -330,6 +329,7 @@ def cache_with_expire(expire=600):
def get_critpath_pkgs(collection):
critpath_type = config.get('critpath.type', None)
if critpath_type == 'pkgdb':
+ pkgdb = PackageDB(config.get('pkgdb_url'))
critpath_pkgs = pkgdb.get_critpath_pkgs([collection])
else:
critpath_pkgs = []
commit 4ac9ab6d4b9036406d51f06cd63e6f42080220f7
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Nov 21 22:03:19 2011 -0500
Document the new 'critpath.type' config option.
diff --git a/bodhi/config/app.cfg b/bodhi/config/app.cfg
index 61ded18..c779dfb 100644
--- a/bodhi/config/app.cfg
+++ b/bodhi/config/app.cfg
@@ -185,6 +185,11 @@ tgcaptcha.key = 'Y`h`f&s}TZz'
##
## Critical Path Packages
##
+
+# Enable this to query the Fedora Package Database for the list of Critical
+# Path Packages. If disabled, it'll just use the hardcoded list below.
+#critpath.type = 'pkgdb'
+
## Hardcoded, until we can query the pkgdb for it.
#
http://kojipkgs.fedoraproject.org/mash/branched-20110912/logs/critpath.txt
critpath = "ConsoleKit ConsoleKit-libs ConsoleKit-x11 GConf2 GConf2-gtk ModemManager
NetworkManager NetworkManager-glib NetworkManager-gnome OpenEXR-libs PackageKit
PackageKit-device-rebind PackageKit-glib PackageKit-gstreamer-plugin PackageKit-yum
abattis-cantarell-fonts accountsservice accountsservice-libs acl adwaita-cursor-theme
adwaita-gtk2-theme adwaita-gtk3-theme alsa-lib anaconda anaconda-yum-plugins apg
at-spi2-atk at-spi2-core atk attica attr audit audit-libs authconfig authconfig-gtk avahi
avahi-autoipd avahi-glib avahi-libs basesystem bash bind-libs-lite bind-license binutils
biosdevname bluedevil bluez bluez-libs bzip2 bzip2-libs ca-certificates cagibi cairo
cairo-gobject caribou cdparanoia-libs celt checkpolicy cheese-libs chkconfig cloog-ppl
clucene-core clutter clutter-gst clutter-gtk cogl color-filesystem colord comps-extras
control-center control-center-filesystem coreutils coreutils-libs cpio cpp cracklib
cracklib-dicts cracklib-python createrepo cronie cronie-anacron cronie-noanacron crontabs
cryptopp cryptsetup-luks cryptsetup-luks-libs cups-libs cups-pk-helper curl cyrus-sasl
cyrus-sasl-lib cyrus-sasl-plain dash db4 db4-utils dbus dbus-glib dbus-libs dbus-python
dbus-x11 dbusmenu-qt dconf deltarpm desktop-backgrounds-gnome desktop-file-utils
device-mapper device-mapper-event device-mapper-event-libs device-mapper-libs
device-mapper-multipath device-mapper-multipath-libs dhclient dhcp-common dhcp-libs
diffutils dirac-libs dmidecode dmraid dmraid-events dnsmasq docbook-dtds docbook-style-xsl
dosfstools dracut e2fsprogs e2fsprogs-libs efibootmgr eject elfutils elfutils-libelf
elfutils-libs enca enchant evolution-data-server exempi exiv2-libs expat fcoe-utils
fedora-icon-theme fedora-logos fedora-release fftw file file-libs filesystem findutils
fipscheck fipscheck-lib firstboot flac folks fontconfig fontpackages-filesystem fprintd
fprintd-pam freetype fuse fuse-libs gamin gawk gcc gcc-c++ gd gdb gdbm gdk-pixbuf2 gdm
gdm-plugin-fingerprint genisoimage geoclue gettext gettext-libs giflib gjs glib-networking
glib2 glibc glibc-common glibc-devel glibc-headers glibmm24 glx-utils gmp gnome-bluetooth
gnome-bluetooth-libs gnome-desktop3 gnome-disk-utility-libs gnome-icon-theme
gnome-icon-theme-symbolic gnome-keyring gnome-keyring-pam gnome-menus
gnome-online-accounts gnome-packagekit gnome-panel gnome-panel-libs gnome-python2
gnome-python2-canvas gnome-python2-gconf gnome-session gnome-session-xsession
gnome-settings-daemon gnome-shell gnome-terminal gnome-themes gnome-themes-standard gnupg2
gnutls gobject-introspection gpgme grep grub2 grubby gsettings-desktop-schemas gsm
gstreamer gstreamer-plugins-bad-free gstreamer-plugins-base gstreamer-plugins-good
gstreamer-tools gtk2 gtk2-engines gtk3 gvfs gvfs-fuse gvfs-obexftp gzip hdparm herqq
hesiod hicolor-icon-theme hostname htdig hunspell hwdata ilmbase info initscripts iptables
iputils iscsi-initiator-utils iso-codes isomd5sum jack-audio-connection-kit jasper-libs js
json-glib kbd kbd-misc kde-filesystem kde-settings kdebase-runtime kdebase-runtime-flags
kdebase-runtime-libs kdelibs kdelibs-common kdepimlibs kernel kernel-headers keyutils-libs
koji kpartx krb5-libs lcms-libs lcms2 libGLEW libICE libSM libX11 libX11-common
libXScrnSaver libXau libXcomposite libXcursor libXdamage libXdmcp libXevie libXext
libXfixes libXfont libXft libXi libXinerama libXmu libXpm libXrandr libXrender libXres
libXt libXtst libXv libXvMC libXxf86misc libXxf86vm libacl libaio libarchive libart_lgpl
libass libassuan libasyncns libatasmart libattr libavc1394 libblkid libbluedevil
libcanberra libcanberra-gtk2 libcanberra-gtk3 libcap libcap-ng libcdaudio libcdio
libcom_err libconfig libcroco libcurl libdaemon libdb libdc1394 libdrm libdv libdvdnav
libdvdread libedit libexif libffado libffi libfontenc libfprint libfreebob libgcc
libgcrypt libgdata libgee libglade2 libgnome-keyring libgnomecanvas libgnomekbd libgomp
libgpg-error libgphoto2 libgtop2 libgudev1 libgweather libhbaapi libhbalinux libical
libicu libidn libiec61883 libieee1284 libimobiledevice libiodbc libjpeg-turbo libkate
libmcpp libmng libmodman libmodplug libmount libmpc libmpcdec libmx libnl libnotify
liboauth libofa libogg libpcap libpciaccess libplist libpng libproxy libqzeitgeist
libraw1394 libreport libreport-gtk libreport-newt libreport-python librsvg2 libsamplerate
libselinux libselinux-python libselinux-utils libsemanage libsepol libshout libsigc++20
libsmbclient libsndfile libsocialweb libsocialweb-keys libsoup libss libssh libssh2
libstdc++ libstdc++-devel libtalloc libtasn1 libtdb libthai libtheora libtiff libtool-ltdl
libudev libusb libusb1 libuser libuser-python libutempter libuuid libv4l libvisual
libvorbis libvpx libwnck3 libxcb libxkbfile libxklavier libxml++ libxml2 libxml2-python
libxslt linux-firmware livecd-tools lldpad llvm-libs lockdev logrotate lorax lua lvm2
lvm2-libs lzo m4 makebootfat mash mcpp mdadm mesa-dri-drivers mesa-dri-filesystem
mesa-libGL mesa-libGLU metacity mingetty mobile-broadband-provider-info module-init-tools
mpfr mtools mutter nautilus nautilus-extensions ncurses ncurses-base ncurses-libs
net-tools netxen-firmware newt newt-python notification-daemon nspr nss nss-myhostname
nss-softokn nss-softokn-freebl nss-sysinit nss-util ntfs-3g ntfsprogs obex-data-server
obexd openbox openbox-libs openldap openobex openslp openssh openssh-clients
openssh-server openssl orc os-prober oxygen-icon-theme p11-kit pam pango parted passwd
patch pciutils-libs pcre perl perl-Module-Pluggable perl-PathTools perl-Pod-Escapes
perl-Pod-Simple perl-Scalar-List-Utils perl-libs perl-macros perl-threads
perl-threads-shared phonon phonon-backend-gstreamer pinentry pixman pkgconfig plymouth
plymouth-core-libs plymouth-scripts pm-utils policycoreutils polkit polkit-desktop-policy
polkit-gnome polkit-qt popt ppl ppl-pwl ppp procmail psmisc pth pulseaudio
pulseaudio-gdm-hooks pulseaudio-libs pulseaudio-libs-glib2 pulseaudio-module-bluetooth
pulseaudio-module-gconf pulseaudio-module-x11 pulseaudio-utils pungi pyOpenSSL pyatspi
pycairo pyclutter pycryptopp pygobject2 pygpgme pygtk2 pygtk2-libglade pykickstart
pyparted python python-beaker python-bugzilla python-chardet python-cryptsetup
python-deltarpm python-ethtool python-imgcreate python-iniparse python-kid python-kitchen
python-krbV python-libs python-magic python-mako python-markupsafe python-meh python-nss
python-paste python-pyblock python-pycurl python-slip python-tempita python-urlgrabber
python-virtkey python-xlib pyxdg pyxf86config qca2 qt qt-mobility qt-x11 qtsoap qtwebkit
raptor2 rasqal readline redhat-menus redhat-rpm-config redland redland-virtuoso repoview
rest rootfiles rpm rpm-build rpm-build-libs rpm-libs rpm-python rsyslog rtkit
samba-winbind-clients sane-backends sane-backends-libs sane-backends-libs-gphoto2
schroedinger sed selinux-policy selinux-policy-targeted sendmail setserial setup setuptool
sg3_utils-libs sgml-common sgpio shadow-utils shared-color-profiles
shared-desktop-ontologies shared-mime-info slang slv2 smp_utils soprano
sound-theme-freedesktop speex sqlite squashfs-tools startup-notification strigi-libs sudo
sysklogd syslinux syslinux-extlinux system-config-date system-config-firewall-base
system-config-keyboard system-config-users system-setup-keyboard systemd systemd-sysv
systemd-units sysvinit-tools taglib tar tcp_wrappers-libs telepathy-filesystem
telepathy-glib telepathy-logger tigervnc-license tigervnc-server-minimal tzdata udev
udisks unzip upower usbmuxd usermode usermode-gtk ustr util-linux verne-backgrounds-gnome
verne-backgrounds-single vim-minimal virtuoso-opensource vte3 wavpack webkitgtk3 which
wpa_supplicant xcb-util xdg-user-dirs xdg-utils xfsprogs xkeyboard-config xml-common
xmlrpc-c xmlrpc-c-client xorg-x11-drivers xorg-x11-drv-acecad xorg-x11-drv-aiptek
xorg-x11-drv-apm xorg-x11-drv-ast xorg-x11-drv-ati xorg-x11-drv-cirrus xorg-x11-drv-dummy
xorg-x11-drv-elographics xorg-x11-drv-evdev xorg-x11-drv-fbdev xorg-x11-drv-fpit
xorg-x11-drv-geode xorg-x11-drv-glint xorg-x11-drv-hyperpen xorg-x11-drv-i128
xorg-x11-drv-i740 xorg-x11-drv-intel xorg-x11-drv-keyboard xorg-x11-drv-mach64
xorg-x11-drv-mga xorg-x11-drv-mouse xorg-x11-drv-mutouch xorg-x11-drv-neomagic
xorg-x11-drv-nouveau xorg-x11-drv-nv xorg-x11-drv-openchrome xorg-x11-drv-penmount
xorg-x11-drv-qxl xorg-x11-drv-r128 xorg-x11-drv-rendition xorg-x11-drv-s3virge
xorg-x11-drv-savage xorg-x11-drv-siliconmotion xorg-x11-drv-sis xorg-x11-drv-sisusb
xorg-x11-drv-synaptics xorg-x11-drv-tdfx xorg-x11-drv-trident xorg-x11-drv-v4l
xorg-x11-drv-vesa xorg-x11-drv-vmmouse xorg-x11-drv-vmware xorg-x11-drv-void
xorg-x11-drv-voodoo xorg-x11-drv-wacom xorg-x11-server-Xorg xorg-x11-server-common
xorg-x11-server-utils xorg-x11-xauth xorg-x11-xinit xorg-x11-xkb-utils xz xz-libs yajl yum
yum-metadata-parser yum-utils zenity zlib"
commit 0b6ce18f3d6eb30c257370de8eead6f21d2cb4d2
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Nov 21 21:56:43 2011 -0500
Fix the cache decorator
diff --git a/bodhi/util.py b/bodhi/util.py
index 8f524b0..07efb80 100644
--- a/bodhi/util.py
+++ b/bodhi/util.py
@@ -326,7 +326,7 @@ def cache_with_expire(expire=600):
return result
return decorator(cached)
-@cache_with_expire
+@cache_with_expire()
def get_critpath_pkgs(collection):
critpath_type = config.get('critpath.type', None)
if critpath_type == 'pkgdb':
commit 6c3d33682f602f7cfeebf33cf8dec554a0b869a2
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Nov 21 21:55:44 2011 -0500
Patch from Toshio to fetch critpath lists from the pkgdb.
diff --git a/bodhi/model.py b/bodhi/model.py
index f03aa4a..dd8e13f 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -40,7 +40,7 @@ except ImportError:
from bodhi import buildsys, mail
from bodhi.util import get_nvr, rpm_fileheader, header, get_age, get_age_in_days
from bodhi.util import Singleton, authorized_user, flash_log, build_evr, url
-from bodhi.util import link, isint
+from bodhi.util import link, isint, get_critpath_pkgs
from bodhi.exceptions import RPMNotFound, InvalidRequest
from bodhi.identity.tables import *
@@ -1076,12 +1076,11 @@ class PackageUpdate(SQLObject):
@property
def critpath(self):
""" Return whether or not this update is in the critical path
"""
- # HACK: Avoid the current critpath policy for EPEL
- if self.release.name.startswith('EL'):
- return False
-
critical = False
- critpath_pkgs = config.get('critpath').split()
+ critpath_pkgs = get_critpath_pkgs(self.release.name)
+ if not critpath_pkgs:
+ # Optimize case where there's no critpath packages
+ return False
for build in self.builds:
if build.package.name in critpath_pkgs:
critical = True
diff --git a/bodhi/util.py b/bodhi/util.py
index e4d0858..8f524b0 100644
--- a/bodhi/util.py
+++ b/bodhi/util.py
@@ -31,7 +31,7 @@ from kid import Element
from yum import repoMDObject
from yum.misc import checksum
from os.path import isdir, join, dirname, basename, isfile
-from datetime import datetime
+from datetime import datetime, timedelta
from decorator import decorator
from turbogears import config, flash, redirect
from fedora.client import PackageDB
@@ -52,6 +52,9 @@ header = lambda x: "%s\n %s\n%s\n" % ('=' * 80, x,
'=' * 80)
pluralize = lambda val, name: val == 1 and name or "%ss" % name
+# Setup one pkgdb client instance to use with any function here
+pkgdb = PackageDB(config.get('pkgdb_url'))
+
def rpm_fileheader(pkgpath):
log.debug("Grabbing the rpm header of %s" % pkgpath)
is_oldrpm = hasattr(rpm, 'opendb')
@@ -261,7 +264,6 @@ def get_pkg_pushers(pkgName, collectionName='Fedora',
collectionVersion='devel')
if config.get('acl_system') == 'dummy':
return (['guest'], ['guest']), (['guest'],
['guest'])
- pkgdb = PackageDB(config.get('pkgdb_url'))
# Note if AppError is raised (for no pkgNamme or other server errors) we
# do not catch the exception here.
pkg = pkgdb.get_owners(pkgName, collectionName, collectionVersion)
@@ -294,6 +296,49 @@ def get_pkg_pushers(pkgName, collectionName='Fedora',
collectionVersion='devel')
return ((pAllowed, pNotify), (gAllowed, gNotify))
+def cache_with_expire(expire=600):
+ # expire is the number of seconds to cache for.
+ # Default is 600s == 10 minutes
+ _cache = {}
+ def cached(func, *args, **kwargs):
+ # Setup the args
+ if kwargs:
+ key = args, frozenset(kwargs.iteritems())
+ else:
+ key = args
+
+ # Retrieve from cache
+ entry = None
+ if key in _cache:
+ entry = _cache[key]
+ if (datetime.utcnow() - entry[0]) < timedelta(0, expire, 0):
+ # Unexpired cache
+ result = entry[1]
+ else:
+ # Expired cache
+ del _cache[key]
+ entry = None
+
+ # Retrieve fresh entry
+ if entry is None:
+ result = func(*args, **kwargs)
+ _cache[key] = (datetime.utcnow(), result)
+ return result
+ return decorator(cached)
+
+@cache_with_expire
+def get_critpath_pkgs(collection):
+ critpath_type = config.get('critpath.type', None)
+ if critpath_type == 'pkgdb':
+ critpath_pkgs = pkgdb.get_critpath_pkgs([collection])
+ else:
+ critpath_pkgs = []
+ # HACK: Avoid the current critpath policy for EPEL
+ if not collection.startswith('EL'):
+ # Note: ''.split() == []
+ critpath_pkgs = config.get('critpath', '').split()
+ return critpath_pkgs
+
def build_evr(build):
if not build['epoch']:
build['epoch'] = 0