Merge ~nacc/git-ubuntu:lp1734137-add-quilt-gbp-API into git-ubuntu:master

Proposed by Nish Aravamudan
Status: Merged
Approved by: Nish Aravamudan
Approved revision: 256caffcacb85d2df2d9ec0ff760d6985e13bd7e
Merge reported by: Nish Aravamudan
Merged at revision: 256caffcacb85d2df2d9ec0ff760d6985e13bd7e
Proposed branch: ~nacc/git-ubuntu:lp1734137-add-quilt-gbp-API
Merge into: git-ubuntu:master
Diff against target: 205 lines (+74/-24)
3 files modified
gitubuntu/git_repository.py (+19/-13)
gitubuntu/importer.py (+17/-11)
gitubuntu/run.py (+38/-0)
Reviewer Review Type Date Requested Status
Robie Basak Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+336805@code.launchpad.net

Description of the change

Make jenkins happy.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:7a04bc99041ee22a807bbfb7e0f20bfd9d83741d
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/265/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Style Check
    SUCCESS: Unit Tests
    SUCCESS: Integration Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/265/rebuild

review: Approve (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:256caffcacb85d2df2d9ec0ff760d6985e13bd7e
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/267/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Style Check
    SUCCESS: Unit Tests
    SUCCESS: Integration Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/267/rebuild

review: Approve (continuous-integration)
Revision history for this message
Robie Basak (racb) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/gitubuntu/git_repository.py b/gitubuntu/git_repository.py
2index f974f88..f3bd406 100644
3--- a/gitubuntu/git_repository.py
4+++ b/gitubuntu/git_repository.py
5@@ -21,7 +21,13 @@ import gitubuntu.lint
6 from gitubuntu.__main__ import top_level_defaults
7 import gitubuntu.build
8 from gitubuntu.dsc import component_tarball_matches
9-from gitubuntu.run import run, runq, decode_binary
10+from gitubuntu.run import (
11+ decode_binary,
12+ run,
13+ runq,
14+ run_gbp,
15+ run_quilt,
16+)
17 try:
18 pkg = 'python3-debian'
19 import debian.changelog
20@@ -916,7 +922,7 @@ class GitUbuntuRepository:
21 tarballs.append(
22 os.path.join(os.path.pardir, potential_main_tarballs[0])
23 )
24- cmd = ['gbp', 'buildpackage', '--git-builder=/bin/true',
25+ args = ['buildpackage', '--git-builder=/bin/true',
26 '--git-pristine-tar', '--git-ignore-branch',
27 '--git-upstream-tag=%s/upstream/%s/%%(version)s%s' %
28 (namespace, dist, ext)]
29@@ -933,11 +939,11 @@ class GitUbuntuRepository:
30 tarballs.extend(map(lambda x : os.path.join(os.path.pardir, x),
31 list(potential_component_tarballs.values()))
32 )
33- cmd.extend(map(lambda x : '--git-component=%s' % x,
34+ args.extend(map(lambda x : '--git-component=%s' % x,
35 list(potential_component_tarballs.keys()))
36 )
37 with self.pristine_tar_branches(dist, namespace):
38- run(cmd)
39+ run_gbp(args, env=self.env)
40 return tarballs
41
42 raise PristineTarNotFoundError(
43@@ -1970,8 +1976,8 @@ class GitUbuntuRepository:
44 # differentiate between applied an unapplied
45 with self.temporary_worktree(commit_hash):
46 try:
47- run(
48- ['quilt', 'push', '-a'],
49+ run_quilt(
50+ ['push', '-a'],
51 env=self.quilt_env_from_treeish_str(commit_hash),
52 )
53 # False if in an unapplied state, which is signified by
54@@ -1996,8 +2002,8 @@ class GitUbuntuRepository:
55 raise e
56
57 try:
58- run(
59- ['quilt', 'push', '-a'],
60+ run_quilt(
61+ ['push', '-a'],
62 env=self.quilt_env_from_treeish_str(commit_hash),
63 )
64 # False if in an unapplied state
65@@ -2092,8 +2098,8 @@ class GitUbuntuRepository:
66 )
67
68 # generate the equivalent .pc directory
69- run(
70- ['quilt', 'push', '-a'],
71+ run_quilt(
72+ ['push', '-a'],
73 env=self.quilt_env_from_treeish_str(commit_hash),
74 rcs=[2],
75 )
76@@ -2276,14 +2282,14 @@ with other relevant fields (see below for details).
77 'debian/changelog',
78 ):
79 with self.temporary_worktree(commit_hash):
80- run(
81+ run_gbp(
82 [
83- 'gbp',
84 'dch',
85 '--snapshot',
86 '--ignore-branch',
87 '--since=%s' % str(parent_ref),
88- ]
89+ ],
90+ env=self.env,
91 )
92 return self.dir_to_tree('.')
93
94diff --git a/gitubuntu/importer.py b/gitubuntu/importer.py
95index 4f7d1c9..c998cf2 100644
96--- a/gitubuntu/importer.py
97+++ b/gitubuntu/importer.py
98@@ -53,7 +53,13 @@ from gitubuntu.git_repository import (
99 PristineTarError,
100 is_dir_3_0_quilt,
101 )
102-from gitubuntu.run import decode_binary, run, runq
103+from gitubuntu.run import (
104+ decode_binary,
105+ run,
106+ runq,
107+ run_gbp,
108+ run_quilt,
109+)
110 from gitubuntu.source_information import (
111 GitUbuntuSourceInformation,
112 NoPublicationHistoryException,
113@@ -696,17 +702,17 @@ def import_orig(repo, dsc, namespace, version, dist):
114 ext = os.path.splitext(dsc.orig_tarball_path)[1]
115
116 # make this non-fatal if upstream already exist as tagged?
117- cmd = ['gbp', 'import-orig', '--no-merge',
118+ args = ['import-orig', '--no-merge',
119 '--upstream-branch', 'do-not-push',
120 '--pristine-tar', '--no-interactive',
121 '--no-symlink-orig',
122 '--upstream-tag=%s/upstream/%s/%%(version)s%s' %
123 (namespace, dist, ext)]
124- cmd.extend(map(lambda x: '--component=%s' % x,
125+ args.extend(map(lambda x: '--component=%s' % x,
126 list(orig_component_paths.keys()))
127 )
128- cmd.extend([orig_tarball_path,])
129- run(cmd, env=repo.env)
130+ args.extend([orig_tarball_path,])
131+ run_gbp(args, env=repo.env)
132 except CalledProcessError as e:
133 raise GitUbuntuImportOrigError(
134 'Unable to import tarballs: %s' % orig_paths
135@@ -793,18 +799,18 @@ def import_patches_applied_tree(repo, dsc_pathname):
136 while True:
137 try:
138 os.chdir(extracted_dir)
139- run(
140- ['quilt', 'push'],
141+ run_quilt(
142+ ['push'],
143 env=repo.quilt_env_from_treeish_str(import_tree_hash),
144 verbose_on_failure=False,
145 )
146- patch_name, _ = run(
147- ['quilt', 'top'],
148+ patch_name, _ = run_quilt(
149+ ['top'],
150 env=repo.quilt_env_from_treeish_str(import_tree_hash),
151 )
152 patch_name = patch_name.strip()
153- header, _ = run(
154- ['quilt', 'header'],
155+ header, _ = run_quilt(
156+ ['header'],
157 env=repo.quilt_env_from_treeish_str(import_tree_hash),
158 )
159 header = header.strip()
160diff --git a/gitubuntu/run.py b/gitubuntu/run.py
161index 8fb4d85..5ff9ccd 100644
162--- a/gitubuntu/run.py
163+++ b/gitubuntu/run.py
164@@ -141,3 +141,41 @@ def run_lxc(args, env=None, **kwargs):
165 pass
166
167 return run(cmd, env=env_unset_SNAP, **kwargs)
168+
169+def run_quilt(args, env=None, **kwargs):
170+ """execute quilt without reading any configuration files
171+
172+ Params:
173+ args: A list of string arguments to pass to quilt.
174+ env: A namespace object to use as the environment. If not specified,
175+ the calling environment is inherited.
176+ kwargs: passed directly to run().
177+
178+ Returns:
179+ A tuple of stdout, stderr from the quilt process.
180+ Raises a subprocess.CalledProcessError exception on error.
181+ """
182+ cmd = ['quilt', '--quiltrc', '-'] + args
183+ return run(cmd, env=env, **kwargs)
184+
185+def run_gbp(args, env=None, **kwargs):
186+ """execute gbp without reading any configuration files
187+
188+ Params:
189+ args: A list of string arguments to pass to gbp.
190+ env: A namespace object to use as the environment. If not specified,
191+ the calling environment is inherited.
192+ kwargs: passed directly to run().
193+
194+ Returns:
195+ A tuple of stdout, stderr from the gbp process.
196+ Raises a subprocess.CalledProcessError exception on error.
197+ """
198+ cmd = ['gbp'] + args
199+ if env:
200+ env_no_gbp_conf = env.copy()
201+ else:
202+ env_no_gbp_conf = os.environ.copy()
203+ env_no_gbp_conf['GBP_CONF_FILES'] = '/dev/null'
204+
205+ return run(cmd, env=env_no_gbp_conf, **kwargs)

Subscribers

People subscribed via source and target branches