예제 #1
0
def get_fedora_repo(name, version, arch):
    override_url = ooblib.read_config('repos', 'url_%s' % name)
    if override_url is not None:
        return "baseurl", override_url

    if name not in FEDORA_URLS:
        return None, None

    return "mirrorlist", FEDORA_URLS[name] % { 'version': version, 'arch': arch }
# NOTE: Order matters - this script must run right after replace_images
#       and before custom_scripts (currently at 80)
import ooblib
from pipes import quote

welcome_screen_cmd = ooblib.read_config('sugar_welcome_activity',
                                        'welcome_screen_cmd')
images_path = ooblib.read_config('sugar_welcome_activity', 'images_path')

if welcome_screen_cmd:
    print 'mkdir -p /home/olpc'
    print 'echo %s > /home/olpc/.welcome_screen' % quote(welcome_screen_cmd)
    print 'chown olpc:olpc /home/olpc/.welcome_screen'
    print 'chmod u+w /home/olpc/.welcome_screen'

if images_path:
    print 'chown -R olpc:olpc /home/olpc/Activities/Welcome.activity/images/'
예제 #3
0
import os.path
import urllib
import urllib2
import urlparse
import time
import pickle

from bitfrost.update import microformat

import ooblib

cache = os.path.join(ooblib.cachedir, 'activities')
if not os.path.exists(cache):
    os.makedirs(cache)

baseurl = ooblib.read_config('sugar_activity_group', 'url')
install_activities = ooblib.read_config_bool('sugar_activity_group',
                                             'install_activities')
systemwide = ooblib.read_config_bool('sugar_activity_group',
                                     'activity_group_systemwide')

if install_activities:
    vmaj = int(ooblib.read_config('global', 'olpc_version_major'))
    vmin = int(ooblib.read_config('global', 'olpc_version_minor'))
    vrel = int(ooblib.read_config('global', 'olpc_version_release'))

    suffixes = ["%d.%d.%d" % (vmaj, vmin, vrel), "%d.%d" % (vmaj, vmin), ""]

    for suffix in suffixes:
        if len(suffix) > 0:
            grpurl = urlparse.urljoin(baseurl + "/", urllib.quote(suffix))
예제 #4
0
# Copyright (C) 2009 One Laptop Per Child
# Licensed under the terms of the GNU GPL v2 or later; see COPYING for details.

import os
import sys
import ooblib
from gzip import GzipFile
from StringIO import StringIO

excludepkgs = set()
addexcludes = ooblib.read_config('repos', 'add_excludes_to')
fedora = ooblib.read_config('repos', 'fedora')
fver = ooblib.read_config('global', 'fedora_release').strip()
farch = ooblib.read_config('global', 'fedora_arch').strip()

def add_to_excludes(baseurl, addexcludes):
    print >>sys.stderr, "Reading repository information for", baseurl
    repomd = ooblib.get_repomd(baseurl)
    url = baseurl + '/' + repomd['primary']

    print >>sys.stderr, "Reading package information from", url
    fd = ooblib.cachedurlopen(url)
    data = fd.read()
    fd.close()
    fd = GzipFile(fileobj=StringIO(data))
    ooblib.add_packages_from_xml(fd, addexcludes, farch)

# clean up addexcludes list
if addexcludes is not None:
    addexcludes = addexcludes.split(',')
    for idx, excl in enumerate(addexcludes):
# NOTE: Order matters - this script must run after activity unpacking (currently 75)
#       and before welcome_cmd
import ooblib
import os, sys
from pipes import quote

images_path = ooblib.read_config("sugar_welcome_activity", "images_path")

if images_path:
    if not os.path.exists(images_path):
        print >> sys.stderr, "ERROR: sugar_welcome_activity.images_path must point to an existing directory in your build environment"
        sys.exit(1)

        # synchronize the files within the path, keeping directory structure
    print 'rsync -rlpt %s/ "$INSTALL_ROOT/home/olpc/Activities/Welcome.activity/images/"' % quote(images_path)
    # note - chown happens in kspost.80.wecome_cmd as it reads /etc/passwd
    print 'chmod -R u+rwx "$INSTALL_ROOT/home/olpc/Activities/Welcome.activity/images/"'
예제 #6
0
# Copyright (C) 2009 One Laptop Per Child
# Licensed under the terms of the GNU GPL v2 or later; see COPYING for details.

import os
import sys
from gzip import GzipFile
from StringIO import StringIO

import ooblib

addrepos = []
excludes = set()

farch = ooblib.read_config('global', 'fedora_arch').strip()

# read in repos
for var in os.environ:
    if not var.startswith("CFG_yumcfg__addrepo"):
        continue
    value = os.environ[var]
    for_excludes, name, url = value.split(',', 2)
    for_excludes = bool(int(for_excludes))
    addrepos.append((for_excludes, name, url))

# generate excludes info
for for_excludes, name, baseurl in addrepos:
    if not for_excludes:
        continue

    print >> sys.stderr, "Reading repository information for", baseurl
    repomd = ooblib.get_repomd(baseurl)
예제 #7
0
# Copyright (C) 2009 One Laptop Per Child
# Licensed under the terms of the GNU GPL v2 or later; see COPYING for details.

import os
import sys
from gzip import GzipFile
from StringIO import StringIO

import ooblib

addrepos = []
excludes = set()

farch = ooblib.read_config('global', 'fedora_arch').strip()

# read in repos
for var in os.environ:
    if not var.startswith("CFG_yumcfg__addrepo"):
        continue
    value = os.environ[var]
    for_excludes, name, url = value.split(',', 2)
    for_excludes = bool(int(for_excludes))
    addrepos.append((for_excludes, name, url))

# generate excludes info
for for_excludes, name, baseurl in addrepos:
    if not for_excludes:
        continue

    print >>sys.stderr, "Reading repository information for", baseurl
    repomd = ooblib.get_repomd(baseurl)
# NOTE: Order matters - this script must run right after replace_images
#       and before custom_scripts (currently at 80)
import ooblib
from pipes import quote

welcome_screen_cmd=ooblib.read_config('sugar_welcome_activity', 'welcome_screen_cmd')
images_path=ooblib.read_config('sugar_welcome_activity', 'images_path')

if welcome_screen_cmd:
    print 'mkdir -p /home/olpc'
    print 'echo %s > /home/olpc/.welcome_screen' % quote(welcome_screen_cmd)
    print 'chown olpc:olpc /home/olpc/.welcome_screen'
    print 'chmod u+w /home/olpc/.welcome_screen'

if images_path:
    print 'chown -R olpc:olpc /home/olpc/Activities/Welcome.activity/images/'
예제 #9
0
# NOTE: Order matters - this script must run after activity unpacking (currently 75)
#       and before welcome_cmd
import ooblib
import os, sys
from pipes import quote

images_path = ooblib.read_config('sugar_welcome_activity', 'images_path')

if images_path:
    if not os.path.exists(images_path):
        print >> sys.stderr, "ERROR: sugar_welcome_activity.images_path must point to an existing directory in your build environment"
        sys.exit(1)

    # synchronize the files within the path, keeping directory structure
    print 'rsync -rlpt %s/ "$INSTALL_ROOT/home/olpc/Activities/Welcome.activity/images/"' % quote(
        images_path)
    # note - chown happens in kspost.80.wecome_cmd as it reads /etc/passwd
    print 'chmod -R u+rwx "$INSTALL_ROOT/home/olpc/Activities/Welcome.activity/images/"'