launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #23518
[Merge] lp:~cjwatson/launchpad/build-aux-snap into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/build-aux-snap into lp:launchpad.
Commit message:
Add build-aux/snap/snapcraft.yaml to the list of possible snapcraft.yaml paths.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1805219 in Launchpad itself: "Support for looking in build-aux/snap"
https://bugs.launchpad.net/launchpad/+bug/1805219
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/build-aux-snap/+merge/366114
I don't really love this, but it's a passable compromise and will do for now. The ordering I chose is in sync with that used in snapcraft.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/build-aux-snap into lp:launchpad.
=== modified file 'lib/lp/snappy/interfaces/snap.py'
--- lib/lp/snappy/interfaces/snap.py 2019-03-29 16:22:20 +0000
+++ lib/lp/snappy/interfaces/snap.py 2019-04-16 13:14:40 +0000
@@ -661,7 +661,8 @@
required=False, readonly=False,
description=_(
"A Bazaar branch containing a snap/snapcraft.yaml, "
- "snapcraft.yaml, or .snapcraft.yaml recipe at the top level.")))
+ "build-aux/snap/snapcraft.yaml, snapcraft.yaml, or "
+ ".snapcraft.yaml recipe at the top level.")))
git_repository = exported(ReferenceChoice(
title=_("Git repository"),
@@ -669,14 +670,15 @@
required=False, readonly=True,
description=_(
"A Git repository with a branch containing a snap/snapcraft.yaml, "
- "snapcraft.yaml, or .snapcraft.yaml recipe at the top level.")))
+ "build-aux/snap/snapcraft.yaml, snapcraft.yaml, or "
+ ".snapcraft.yaml recipe at the top level.")))
git_repository_url = exported(URIField(
title=_("Git repository URL"), required=False, readonly=True,
description=_(
"The URL of a Git repository with a branch containing a "
- "snap/snapcraft.yaml, snapcraft.yaml, or .snapcraft.yaml recipe "
- "at the top level."),
+ "snap/snapcraft.yaml, build-aux/snap/snapcraft.yaml, "
+ "snapcraft.yaml, or .snapcraft.yaml recipe at the top level."),
allowed_schemes=["git", "http", "https"],
allow_userinfo=True,
allow_port=True,
@@ -688,7 +690,8 @@
title=_("Git branch path"), required=False, readonly=False,
description=_(
"The path of the Git branch containing a snap/snapcraft.yaml, "
- "snapcraft.yaml, or .snapcraft.yaml recipe at the top level."))
+ "build-aux/snap/snapcraft.yaml, snapcraft.yaml, or "
+ ".snapcraft.yaml recipe at the top level."))
_api_git_path = exported(
TextLine(
title=git_path.title, required=False, readonly=False,
@@ -698,8 +701,9 @@
git_ref = exported(Reference(
IGitRef, title=_("Git branch"), required=False, readonly=False,
description=_(
- "The Git branch containing a snap/snapcraft.yaml, snapcraft.yaml, "
- "or .snapcraft.yaml recipe at the top level.")))
+ "The Git branch containing a snap/snapcraft.yaml, "
+ "build-aux/snap/snapcraft.yaml, snapcraft.yaml, or "
+ ".snapcraft.yaml recipe at the top level.")))
build_source_tarball = exported(Bool(
title=_("Build source tarball"),
@@ -713,7 +717,8 @@
required=True, readonly=False,
description=_(
"Whether this snap package is built automatically when the branch "
- "containing its snap/snapcraft.yaml, snapcraft.yaml, or "
+ "containing its snap/snapcraft.yaml, "
+ "build-aux/snap/snapcraft.yaml, snapcraft.yaml, or "
".snapcraft.yaml recipe changes.")))
auto_build_archive = exported(Reference(
=== modified file 'lib/lp/snappy/model/snap.py'
--- lib/lp/snappy/model/snap.py 2019-04-01 09:03:46 +0000
+++ lib/lp/snappy/model/snap.py 2019-04-16 13:14:40 +0000
@@ -1281,6 +1281,7 @@
try:
paths = (
"snap/snapcraft.yaml",
+ "build-aux/snap/snapcraft.yaml",
"snapcraft.yaml",
".snapcraft.yaml",
)
=== modified file 'lib/lp/snappy/templates/snap-new.pt'
--- lib/lp/snappy/templates/snap-new.pt 2018-04-30 16:48:47 +0000
+++ lib/lp/snappy/templates/snap-new.pt 2019-04-16 13:14:40 +0000
@@ -15,8 +15,9 @@
Core</a>. Launchpad can build snap packages using <a
href="https://developer.ubuntu.com/en/snappy/snapcraft/">snapcraft</a>,
from any Git or Bazaar branch on Launchpad that has a
- <tt>snap/snapcraft.yaml</tt>, <tt>snapcraft.yaml</tt>, or
- <tt>.snapcraft.yaml</tt> file at its top level.
+ <tt>snap/snapcraft.yaml</tt>, <tt>build-aux/snap/snapcraft.yaml</tt>,
+ <tt>snapcraft.yaml</tt>, or <tt>.snapcraft.yaml</tt> file at its top
+ level.
</p>
</div>
=== modified file 'lib/lp/snappy/tests/test_snap.py'
--- lib/lp/snappy/tests/test_snap.py 2019-04-01 09:03:46 +0000
+++ lib/lp/snappy/tests/test_snap.py 2019-04-16 13:14:40 +0000
@@ -1584,6 +1584,22 @@
{"name": "test-snap"},
getUtility(ISnapSet).getSnapcraftYaml(branch))
+ def test_getSnapcraftYaml_bzr_build_aux_snap_snapcraft_yaml(self):
+ def getInventory(unique_name, dirname, *args, **kwargs):
+ if dirname == "build-aux/snap":
+ return {"filelist": [{
+ "filename": "snapcraft.yaml", "file_id": "some-file-id",
+ }]}
+ else:
+ raise BranchFileNotFound("dummy", dirname)
+
+ self.useFixture(BranchHostingFixture(
+ blob=b"name: test-snap")).getInventory = getInventory
+ branch = self.factory.makeBranch()
+ self.assertEqual(
+ {"name": "test-snap"},
+ getUtility(ISnapSet).getSnapcraftYaml(branch))
+
def test_getSnapcraftYaml_bzr_plain_snapcraft_yaml(self):
def getInventory(unique_name, dirname, *args, **kwargs):
if dirname == "":
@@ -1637,6 +1653,19 @@
{"name": "test-snap"},
getUtility(ISnapSet).getSnapcraftYaml(git_ref))
+ def test_getSnapcraftYaml_git_build_aux_snap_snapcraft_yaml(self):
+ def getBlob(path, filename, *args, **kwargs):
+ if filename == "build-aux/snap/snapcraft.yaml":
+ return b"name: test-snap"
+ else:
+ raise GitRepositoryBlobNotFound("dummy", filename)
+
+ self.useFixture(GitHostingFixture()).getBlob = getBlob
+ [git_ref] = self.factory.makeGitRefs()
+ self.assertEqual(
+ {"name": "test-snap"},
+ getUtility(ISnapSet).getSnapcraftYaml(git_ref))
+
def test_getSnapcraftYaml_git_plain_snapcraft_yaml(self):
def getBlob(path, filename, *args, **kwargs):
if filename == "snapcraft.yaml":
Follow ups