From: Mathias Klette Date: Thu, 13 Jun 2013 09:40:42 +0000 (+0200) Subject: debian_build: compatibility for 'remotes' objects in git library between squeeze... X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=ff5599c8f1fb0d78bcf3488adc33c2be6944c3fb;p=profitbricks%2Fjenkins-build-scripts.git debian_build: compatibility for 'remotes' objects in git library between squeeze and wheezy thanks to tobias, see https://redmine.pb.local/issues/356 --- diff --git a/debian_build.py b/debian_build.py index ea7b2b9..a9a5d53 100755 --- a/debian_build.py +++ b/debian_build.py @@ -114,17 +114,20 @@ if __name__ == '__main__': # .. repository related gitrepo = git.Repo('.') - # this should be part of 'git' lib, but it isn't right now - gitrepo.remotes = {} - for remote in gitrepo.git.remote('-v').split('\n'): - name, url, type = remote.split() - type = type.strip('()') - if not gitrepo.remotes.has_key(name): - gitrepo.remotes.update({name: {type: url}}) - else: - gitrepo.remotes[name].update({type: url}) - # this would also be helpful, but is not yet included in git lib - gitrepo.name = gitrepo.remotes['origin']['fetch'].split('/')[-1] + if not has_attr(gitrepo,'remotes'): + # this should be part of 'git' lib, but it isn't right now + gitrepo.remotes = {} + for remote in gitrepo.git.remote('-v').split('\n'): + name, url, type = remote.split() + type = type.strip('()') + if not gitrepo.remotes.has_key(name): + gitrepo.remotes.update({name: {type: url}}) + else: + gitrepo.remotes[name].update({type: url}) + # this would also be helpful, but is not yet included in git lib + gitrepo.name = gitrepo.remotes['origin']['fetch'].split('/')[-1].strip('.git') + else: + gitrepo.name = gitrepo.remotes.origin.url.split('/')[-1].strip('.git') # .. some local variables daily_date = BUILD_START.strftime('%Y%m%d%H%M%S')