diff --git a/base/bootstrapinfo.py b/base/bootstrapinfo.py index 4650a2d..9ae6c6f 100644 --- a/base/bootstrapinfo.py +++ b/base/bootstrapinfo.py @@ -45,8 +45,7 @@ class BootstrapInformation(object): from pkg.sourceslist import SourceLists self.source_lists = SourceLists(self.manifest.packages, self.manifest_vars) from pkg.packagelist import PackageList - self.packages = PackageList(self.manifest.packages, self.manifest_vars, - default_target=manifest.system['release'], source_lists=self.source_lists) + self.packages = PackageList(self.manifest.packages, self.manifest_vars, self.source_lists) self.include_packages = set() self.exclude_packages = set() diff --git a/base/pkg/packagelist.py b/base/pkg/packagelist.py index 7296521..8edebe4 100644 --- a/base/pkg/packagelist.py +++ b/base/pkg/packagelist.py @@ -3,21 +3,20 @@ from exceptions import PackageError class PackageList(object): - def __init__(self, data, manifest_vars, default_target, source_lists): + def __init__(self, data, manifest_vars, source_lists): self.manifest_vars = manifest_vars self.source_lists = source_lists - self.default_target = default_target self.remote = {} self.local = set() if 'remote' in data: for package in data['remote']: target = None if isinstance(package, dict): - name = package['name'].format(**self.manifest_vars) + name = package['name'] if 'target' in package: - target = package['target'].format(**self.manifest_vars) + target = package['target'] else: - name = package.format(**self.manifest_vars) + name = package self.add(name, target) if 'local' in data: for package_path in data['local']: @@ -25,7 +24,7 @@ class PackageList(object): def add(self, name, target=None): if target is None: - target = self.default_target + target = '{system.release}' name = name.format(**self.manifest_vars) target = target.format(**self.manifest_vars) if name in self.remote: @@ -39,3 +38,7 @@ class PackageList(object): msg = ('The target release {target} was not found in the sources list').format(target=target) raise PackageError(msg) self.remote[name] = target + + def add_local(self, package_path): + package_path = package_path.format(**self.manifest_vars) + self.local.add(package_path) diff --git a/base/pkg/sourceslist.py b/base/pkg/sourceslist.py index c2b5df8..e31a81a 100644 --- a/base/pkg/sourceslist.py +++ b/base/pkg/sourceslist.py @@ -8,9 +8,9 @@ class SourceLists(object): if 'sources' in data: for name, lines in data['sources'].iteritems(): for line in lines: - self.add_source(name, '{line}\n'.format(line=line.format(**self.manifest_vars))) + self.add(name, line) - def add_source(self, name, line): + def add(self, name, line): name = name.format(**self.manifest_vars) line = line.format(**self.manifest_vars) if name not in self.sources: @@ -18,6 +18,7 @@ class SourceLists(object): self.sources[name].append(Source(line)) def target_exists(self, target): + target = target.format(**self.manifest_vars) for lines in self.sources.itervalues(): if target in (source.distribution for source in lines): return True