deps check
- From: "David Farning" <dfarning sugarlabs org>
- To: build-brigade-list gnome org
- Subject: deps check
- Date: Sat, 17 Jan 2009 12:28:29 +1800
Another possible patch from Sugar Labs.
We have created a depscheck command for our sugar jhbuild which
verifies that the proper dependencies are available to build our
'Sugar' moduleset.
I have attached the depcheck command file, the sysdeps module, and an
example dependency list.
It is a bit Sugar specific:( If you would find it useful, I can
abstract it and push it upstream to you:)
It is is useful to me, to track dependency bloat. If a dev adds a new
dependency it shows up as a bug within a few days.
It is useful to developers to insure that they will be able to build
sugar on their system.
thanks
david
import sys
from optparse import make_option
from jhbuild.commands import Command, register_command
import sysdeps
class cmd_depscheck(Command):
name = 'depscheck'
usage_args = ''
def __init__(self):
Command.__init__(self, [
make_option('-s', '--script',
action='store_true', dest='script', default=False,
help=_('script friendly output')),
])
def run(self, config, options, args):
deps = sysdeps.get_packages()
if not options.script and not deps:
print 'Dependencies information is missing, skip sanity check.'
return
missing_deps = []
for package, source in deps:
if not sysdeps.check_package(package):
missing_deps.append(package)
if missing_deps:
if not options.script:
print 'Missing packages:'
print ' '.join(missing_deps)
sys.exit(1)
register_command(cmd_depscheck)
import os
import subprocess
from xml.dom import minidom
scripts_dir = os.path.dirname(__file__)
base_dir = os.path.dirname(scripts_dir)
def get_distribution():
if 'SJH_DISTRIBUTION' in os.environ:
return os.environ['SJH_DISTRIBUTION'].split('-')
# Fedora
if os.path.exists('/etc/fedora-release'):
name = 'fedora'
f = open('/etc/fedora-release')
full_name = f.read()
f.close()
if 'Rawhide' in full_name:
version = 'rawhide'
else:
version = full_name.split(' ')[2]
return name, version
# Debian and Ubuntu
try:
out, err = subprocess.Popen(['lsb_release', '-is'],
stdout=subprocess.PIPE).communicate()
name = out.strip().lower()
out, err = subprocess.Popen(['lsb_release', '-rs'],
stdout=subprocess.PIPE).communicate()
version = out.strip()
if name == 'debian' and version == 'testing':
version = 'unstable'
return name, version
except OSError:
pass
return None, None
def check_package(package):
name, version = get_distribution()
if name == 'fedora':
ret = subprocess.call(['rpm', '--quiet', '-q', package])
return ret == 0
elif name in ['ubuntu', 'debian']:
cmd = ["dpkg-query", "-f='${status}'", "-W", package]
out, err = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()
return out.find('install ok installed') != -1
return None
def parse_dependencies():
name, version = get_distribution()
if name is None or version is None:
return None
filename = os.path.join(base_dir, 'config', 'sysdeps',
'%s-%s.xml' % (name, version))
if not os.path.exists(filename):
return None
return minidom.parse(filename)
def get_packages():
document = parse_dependencies()
if document is None:
return []
packages = []
root = document.childNodes[0]
for node in root.childNodes:
if node.nodeType == node.ELEMENT_NODE:
if node.nodeName == 'package':
name = node.getAttribute('name')
if node.hasAttribute('source'):
source = node.getAttribute('source')
else:
source = None
packages.append((name, source))
return packages
<?xml version="1.0"?>
<dependencies>
<package name="intltool"/>
<package name="libtool"/>
<package name="python-devel"/>
<package name="gcc"/>
<package name="gcc-c++"/>
<package name="gtk2-devel"/>
<package name="pygtk2-devel"/>
<package name="libcroco-devel"/>
<package name="libgsf-devel"/>
<package name="enchant-devel"/>
<package name="fribidi-devel"/>
<package name="boost-devel"/>
<package name="libXt-devel"/>
<package name="gnome-doc-utils"/>
<package name="expat-devel"/>
<package name="gettext-devel"/>
<package name="wv-devel"/>
<package name="zlib-devel"/>
<package name="gnome-common"/>
<package name="numpy"/>
<package name="gnome-python2-libwnck"/>
<package name="xorg-x11-server-Xephyr"/>
<package name="make"/>
<package name="gnome-python2-rsvg"/>
<package name="python-cjson"/>
<package name="subversion"/>
<package name="GConf2-devel"/>
<package name="libglade2-devel"/>
<package name="popt-devel"/>
<package name="gnome-vfs2-devel"/>
<package name="librsvg2-devel"/>
<package name="gnome-icon-theme"/>
<package name="icon-naming-utils"/>
<package name="xorg-x11-utils"/>
<package name="dejavu-fonts"/>
<package name="gstreamer-python"/>
<package name="icon-slicer"/>
<package name="pygtksourceview"/>
<package name="alsa-lib-devel"/>
<package name="xapian-bindings-python"/>
<package name="xapian-core-libs"/>
<package name="gnome-python2-gconf"/>
<package name="dbus-python"/>
<package name="dbus-devel"/>
<package name="dbus-glib-devel"/>
<package name="loudmouth-devel"/>
<package name="libsoup-devel"/>
<package name="poppler-glib-devel"/>
<package name="avahi"
source="avahi"/>
<package name="avahi-gobject-devel"
source="avahi"/>
<package name="avahi-tools"
source="avahi"/>
<package name="pygobject2"
source="pygobject"/>
<package name="libmatchbox"
source="libmatchbox"/>
<package name="matchbox-window-manager"
source="matchbox-window-manager"/>
<package name="xulrunner-python-devel"
source="xulrunner"/>
<package name="xulrunner-python"
source="xulrunner"/>
<package name="xulrunner-devel-unstable"
source="xulrunner"/>
<package name="hippo-canvas-python"
source="hippo-canvas"/>
<package name="pyabiword"
source="pyabiword"/>
<package name="libabiword"
source="abiword"/>
<package name="libabiword"
source="abiword-plugins"/>
<package name="hippo-canvas-python"
source="hippo-canvas"/>
</dependencies>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]