Let Rust plugin fetch dependencies in pull #908

Merged
merged 11 commits into from Dec 6, 2016

Projects

None yet

5 participants

@ChrisMacNaughton
Contributor

Pulling the dependencies in the pull stage allows
building Rust snaps on Launchpad builders,
which are offline during the build stage

@ChrisMacNaughton ChrisMacNaughton Let Rust plugin fetch dependencies in pull
Pulling the dependencies in the pull stage allows
building Rust snaps on Launchpad builders,
which are offline during the build stage
1bab900
@sergiusens
Collaborator

Thanks for the PR, seems the unit tests need updating though.
You can try locally by running

./runtests.sh unit

Also might as well run

./runtests.sh static

Before pushing again. Thanks again

@ChrisMacNaughton
Contributor

It looks like the tests failed because travis couldn't update packages?

@ChrisMacNaughton ChrisMacNaughton update tests
0cd7d7f
@elopio

Thanks @ChrisMacNaughton
I think it would be nice to add an integration test with a simple rust project that has dependencies.
You can take a look at integration_tests/test_rust_plugin.py

snapcraft/tests/test_plugin_rust.py
@@ -86,7 +86,7 @@ def test_pull(self, run_mock, script_mock):
plugin.pull()
- self.assertEqual(1, run_mock.call_count)
+ self.assertEqual(2, run_mock.call_count)
@elopio
elopio Nov 16, 2016 Member

This test would require more than checking that rust was called twice. Please take a look at the next statement that checks the arguments of the first call, and do something similar to the second.

snapcraft/plugins/rust.py
+ 'build-essential',
+ 'git',
+ 'curl',
+ 'file',
@elopio
elopio Nov 16, 2016 Member

I don't know rust, so I will trust you here that these are needed. But just curious, is there a doc that mentions these requirements?

@ChrisMacNaughton
ChrisMacNaughton Nov 16, 2016 Contributor

These are the things that were required for me to get rustc installed on one of the launchpad builders. Can't find specific documentation about it but that's where this list came from.

ChrisMacNaughton added some commits Nov 16, 2016
@ChrisMacNaughton ChrisMacNaughton Update test to reflect expected calls
f22e66d
@ChrisMacNaughton ChrisMacNaughton Pull a dependency in for the Rust integration test
e00b6fc
@ChrisMacNaughton ChrisMacNaughton fix test expectations
c4cabdd
@ChrisMacNaughton
Contributor

@elopio tests should be accurate now, and the integration rust project now pulls in a dependency 😄

@elopio
elopio approved these changes Nov 22, 2016 View changes

Thanks!

@kyrofa

A few suggestions on the build packages.

snapcraft/plugins/rust.py
@@ -54,6 +54,12 @@ def schema(cls):
def __init__(self, name, options, project):
super().__init__(name, options, project)
+ self.build_packages.extend([
+ 'build-essential',
@kyrofa
kyrofa Nov 22, 2016 Member

This is a large meta package. Are you sure you need all of it?

snapcraft/plugins/rust.py
@@ -54,6 +54,12 @@ def schema(cls):
def __init__(self, name, options, project):
super().__init__(name, options, project)
+ self.build_packages.extend([
+ 'build-essential',
+ 'git',
@kyrofa
kyrofa Nov 22, 2016 Member

Git should be pulled in simply by using a git source. It shouldn't be required here.

@kyrofa
kyrofa Nov 22, 2016 Member

Unless the pull of rust eventually turns into a git clone. Is that the case?

@ChrisMacNaughton
ChrisMacNaughton Nov 22, 2016 Contributor

Pulling Rust shouldn't clone, but using Cargo for the build can

ChrisMacNaughton added some commits Nov 22, 2016
@ChrisMacNaughton ChrisMacNaughton remove build-essential meta package
92daf86
@ChrisMacNaughton ChrisMacNaughton update to fix new ubuntu page title
bac4b74
@kyrofa
kyrofa approved these changes Nov 23, 2016 View changes

Looks good to me 👍

@sergiusens

Thanks for this great functionality improvement on separating pull and build effectively in the plugin. I do however need to ask you to revert the change on the wiki downloader test as master has a proper (air quotes) fix for this (at least one where the endpoint won't change underneath us).

@@ -27,7 +27,8 @@ def test_downloader_with_wiki_parts(self):
snap_path = self.build_snap(self.snap_content_dir)
self.install_snap(snap_path, 'downloader', '1.0')
expected = (
- '.*<title>The leading OS for PC, tablet, phone and cloud '
+ '.*<title>The leading operating system for PCs, tablets, '
@sergiusens
sergiusens Nov 24, 2016 Collaborator

This should be reverted as it was fixed in master with a more permanent solution.

@ChrisMacNaughton ChrisMacNaughton Revert "update to fix new ubuntu page title"
This reverts commit bac4b74.
0e0636c
@ChrisMacNaughton
Contributor

@sergiusens I've reverted that change, and it looks like that is the issue with the autopkgtests still.

ChrisMacNaughton and others added some commits Dec 1, 2016
@ChrisMacNaughton ChrisMacNaughton Merge branch 'master' of github.com:snapcore/snapcraft
a3b6485
@kyrofa kyrofa Merge branch 'master' into master
68f3577
@kyrofa kyrofa Merge branch 'master' into master
02f4e1f
@codecov-io

Current coverage is 97.06% (diff: 100%)

Merging #908 into master will increase coverage by <.01%

@@             master       #908   diff @@
==========================================
  Files           161        161          
  Lines         16600      16603     +3   
  Methods           0          0          
  Messages          0          0          
  Branches       1244       1244          
==========================================
+ Hits          16113      16116     +3   
  Misses          302        302          
  Partials        185        185          

Powered by Codecov. Last update 97af16f...02f4e1f

@kyrofa kyrofa merged commit a87decf into snapcore:master Dec 6, 2016

4 of 5 checks passed

zesty-amd64 autopkgtest running
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
xenial-amd64 autopkgtest finished (success)
Details
xenial-armhf autopkgtest finished (success)
Details
yakkety-amd64 autopkgtest finished (success)
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment