Skip to content

Commit

Permalink
list_all.py working
Browse files Browse the repository at this point in the history
  • Loading branch information
tfoote committed Jun 6, 2012
1 parent a6f4f57 commit e25da16
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 49 deletions.
6 changes: 3 additions & 3 deletions src/buildfarm/list_all.py → scripts/list_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import yaml
import urllib2

import setup_apt_root
import buildfarm.apt_root #setup_apt_root

URL_PROTOTYPE="https://raw.github.com/ros/rosdistro/master/releases/%s.yaml"

Expand Down Expand Up @@ -114,7 +114,7 @@ def render_vertical(packages):
distros = my_targets[0][args.rosdistro]


ros_repos = setup_apt_root.parse_repo_args(args.repo_urls)
ros_repos = buildfarm.apt_root.parse_repo_args(args.repo_urls)

packages = {}

Expand All @@ -123,7 +123,7 @@ def render_vertical(packages):
for a in arches:
dist_arch = "%s_%s"%(d, a)
specific_rootdir = os.path.join(rootdir, dist_arch)
setup_apt_root.setup_apt_rootdir(specific_rootdir, d, a, additional_repos = ros_repos)
buildfarm.apt_root.setup_apt_rootdir(specific_rootdir, d, a, additional_repos = ros_repos)
print "setup rootdir %s"%specific_rootdir

packages[dist_arch] = list_packages(specific_rootdir, update=True, substring=args.substring)
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
version='0.0.1',
packages=['buildfarm'],
package_dir = {'buildfarm':'src/buildfarm'},
scripts = ['scripts/setup_apt_root.py'],
scripts = ['scripts/setup_apt_root.py',
'scripts/list_all.py'],
package_data = {'buildfarm': ['resources/templates/*']},
author = "Tully Foote",
author_email = "[email protected]",
Expand Down
28 changes: 13 additions & 15 deletions src/buildfarm/apt_root.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
#!/usr/bin/env python

from __future__ import print_function

import pkg_resources
import em
import os
import pprint

class Templates(object):
template_dir = os.path.dirname(__file__)
sources = os.path.join(template_dir, 'sources.list.em') #basic sources
ros_sources = os.path.join(template_dir, 'ros-sources.list.em') #ros sources
apt_conf = os.path.join(template_dir, 'apt.conf.em') #apt.conf
arch_conf = os.path.join(template_dir, 'arch.conf.em') #arch.conf

def expand_file(config_template, d):
with open(config_template) as fh:
file_em = fh.read()
s = em.expand(file_em, **d)

def expand_template(config_template, d):
s = em.expand(config_template, **d)
return s

def setup_directories(rootdir):
Expand Down Expand Up @@ -45,7 +39,8 @@ def setup_conf(rootdir, target_dir):

d = {'rootdir':rootdir}
with open(os.path.join(target_dir, "apt.conf"), 'w') as apt_conf:
apt_conf.write(expand_file(Templates.apt_conf, d))
template = pkg_resources.resource_string('buildfarm', 'resources/templates/apt.conf.em')
apt_conf.write(expand_template(template, d))



Expand All @@ -54,14 +49,16 @@ def set_default_sources(rootdir, distro, repo):
d = {'distro':distro,
'repo': repo}
with open(os.path.join(rootdir, "etc/apt/sources.list"), 'w') as sources_list:
sources_list.write(expand_file(Templates.sources, d))
template = pkg_resources.resource_string('buildfarm', 'resources/templates/sources.list.em')
sources_list.write(expand_template(template, d))

def set_additional_sources(rootdir, distro, repo, source_name):
""" Set the source lists for the default ubuntu and ros sources """
d = {'distro':distro,
'repo': repo}
with open(os.path.join(rootdir, "etc/apt/sources.list.d/%s.list"%source_name), 'w') as sources_list:
sources_list.write(expand_file(Templates.ros_sources, d))
template = pkg_resources.resource_string('buildfarm', 'resources/templates/ros-sources.list.em')
sources_list.write(expand_template(template, d))


def setup_apt_rootdir(rootdir, distro, arch, mirror=None, additional_repos = {}):
Expand All @@ -77,7 +74,8 @@ def setup_apt_rootdir(rootdir, distro, arch, mirror=None, additional_repos = {})
d = {'arch':arch}
path = os.path.join(rootdir, "etc/apt/apt.conf.d/51Architecture")
with open(path, 'w') as arch_conf:
arch_conf.write(expand_file(Templates.arch_conf, d))
template = pkg_resources.resource_string('buildfarm', 'resources/templates/arch.conf.em')
arch_conf.write(expand_template(template, d))


def parse_repo_args(repo_args):
Expand Down
30 changes: 0 additions & 30 deletions src/buildfarm/list_packages.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit e25da16

Please sign in to comment.