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
diff --git a/gitubuntu/git_repository.py b/gitubuntu/git_repository.py
index f974f88..f3bd406 100644
--- a/gitubuntu/git_repository.py
+++ b/gitubuntu/git_repository.py
@@ -21,7 +21,13 @@ import gitubuntu.lint
21from gitubuntu.__main__ import top_level_defaults21from gitubuntu.__main__ import top_level_defaults
22import gitubuntu.build22import gitubuntu.build
23from gitubuntu.dsc import component_tarball_matches23from gitubuntu.dsc import component_tarball_matches
24from gitubuntu.run import run, runq, decode_binary24from gitubuntu.run import (
25 decode_binary,
26 run,
27 runq,
28 run_gbp,
29 run_quilt,
30)
25try:31try:
26 pkg = 'python3-debian'32 pkg = 'python3-debian'
27 import debian.changelog33 import debian.changelog
@@ -916,7 +922,7 @@ class GitUbuntuRepository:
916 tarballs.append(922 tarballs.append(
917 os.path.join(os.path.pardir, potential_main_tarballs[0])923 os.path.join(os.path.pardir, potential_main_tarballs[0])
918 )924 )
919 cmd = ['gbp', 'buildpackage', '--git-builder=/bin/true',925 args = ['buildpackage', '--git-builder=/bin/true',
920 '--git-pristine-tar', '--git-ignore-branch',926 '--git-pristine-tar', '--git-ignore-branch',
921 '--git-upstream-tag=%s/upstream/%s/%%(version)s%s' %927 '--git-upstream-tag=%s/upstream/%s/%%(version)s%s' %
922 (namespace, dist, ext)]928 (namespace, dist, ext)]
@@ -933,11 +939,11 @@ class GitUbuntuRepository:
933 tarballs.extend(map(lambda x : os.path.join(os.path.pardir, x),939 tarballs.extend(map(lambda x : os.path.join(os.path.pardir, x),
934 list(potential_component_tarballs.values()))940 list(potential_component_tarballs.values()))
935 )941 )
936 cmd.extend(map(lambda x : '--git-component=%s' % x,942 args.extend(map(lambda x : '--git-component=%s' % x,
937 list(potential_component_tarballs.keys()))943 list(potential_component_tarballs.keys()))
938 )944 )
939 with self.pristine_tar_branches(dist, namespace):945 with self.pristine_tar_branches(dist, namespace):
940 run(cmd)946 run_gbp(args, env=self.env)
941 return tarballs947 return tarballs
942948
943 raise PristineTarNotFoundError(949 raise PristineTarNotFoundError(
@@ -1970,8 +1976,8 @@ class GitUbuntuRepository:
1970 # differentiate between applied an unapplied1976 # differentiate between applied an unapplied
1971 with self.temporary_worktree(commit_hash):1977 with self.temporary_worktree(commit_hash):
1972 try:1978 try:
1973 run(1979 run_quilt(
1974 ['quilt', 'push', '-a'],1980 ['push', '-a'],
1975 env=self.quilt_env_from_treeish_str(commit_hash),1981 env=self.quilt_env_from_treeish_str(commit_hash),
1976 )1982 )
1977 # False if in an unapplied state, which is signified by1983 # False if in an unapplied state, which is signified by
@@ -1996,8 +2002,8 @@ class GitUbuntuRepository:
1996 raise e2002 raise e
19972003
1998 try:2004 try:
1999 run(2005 run_quilt(
2000 ['quilt', 'push', '-a'],2006 ['push', '-a'],
2001 env=self.quilt_env_from_treeish_str(commit_hash),2007 env=self.quilt_env_from_treeish_str(commit_hash),
2002 )2008 )
2003 # False if in an unapplied state2009 # False if in an unapplied state
@@ -2092,8 +2098,8 @@ class GitUbuntuRepository:
2092 )2098 )
20932099
2094 # generate the equivalent .pc directory2100 # generate the equivalent .pc directory
2095 run(2101 run_quilt(
2096 ['quilt', 'push', '-a'],2102 ['push', '-a'],
2097 env=self.quilt_env_from_treeish_str(commit_hash),2103 env=self.quilt_env_from_treeish_str(commit_hash),
2098 rcs=[2],2104 rcs=[2],
2099 )2105 )
@@ -2276,14 +2282,14 @@ with other relevant fields (see below for details).
2276 'debian/changelog',2282 'debian/changelog',
2277 ):2283 ):
2278 with self.temporary_worktree(commit_hash):2284 with self.temporary_worktree(commit_hash):
2279 run(2285 run_gbp(
2280 [2286 [
2281 'gbp',
2282 'dch',2287 'dch',
2283 '--snapshot',2288 '--snapshot',
2284 '--ignore-branch',2289 '--ignore-branch',
2285 '--since=%s' % str(parent_ref),2290 '--since=%s' % str(parent_ref),
2286 ]2291 ],
2292 env=self.env,
2287 )2293 )
2288 return self.dir_to_tree('.')2294 return self.dir_to_tree('.')
22892295
diff --git a/gitubuntu/importer.py b/gitubuntu/importer.py
index 4f7d1c9..c998cf2 100644
--- a/gitubuntu/importer.py
+++ b/gitubuntu/importer.py
@@ -53,7 +53,13 @@ from gitubuntu.git_repository import (
53 PristineTarError,53 PristineTarError,
54 is_dir_3_0_quilt,54 is_dir_3_0_quilt,
55)55)
56from gitubuntu.run import decode_binary, run, runq56from gitubuntu.run import (
57 decode_binary,
58 run,
59 runq,
60 run_gbp,
61 run_quilt,
62)
57from gitubuntu.source_information import (63from gitubuntu.source_information import (
58 GitUbuntuSourceInformation,64 GitUbuntuSourceInformation,
59 NoPublicationHistoryException,65 NoPublicationHistoryException,
@@ -696,17 +702,17 @@ def import_orig(repo, dsc, namespace, version, dist):
696 ext = os.path.splitext(dsc.orig_tarball_path)[1]702 ext = os.path.splitext(dsc.orig_tarball_path)[1]
697703
698 # make this non-fatal if upstream already exist as tagged?704 # make this non-fatal if upstream already exist as tagged?
699 cmd = ['gbp', 'import-orig', '--no-merge',705 args = ['import-orig', '--no-merge',
700 '--upstream-branch', 'do-not-push',706 '--upstream-branch', 'do-not-push',
701 '--pristine-tar', '--no-interactive',707 '--pristine-tar', '--no-interactive',
702 '--no-symlink-orig',708 '--no-symlink-orig',
703 '--upstream-tag=%s/upstream/%s/%%(version)s%s' %709 '--upstream-tag=%s/upstream/%s/%%(version)s%s' %
704 (namespace, dist, ext)]710 (namespace, dist, ext)]
705 cmd.extend(map(lambda x: '--component=%s' % x,711 args.extend(map(lambda x: '--component=%s' % x,
706 list(orig_component_paths.keys()))712 list(orig_component_paths.keys()))
707 )713 )
708 cmd.extend([orig_tarball_path,])714 args.extend([orig_tarball_path,])
709 run(cmd, env=repo.env)715 run_gbp(args, env=repo.env)
710 except CalledProcessError as e:716 except CalledProcessError as e:
711 raise GitUbuntuImportOrigError(717 raise GitUbuntuImportOrigError(
712 'Unable to import tarballs: %s' % orig_paths718 'Unable to import tarballs: %s' % orig_paths
@@ -793,18 +799,18 @@ def import_patches_applied_tree(repo, dsc_pathname):
793 while True:799 while True:
794 try:800 try:
795 os.chdir(extracted_dir)801 os.chdir(extracted_dir)
796 run(802 run_quilt(
797 ['quilt', 'push'],803 ['push'],
798 env=repo.quilt_env_from_treeish_str(import_tree_hash),804 env=repo.quilt_env_from_treeish_str(import_tree_hash),
799 verbose_on_failure=False,805 verbose_on_failure=False,
800 )806 )
801 patch_name, _ = run(807 patch_name, _ = run_quilt(
802 ['quilt', 'top'],808 ['top'],
803 env=repo.quilt_env_from_treeish_str(import_tree_hash),809 env=repo.quilt_env_from_treeish_str(import_tree_hash),
804 )810 )
805 patch_name = patch_name.strip()811 patch_name = patch_name.strip()
806 header, _ = run(812 header, _ = run_quilt(
807 ['quilt', 'header'],813 ['header'],
808 env=repo.quilt_env_from_treeish_str(import_tree_hash),814 env=repo.quilt_env_from_treeish_str(import_tree_hash),
809 )815 )
810 header = header.strip()816 header = header.strip()
diff --git a/gitubuntu/run.py b/gitubuntu/run.py
index 8fb4d85..5ff9ccd 100644
--- a/gitubuntu/run.py
+++ b/gitubuntu/run.py
@@ -141,3 +141,41 @@ def run_lxc(args, env=None, **kwargs):
141 pass141 pass
142142
143 return run(cmd, env=env_unset_SNAP, **kwargs)143 return run(cmd, env=env_unset_SNAP, **kwargs)
144
145def run_quilt(args, env=None, **kwargs):
146 """execute quilt without reading any configuration files
147
148 Params:
149 args: A list of string arguments to pass to quilt.
150 env: A namespace object to use as the environment. If not specified,
151 the calling environment is inherited.
152 kwargs: passed directly to run().
153
154 Returns:
155 A tuple of stdout, stderr from the quilt process.
156 Raises a subprocess.CalledProcessError exception on error.
157 """
158 cmd = ['quilt', '--quiltrc', '-'] + args
159 return run(cmd, env=env, **kwargs)
160
161def run_gbp(args, env=None, **kwargs):
162 """execute gbp without reading any configuration files
163
164 Params:
165 args: A list of string arguments to pass to gbp.
166 env: A namespace object to use as the environment. If not specified,
167 the calling environment is inherited.
168 kwargs: passed directly to run().
169
170 Returns:
171 A tuple of stdout, stderr from the gbp process.
172 Raises a subprocess.CalledProcessError exception on error.
173 """
174 cmd = ['gbp'] + args
175 if env:
176 env_no_gbp_conf = env.copy()
177 else:
178 env_no_gbp_conf = os.environ.copy()
179 env_no_gbp_conf['GBP_CONF_FILES'] = '/dev/null'
180
181 return run(cmd, env=env_no_gbp_conf, **kwargs)

Subscribers

People subscribed via source and target branches