diff options
author | Ben Brown <ben.brown@codethink.co.uk> | 2017-08-21 14:25:27 +0100 |
---|---|---|
committer | Ben Brown <ben.brown@codethink.co.uk> | 2017-09-04 17:06:12 +0100 |
commit | c13f637b72a9f8b3344cd0101147ca23e1a6759b (patch) | |
tree | 0ba7982224be59db1ebc9e6dc31f9d1b66032ee6 /ybd | |
parent | 0a7ebf5bb24805e851076e73924e18bf40c2d09b (diff) | |
download | ybd-c13f637b72a9f8b3344cd0101147ca23e1a6759b.tar.gz |
Sanitise track checking
Updated to use ref if tracking or no sha specified. unpetrify-ref is
deprecated.
Diffstat (limited to 'ybd')
-rw-r--r-- | ybd/config/ybd.conf | 4 | ||||
-rw-r--r-- | ybd/repos.py | 12 |
2 files changed, 7 insertions, 9 deletions
diff --git a/ybd/config/ybd.conf b/ybd/config/ybd.conf index 27e60eb..d9ac612 100644 --- a/ybd/config/ybd.conf +++ b/ybd/config/ybd.conf @@ -210,8 +210,8 @@ tar-url: 'http://git.baserock.org/tarballs' # else, set TMPDIR # TMPDIR: /tmp -# Normally ybd builds at whatever version is set in the 'ref:' field -# If we set 'track-branches:', then ybd will attempt to build 'unpetrify-ref:' +# Normally ybd builds at whatever version is set in the 'sha:' field +# If we set 'track-branches:', then ybd will attempt to build 'ref:' # track-branches: [path/to/foo-chunk, path/to/bar-chunk, path/to/bip-chunk] # track-branches: True diff --git a/ybd/repos.py b/ybd/repos.py index 099a9f3..9674ee9 100644 --- a/ybd/repos.py +++ b/ybd/repos.py @@ -100,11 +100,9 @@ def get_last_tag(gitdir): def get_tree(dn): info = get_transport_info(dn['repo']) - ref = str(dn.get('sha', str(dn.get('ref')))) - track = app.config.get('track-branches') - if dn.get('unpetrify-ref') and track: - if track is True or dn['path'] in track: - ref = str(dn['unpetrify-ref']) + track = app.config.get('track-branches', []) + track = (isinstance(track, list) and dn['path'] in track) or track + ref = dn.get('ref') if track else dn.get('sha', dn.get('ref')) gitdir = info['dir'] if dn['repo'].startswith('file://') or dn['repo'].startswith('/'): @@ -124,8 +122,8 @@ def get_tree(dn): mirror(dn['name'], dn['repo']) with app.chdir(gitdir), open(os.devnull, "w") as fnull: - if call(['git', 'rev-parse', ref + '^{object}'], stdout=fnull, - stderr=fnull): + if track or call(['git', 'rev-parse', ref + '^{object}'], + stdout=fnull, stderr=fnull): # can't resolve ref. is it upstream? app.log(dn, 'Fetching from upstream to resolve %s' % ref) update_mirror(dn['name'], dn['repo'], gitdir) |