names = set()
mapkeys = set()
for repo in repos:
-
- # Temporary solution for path trim
- repo['SnapshotDir'] = repo['SnapshotDir'].replace('/srv/', '')
- if 'PrereleaseDir' not in repo:
- repo['PrereleaseDir'] = \
- repo['SnapshotDir'].replace('snapshots', 'prerelease')
-
name = repo.pop('Name')
names.add(name)
db_repos[name] = repo
import os
import sys
import tempfile
-import shutil
+import yaml
from common.backenddb import BackendDB
from common.gerrit import get_gerrit_event
path_to_new_repos_conf (str): path to new repos.yaml file location
path_to_repos_conf (str): the path of repos.yaml on repos server
"""
-
- shutil.copyfile(path_to_new_repos_conf, path_to_repos_conf)
+ with open(path_to_new_repos_conf, 'r') as repo_fh:
+ repos = yaml.load(repo_fh)
+ # add the prefix /srv/ for BOSS
+ for repo in repos['Repositories']:
+ repo['SnapshotDir'] = os.path.join('/srv',
+ repo['SnapshotDir'])
+ os.write(path_to_repos_conf, yaml.dump(repos))
def main():
"""Script entry point.