Merge ~nacc/git-ubuntu:bugfixes-lint-clean into git-ubuntu:master

Proposed by Nish Aravamudan
Status: Superseded
Proposed branch: ~nacc/git-ubuntu:bugfixes-lint-clean
Merge into: git-ubuntu:master
Diff against target: 369 lines (+70/-54)
11 files modified
bin/git-ubuntu (+1/-1)
bin/import-cron (+1/-1)
bin/snap/snap-git-ubuntu (+1/-0)
gitubuntu/__main__.py (+2/-2)
gitubuntu/build.py (+5/-12)
gitubuntu/clone.py (+1/-1)
gitubuntu/importer.py (+9/-8)
gitubuntu/importppa.py (+7/-7)
gitubuntu/lint.py (+22/-19)
gitubuntu/source_information.py (+15/-0)
gitubuntu/submit.py (+6/-3)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Needs Fixing
git-ubuntu developers Pending
Review via email: mp+330451@code.launchpad.net

This proposal has been superseded by a proposal from 2017-09-08.

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

FAILED: Continuous integration, rev:bfba3507bf4ebffc0526495eec9f2de260b2eb82
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~nacc/usd-importer/+git/usd-importer/+merge/330451/+edit-commit-message

https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/41/
Executed test runs:
    SUCCESS: Checkout
    FAILED: Style Check

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

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

FAILED: Continuous integration, rev:bfba3507bf4ebffc0526495eec9f2de260b2eb82
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~nacc/usd-importer/+git/usd-importer/+merge/330451/+edit-commit-message

https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/42/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Style Check
    SUCCESS: Unit Tests
    FAILED: Integration Tests

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

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

FAILED: Continuous integration, rev:bfba3507bf4ebffc0526495eec9f2de260b2eb82
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~nacc/usd-importer/+git/usd-importer/+merge/330451/+edit-commit-message

https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/45/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Style Check
    SUCCESS: Unit Tests
    FAILED: Integration Tests

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

