Incorporate feedback from hashar

Now that our dependencies landed in Debian Sid, we can advance forward

Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
This commit is contained in:
Paul Belanger 2013-05-14 19:52:31 -04:00
parent 39bf65974f
commit 6d97896344
11 changed files with 217 additions and 32 deletions

4
debian/changelog vendored
View File

@ -1,5 +1,5 @@
zuul (1.2.0-1) UNRELEASED; urgency=low
* Initial release
* Initial release (Closes: #705844)
-- Paul Belanger <paul.belanger@polybeacon.com> Wed, 27 Mar 2013 10:41:16 -0400
-- Paul Belanger <paul.belanger@polybeacon.com> Tue, 14 May 2013 19:27:22 -0400

11
debian/control vendored
View File

@ -13,15 +13,18 @@ Build-Depends-Indep:
python-paramiko,
python-paste,
python-setuptools,
python-sphinx,
python-voluptuous,
python-sphinx (>= 1.0.7+dfsg),
python-voluptuous (<< 0.7),
python-webob,
python-yaml
Standards-Version: 3.9.3
X-Python-Version: >= 2.6
Package: zuul
Architecture: all
Depends: jenkins (>= 1.426),
libjs-jquery,
libjs-underscore,
python-daemon,
python-extras,
python-git (>= 0.3.2~RC1),
@ -29,9 +32,11 @@ Depends: jenkins (>= 1.426),
python-lockfile,
python-paramiko,
python-paste,
python-voluptuous,
python-voluptuous (<< 0.7),
python-webob,
python-yaml,
${misc:Depends},
${python:Depends}
Suggests:
python-statsd
Description: Trunk gating system

30
debian/copyright vendored
View File

@ -4,7 +4,16 @@ Upstream-Contact: OpenStack Continuous Integration Administrators <openstack-ci-
Source: http://launchpad.net/zuul
Files: *
Copyright: Copyright 2012 Hewlett-Packard Development Company, L.P.
Copyright: 2011-2013 OpenStack, LLC.
2012 Hewlett-Packard Development Company, L.P.
2013 Antoine "hashar" Musso
2013 OpenStack Foundation
2013 Timo Tijhof
2013 Wikimedia Foundation
License: Apache
Files: debian/*
Copyright: 2012 Paul Belanger <paul.belanger@polybeacon.com>
License: Apache 2.0
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
@ -17,22 +26,3 @@ License: Apache 2.0
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
Files: debian/*
Copyright: 2012 Paul Belanger <paul.belanger@polybeacon.com>
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".

2
debian/docs vendored
View File

@ -1 +1 @@
doc/build/html
build/docs/html

4
debian/examples vendored Normal file
View File

@ -0,0 +1,4 @@
etc/layout.yaml-sample
etc/logging.conf-sample
etc/zuul.conf-sample

7
debian/links vendored Normal file
View File

@ -0,0 +1,7 @@
# Overwrite jquery.js from upstream tarball with a link to jquery.js
# provided by jQuery Debian package
/usr/share/javascript/jquery/jquery.js usr/share/doc/zuul/html/_static/jquery.js
# Overwrite underscore.js from upstream tarball with a link to underscore.min.js
# provided by Underscore Debian package
/usr/share/javascript/underscore/underscore.min.js usr/share/doc/zuul/html/_static/underscore.js

1
debian/manpages vendored Normal file
View File

@ -0,0 +1 @@
build/docs/man/*

View File

@ -0,0 +1,179 @@
From d401af40cc3948dc1e68412406ba2095cc508c93 Mon Sep 17 00:00:00 2001
From: Paul Belanger <paul.belanger@polybeacon.com>
Date: Mon, 13 May 2013 19:22:14 -0400
Subject: [PATCH] Add the ability to set git user.email and user.name
It is possible the host system does not have git properly configured,
which results in merge failures because the git client is complain. For
example:
GitCommandError: 'git merge FETCH_HEAD' returned exit status 128:
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
Now we can pass user.name and user.email settings to git, if configured
to do so.
Change-Id: I896194d8d1f5334026954b02f3a1a8dd82bed2ac
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
---
doc/source/zuul.rst | 8 ++++++++
etc/zuul.conf-sample | 2 ++
tests/fixtures/zuul.conf | 2 ++
tests/test_scheduler.py | 4 ++++
zuul/merger.py | 15 ++++++++++++---
zuul/scheduler.py | 16 ++++++++++++++--
6 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/doc/source/zuul.rst b/doc/source/zuul.rst
index 96faf86..2899fdd 100644
--- a/doc/source/zuul.rst
+++ b/doc/source/zuul.rst
@@ -94,6 +94,14 @@ zuul
Directory that Zuul should clone local git repositories to.
``git_dir=/var/lib/zuul/git``
+**git_user_email**
+ Optional: Value to pass to `git config user.email`.
+ ``git_user_email=zuul@example.com``
+
+**git_user_name**
+ Optional: Value to pass to `git config user.name`.
+ ``git_user_name=zuul``
+
**push_change_refs**
Boolean value (``true`` or ``false``) that determines if Zuul should
push change refs to the git origin server for the git repositories in
diff --git a/etc/zuul.conf-sample b/etc/zuul.conf-sample
index 75d1ca5..47e1d7e 100644
--- a/etc/zuul.conf-sample
+++ b/etc/zuul.conf-sample
@@ -15,4 +15,6 @@ log_config=/etc/zuul/logging.conf
pidfile=/var/run/zuul/zuul.pid
state_dir=/var/lib/zuul
git_dir=/var/lib/zuul/git
+;git_user_email=zuul@example.com
+;git_user_name=zuul
status_url=https://jenkins.example.com/zuul/status
diff --git a/tests/fixtures/zuul.conf b/tests/fixtures/zuul.conf
index c031ae3..3054c23 100644
--- a/tests/fixtures/zuul.conf
+++ b/tests/fixtures/zuul.conf
@@ -11,5 +11,7 @@ sshkey=none
[zuul]
layout_config=layout.yaml
git_dir=/tmp/zuul-test/git
+git_user_email=zuul@example.com
+git_user_name=zuul
push_change_refs=true
url_pattern=http://logs.example.com/{change.number}/{change.patchset}/{pipeline.name}/{job.name}/{build.number}
diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py
index 508af42..2d5fff3 100644
--- a/tests/test_scheduler.py
+++ b/tests/test_scheduler.py
@@ -74,6 +74,10 @@ def init_repo(project):
path = os.path.join(UPSTREAM_ROOT, project)
repo = git.Repo.init(path)
+ repo.config_writer().set_value('user', 'email', 'user@example.com')
+ repo.config_writer().set_value('user', 'name', 'User Name')
+ repo.config_writer().write()
+
fn = os.path.join(path, 'README')
f = open(fn, 'w')
f.write("test\n")
diff --git a/zuul/merger.py b/zuul/merger.py
index 7ad7eed..aaffa43 100644
--- a/zuul/merger.py
+++ b/zuul/merger.py
@@ -26,11 +26,16 @@ class ZuulReference(git.Reference):
class Repo(object):
log = logging.getLogger("zuul.Repo")
- def __init__(self, remote, local):
+ def __init__(self, remote, local, email, username):
self.remote_url = remote
self.local_path = local
self._ensure_cloned()
self.repo = git.Repo(self.local_path)
+ if email:
+ self.repo.config_writer().set_value('user', 'email', email)
+ if username:
+ self.repo.config_writer().set_value('user', 'name', username)
+ self.repo.config_writer().write()
def _ensure_cloned(self):
if not os.path.exists(self.local_path):
@@ -117,7 +122,8 @@ class Repo(object):
class Merger(object):
log = logging.getLogger("zuul.Merger")
- def __init__(self, trigger, working_root, push_refs, sshkey):
+ def __init__(self, trigger, working_root, push_refs, sshkey, email,
+ username):
self.trigger = trigger
self.repos = {}
self.working_root = working_root
@@ -126,6 +132,8 @@ class Merger(object):
self.push_refs = push_refs
if sshkey:
self._makeSSHWrapper(sshkey)
+ self.email = email
+ self.username = username
def _makeSSHWrapper(self, key):
name = os.path.join(self.working_root, '.ssh_wrapper')
@@ -139,7 +147,8 @@ class Merger(object):
def addProject(self, project, url):
try:
path = os.path.join(self.working_root, project.name)
- repo = Repo(url, path)
+ repo = Repo(url, path, self.email, self.username)
+
self.repos[project] = repo
except:
self.log.exception("Unable to initialize repo for %s" % project)
diff --git a/zuul/scheduler.py b/zuul/scheduler.py
index 8ff5a27..00113c5 100644
--- a/zuul/scheduler.py
+++ b/zuul/scheduler.py
@@ -246,6 +246,16 @@ class Scheduler(threading.Thread):
else:
merge_root = '/var/lib/zuul/git'
+ if self.config.has_option('zuul', 'git_user_email'):
+ merge_email = self.config.get('zuul', 'git_user_email')
+ else:
+ merge_email = None
+
+ if self.config.has_option('zuul', 'git_user_name'):
+ merge_name = self.config.get('zuul', 'git_user_name')
+ else:
+ merge_name = None
+
if self.config.has_option('zuul', 'push_change_refs'):
push_refs = self.config.getboolean('zuul', 'push_change_refs')
else:
@@ -256,8 +266,10 @@ class Scheduler(threading.Thread):
else:
sshkey = None
- self.merger = merger.Merger(self.trigger, merge_root, push_refs,
- sshkey)
+ self.merger = merger.Merger(
+ self.trigger, merge_root, push_refs, sshkey, merge_email,
+ merge_name
+ )
for project in self.projects.values():
url = self.trigger.getGitUrl(project)
self.merger.addProject(project, url)
--
1.7.9.5

View File

@ -1 +1,2 @@
0001-Fix-import-error-for-zuul-version-with-docs.patch
0002-Add-user.email-and-user.name-to-.git-config.patch

2
debian/pydist-overrides vendored Normal file
View File

@ -0,0 +1,2 @@
python_daemon python-daemon
statsd python-statsd

8
debian/rules vendored
View File

@ -15,13 +15,9 @@ override_dh_auto_clean:
rm -rf *.egg*
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
nosetests
override_dh_install:
dh_install
install -D -m 0644 $(CURDIR)/etc/layout.yaml-sample $(CURDIR)/debian/etc/zuul/layout.yaml
install -D -m 0644 $(CURDIR)/etc/logging.conf-sample $(CURDIR)/debian/etc/zuul/logging.conf
install -D -m 0644 $(CURDIR)/etc/zuul.conf-sample $(CURDIR)/debian/etc/zuul/zuul.conf
endif
get-orig-source:
uscan --noconf --force-download --rename --repack --destdir=.