review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/git-ubuntu b/bin/git-ubuntu
2index 23f908e..2b15471 100755
3--- a/bin/git-ubuntu
4+++ b/bin/git-ubuntu
5@@ -1,4 +1,4 @@
6-#!/usr/bin/python3
7+#!/usr/bin/env python3
8
9 # PYTHON_ARGCOMPLETE_OK
10
11diff --git a/bin/import-cron b/bin/import-cron
12index b23e512..0044b74 100755
13--- a/bin/import-cron
14+++ b/bin/import-cron
15@@ -1,4 +1,4 @@
16-#!/usr/bin/python3
17+#!/usr/bin/env python3
18
19 from copy import copy
20 import os
21diff --git a/bin/snap/snap-git-ubuntu b/bin/snap/snap-git-ubuntu
22index 17ba583..9a73451 100755
23--- a/bin/snap/snap-git-ubuntu
24+++ b/bin/snap/snap-git-ubuntu
25@@ -6,5 +6,6 @@ export PATH="$SNAP/bin/snap:$SNAP/usr/local/sbin:$SNAP/usr/local/bin:$SNAP/usr/s
26 export LD_LIBRARY_PATH="$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu"
27 export PERL5LIB="$SNAP/usr/share/perl5"
28 export DPKG_DATADIR="$SNAP/usr/share/dpkg"
29+export QUILT_DIR="$SNAP/usr/share/quilt"
30 eval "$(register-python-argcomplete3 git-ubuntu)"
31 exec "$SNAP/usr/bin/python3" "$SNAP/bin/git-ubuntu" "$@"
32diff --git a/gitubuntu/__main__.py b/gitubuntu/__main__.py
33index ba4a435..eb6078a 100644
34--- a/gitubuntu/__main__.py
35+++ b/gitubuntu/__main__.py
36@@ -1,4 +1,4 @@
37-#!/usr/bin/python3
38+#!/usr/bin/env python3
39
40 def main():
41 try:
42@@ -90,7 +90,7 @@ def main():
43 metavar='[%s]' % '|'.join(known_protos),
44 choices=known_protos,
45 help='Specify protocol to use for fetch. Default: %(default)s',
46- default='git'
47+ default='https'
48 )
49
50 width, _ = shutil.get_terminal_size()
51diff --git a/gitubuntu/build.py b/gitubuntu/build.py
52index 8143995..a8f9cf3 100644
53--- a/gitubuntu/build.py
54+++ b/gitubuntu/build.py
55@@ -38,12 +38,11 @@ from gitubuntu.run import run, runq
56 from gitubuntu.source_information import (
57 GitUbuntuSourceInformation,
58 NoPublicationHistoryException,
59+ derive_source_from_series,
60 )
61 try:
62 pkg = 'python3-debian'
63 from debian.debfile import PART_EXTS
64- pkg = 'python3-distro-info'
65- from distro_info import DebianDistroInfo, UbuntuDistroInfo
66 pkg = 'python3-pytest'
67 import pytest
68 except ImportError:
69@@ -228,8 +227,7 @@ def fetch_orig_from_cache(changelog, source, dl_cache=None):
70 return None
71 if dsc.verify() is None:
72 logging.warn(
73- "Cache dir found, but verification of orig tarball %s failed.",
74- orig,
75+ "Cache dir found, but verification of orig tarball(s) failed."
76 )
77 return None # XXX decide - see docstring
78 _symlink_paths_into_parent_dir(dsc.all_tarball_paths)
79@@ -320,8 +318,8 @@ def fetch_orig_from_launchpad(changelog, source, pullfile, retries,
80 except NoPublicationHistoryException:
81 logging.warning(
82 "No publication history found for %s in %s. ",
83- pkgname,
84- dist_name,
85+ changelog.srcpkg,
86+ source,
87 )
88 return None
89
90@@ -513,12 +511,7 @@ class GitUbuntuBuild:
91
92
93 def derive_source_from_changelog(changelog):
94- series = changelog.distribution
95- if DebianDistroInfo().valid(codename=series):
96- return 'debian'
97- if UbuntuDistroInfo().valid(codename=series):
98- return 'ubuntu'
99- raise ValueError("Unable to determine distribution from %s" % series)
100+ return derive_source_from_series(changelog.distribution)
101
102 def expand_changelog_source_aliases(orig_search_list, changelog):
103 """Replace 'changelog' sources by reading debian/changelog
104diff --git a/gitubuntu/clone.py b/gitubuntu/clone.py
105index a1bc8cb..9a15c9c 100644
106--- a/gitubuntu/clone.py
107+++ b/gitubuntu/clone.py
108@@ -45,7 +45,7 @@ Example:
109 )
110 parser.add_argument('directory', type=str,
111 help='Local directory to clone to. If not specified, a '
112- ' directory with the same name as PACKAGE will be '
113+ 'directory with the same name as PACKAGE will be '
114 'used',
115 default=None,
116 nargs='?'
117diff --git a/gitubuntu/importer.py b/gitubuntu/importer.py
118index 22fd08a..cce1999 100644
119--- a/gitubuntu/importer.py
120+++ b/gitubuntu/importer.py
121@@ -361,17 +361,14 @@ class GitUbuntuImport:
122 except PristineTarError as e:
123 raise GitUbuntuImportOrigError from e
124
125- def import_orig(self, spi):
126+ def import_orig(self, dsc, version, dist):
127 """Imports the orig-tarball using gbp import-org --pristine-tar
128
129 Arguments:
130- spi - A GitUbuntuSourcePackageInformation instance
131+ dsc - A GitUbuntuRepository object
132+ version - the string package version
133+ dist - the string distribution, either 'ubuntu' or 'debian'
134 """
135- dsc = GitUbuntuDsc(spi.dsc_pathname)
136- upstream_version = str(spi.upstream_version)
137- version = str(spi.version)
138- dist = spi.distribution.name.lower()
139-
140 try:
141 orig_tarball_path = dsc.orig_tarball_path
142 except GitUbuntuDscError as e:
143@@ -785,7 +782,11 @@ class GitUbuntuImport:
144 spi.distribution.name.lower()
145 )
146 if not self.skip_orig:
147- self.import_orig(spi)
148+ self.import_orig(
149+ GitUbuntuDsc(spi.dsc_pathname),
150+ version = str(spi.version),
151+ dist = spi.distribution.name.lower(),
152+ )
153
154 unapplied_import_tree_hash = self.import_patches_unapplied_tree(spi.dsc_pathname)
155 logging.debug('Imported patches-unapplied version %s as tree %s',
156diff --git a/gitubuntu/importppa.py b/gitubuntu/importppa.py
157index a4a3ec1..4623645 100644
158--- a/gitubuntu/importppa.py
159+++ b/gitubuntu/importppa.py
160@@ -83,7 +83,7 @@ class GitUbuntuImportPPA(GitUbuntuImport):
161 'ppa:<name>', args.ppa)
162 sys.exit(1)
163 ppa = args.ppa
164- pkgname = args.package
165+ self.pkgname = args.package
166 owner = args.lp_owner
167 user = args.lp_user
168 no_clean = args.no_clean
169@@ -110,14 +110,14 @@ class GitUbuntuImportPPA(GitUbuntuImport):
170
171 atexit.register(self.cleanup, no_clean, self.local_repo.local_dir)
172
173- self.local_repo.add_remote(pkgname, owner, self.namespace, user)
174+ self.local_repo.add_remote(pkgname, owner, self.namespace)
175 if not args.no_fetch:
176 try:
177 self.local_repo.fetch_remote(self.namespace)
178 except GitUbuntuRepositoryFetchError:
179 pass
180
181- source_information = UbuntuSourceInformation(ppa, pkgname,
182+ source_information = GitUbuntuSourceInformation(ppa, self.pkgname,
183 os.path.abspath(args.pullfile),
184 args.retries, args.retry_backoffs)
185
186@@ -151,7 +151,7 @@ class GitUbuntuImportPPA(GitUbuntuImport):
187
188 os.makedirs(workdir, exist_ok=True)
189
190- self.parse_parentfile(pkgname, args.parentfile)
191+ self.parse_parentfile(args.parentfile)
192
193 history_found = False
194 try:
195@@ -168,11 +168,11 @@ class GitUbuntuImportPPA(GitUbuntuImport):
196 history_found = True
197 except NoPublicationHistoryException:
198 logging.warning("No publication history found for %s in %s. ",
199- pkgname, distname)
200+ self.pkgname, ppa)
201
202 if not history_found:
203 logging.error("No publication history for '%s' in %s. "
204- "Wrong source package name?", pkgname, ppa)
205+ "Wrong source package name?", self.pkgname, ppa)
206 sys.exit(1)
207
208 try:
209@@ -188,7 +188,7 @@ class GitUbuntuImportPPA(GitUbuntuImport):
210 pass
211 except NoPublicationHistoryException:
212 logging.warning("No publication history found for %s in %s. ",
213- pkgname, ppa)
214+ self.pkgname, ppa)
215 except:
216 logging.error("Unable to import patches-applied to %s", ppa)
217
218diff --git a/gitubuntu/lint.py b/gitubuntu/lint.py
219index 435e7f2..6258e03 100644
220--- a/gitubuntu/lint.py
221+++ b/gitubuntu/lint.py
222@@ -364,24 +364,28 @@ class GitUbuntuLint:
223 ret = False
224
225 added_lines = [l.content for l in changelog_patch.hunks[0].lines if l.origin == "+"]
226- if added_lines[-1] != "\n":
227- error("last added line to changelog must be blank")
228- ret = False
229-
230- changelog = debian.changelog.Changelog("".join(added_lines[:-1]),
231- strict=True
232- )
233- if len(changelog.versions) != 1:
234- error("must add exactly one changelog entry")
235- ret = False
236-
237- if any(["\t" in l for l in added_lines]):
238- warning("Tab characters found in new changelog entry")
239- ret = False
240-
241- if any([l.endswith(" \n") for l in added_lines]):
242- warning("Trailing whitespace found in new changelog entry")
243+ if len(added_lines) == 0:
244+ error("No lines added to changelog")
245 ret = False
246+ else:
247+ if added_lines[-1] != "\n":
248+ error("last added line to changelog must be blank")
249+ ret = False
250+
251+ changelog = debian.changelog.Changelog("".join(added_lines[:-1]),
252+ strict=True
253+ )
254+ if len(changelog.versions) != 1:
255+ error("must add exactly one changelog entry")
256+ ret = False
257+
258+ if any(["\t" in l for l in added_lines]):
259+ warning("Tab characters found in new changelog entry")
260+ ret = False
261+
262+ if any([l.endswith(" \n") for l in added_lines]):
263+ warning("Trailing whitespace found in new changelog entry")
264+ ret = False
265
266 if ret:
267 self.success("Verified that only new modifications to changelog "
268@@ -670,7 +674,6 @@ class GitUbuntuLint:
269 )
270 self.directory = args.directory
271 self.local_repo = GitUbuntuRepository(self.directory)
272- self.pullfile = args.pullfile
273 self.verbose = args.verbose
274
275 if args.commitish:
276@@ -684,7 +687,7 @@ class GitUbuntuLint:
277 sys.exit(1)
278 else:
279 commitish_obj = self.local_repo.raw_repo.head
280- if self.local_repo.head_is_detached:
281+ if self.local_repo.raw_repo.head_is_detached:
282 commitish_string = 'HEAD'
283 else:
284 for head in self.local_repo.local_branches:
285diff --git a/gitubuntu/source_information.py b/gitubuntu/source_information.py
286index a759b53..5d17bc2 100644
287--- a/gitubuntu/source_information.py
288+++ b/gitubuntu/source_information.py
289@@ -10,6 +10,8 @@ _lp_service = 'production'
290 _lp_api_version = 'devel'
291
292 try:
293+ pkg = 'python3-distro-info'
294+ from distro_info import DebianDistroInfo, UbuntuDistroInfo
295 pkg = 'python3-launchpadlib'
296 from launchpadlib.launchpad import Launchpad as LP
297 pkg = 'python3-ubuntutools'
298@@ -48,6 +50,14 @@ def launchpad_login_auth():
299 return _LP_LOGIN_AUTH
300
301
302+def derive_source_from_series(series):
303+ if DebianDistroInfo().valid(codename=series):
304+ return 'debian'
305+ if UbuntuDistroInfo().valid(codename=series):
306+ return 'ubuntu'
307+ raise ValueError("Unable to determine distribution from %s" % series)
308+
309+
310 class GitUbuntuPPASourcePackage(UbuntuSourcePackage):
311 "Download / unpack an PPA source package"
312 def __init__(self, ppa_spec, *args, **kwargs):
313@@ -257,10 +267,15 @@ class GitUbuntuSourceInformation(object):
314 _, ppa = dist_name.split(':')
315 ppa_owner, ppa_name = ppa.split('/', 1)
316 possible_people = self.launchpad.people.findPerson(text=ppa_owner)
317+ person = None
318 for person in possible_people:
319 if person.name == ppa_owner:
320 ppa_owner = person
321 break
322+ if person is None:
323+ raise ValueError(
324+ "Unable to find owner for PPA: %s" % dist_name
325+ )
326 self.archive = person.getPPAByName(name=ppa_name)
327 else:
328 self.dist = self.launchpad.distributions[dist_name]
329diff --git a/gitubuntu/submit.py b/gitubuntu/submit.py
330index 4dc0d32..6e46a6e 100644
331--- a/gitubuntu/submit.py
332+++ b/gitubuntu/submit.py
333@@ -42,7 +42,7 @@ class GitUbuntuSubmit:
334 )
335 parser.add_argument('--reviewer', action='append',
336 help='Specify reviewers for the proposed merge. This '
337- 'will default to the canonical-server team. This option can be '
338+ 'will default to the canonical-server team. This option can be '
339 'specified multiple times.',
340 default=['canonical-server']
341 )
342@@ -73,7 +73,6 @@ class GitUbuntuSubmit:
343 def main(self, args):
344 self.directory = args.directory
345 self.force = args.force
346- self.pullfile = args.pullfile
347 self.target_user = args.target_user
348 try:
349 self.user = args.lp_user
350@@ -88,15 +87,19 @@ class GitUbuntuSubmit:
351 logging.warning("Specified branch (%s) does not exist locally.",
352 args.branch
353 )
354+ self.commitish_string = args.branch
355 else:
356 if self.local_repo.raw_repo.head_is_detached:
357 logging.error("Please create a local branch before submitting.")
358 sys.exit(1)
359 self.source_branch = self.local_repo.raw_repo.head.name
360+ self.commitish_string = 'HEAD'
361
362 logging.debug("source branch: %s", self.source_branch)
363
364- self.pkgname = self.local_repo.get_changelog_srcpkg_from_treeish('HEAD')
365+ self.pkgname = self.local_repo.get_changelog_srcpkg_from_treeish(
366+ self.commitish_string
367+ )
368
369 logging.debug("source package: %s", self.pkgname)
370

Subscribers

People subscribed via source and target branches