Add new plugin: rust #579

Merged
merged 20 commits into from Jul 27, 2016

Conversation

Projects
None yet
10 participants
Contributor

mariogrip commented Jun 17, 2016

This adds plugin for rust (https://www.rust-lang.org/)

Can one of the admins verify this patch?

Can one of the admins verify this patch?

@mariogrip mariogrip referenced this pull request in Ubuntu/snappy-playpen Jun 17, 2016

Open

Add iota snap #76

mmstick commented Jun 17, 2016

Would very much like to see this as I have a hard time packaging my Rust applications without it.

snapcraft/tests/test_plugin_rust.py
+
+ properties = schema['properties']
+ self.assertTrue('rust-channel' in properties,
+ 'Expected "rust-verion" to be included in properties')
@WebDrake

WebDrake Jun 18, 2016

Looks like there are some typos here and in the self.assertTrue statements below: verion where I presume version is usually meant ... ?

Although in the specific line above, it looks like it should be Expected "rust-channel"

@mariogrip

mariogrip Jun 18, 2016

Contributor

fixed with 05fb2a4

snapcraft/tests/test_plugin_rust.py
+ mock.call([plugin._cargo, 'install',
+ '-j{}'.format(plugin.project.parallel_build_count),
+ '--root', plugin.installdir])
+ ])
@tsimonq2

tsimonq2 Jun 18, 2016

Contributor

Nice work so far!

Coveralls points out that you are missing some tests here. In line 84 of that Coveralls page for example, shows that there is no test for an invalid Rust channel.

I don't have commit access and Coveralls could be totally wrong, but I thought I should point it out just in case Coveralls is right.

@@ -0,0 +1,3 @@
+fn main() {
+ println!("There is rust on snaps!");
@sergiusens

sergiusens Jun 18, 2016

Collaborator

But oxide is still missing!

snapcraft/plugins/rust.py
+For more information check the 'plugins' topic for the former and the
+'sources' topic for the latter.
+
+Additionally, this plugin uses the following plugin-specific keyword:
@sergiusens

sergiusens Jun 18, 2016

Collaborator

keywords (plural)

snapcraft/plugins/rust.py
+ "--root", self.installdir])
+
+ def env(self, root):
+ env = ["RUSTC=%s" % self._rustc,
@sergiusens

sergiusens Jun 18, 2016

Collaborator

This env should be used for runtime environment variables for when the snap app runs

You should probably look at how it is done in the gulp plugin where it does a os.environ.copy, sets these and calls run with this env

+
+ def pull(self):
+ super().pull()
+ self._fetch_rust()
@sergiusens

sergiusens Jun 18, 2016

Collaborator

This is missing a clean_pull to wipe out the rust specific dir for the part made by the plugin (look at the nodejs plugin for inspiration)

Collaborator

sergiusens commented Jun 18, 2016

Hi there, thank you very much for this. I have little to no idea how rust works, but seems you have an integration test and everything so kudos!

I added a few comments here and there, but this looks really good already!

Collaborator

sergiusens commented Jun 18, 2016

Also, no need to push your branch to see if things pass, I bet turnaround time would be faster for the smaller tests by running ./runtests.sh static and ./runtests.sh unit

mariogrip added some commits Jun 18, 2016

Collaborator

sergiusens commented Jun 20, 2016

ok to test

Can one of the admins verify this patch?

snapcraft/tests/test_plugin_rust.py
+from snapcraft.plugins import rust
+
+
+class MakePluginTestCase(tests.TestCase):
@sergiusens

sergiusens Jun 21, 2016

Collaborator

Maybe update the test case class name?

Collaborator

sergiusens commented Jun 21, 2016

A rebase or update/merge branch with master and updating that trivial comment would be good. Going to say

ok to test

just in case something else is missing

mariogrip added some commits Jun 24, 2016

Contributor

mariogrip commented Jun 24, 2016

@sergiusens ready to test

Can one of the admins verify this patch?

Can one of the admins verify this patch?

Collaborator

sergiusens commented Jun 24, 2016

ok to test
retest this please

Collaborator

sergiusens commented Jun 24, 2016

@mariogrip oh, this has conflicts now :-/

If it is list plugins I guess that needs to be mocked! (our problem, not yours)

Contributor

mariogrip commented Jun 25, 2016

@sergiusens I fixed the conflict :)

Collaborator

sergiusens commented Jun 25, 2016

El sábado, 25 de junio de 2016 10h'24:28 ART, Marius Gripsgard
notifications@github.com escribió:

@sergiusens I fixed the conflict :)

Tests still fail though
So close...


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
ubuntu-core#579 (comment)

Enviado con Dekko desde mi dispositivo Ubuntu

Member

elopio commented Jun 25, 2016

Thanks a lot for the great contribution!

This is missing tests for revision and channel, and for the clean pull. Let us know here or on IRC if you need a hand with this.

pura vida.

Member

elopio commented Jul 6, 2016

I'm trying to use your plugin to build https://github.com/rolandshoemaker/theca
This is the error I get: https://paste.ubuntu.com/18598513/
Do you know about it? Is there something wrong in the project or in the plugin?

Here's my yaml: https://paste.ubuntu.com/18598588/

Can one of the admins verify this patch?

Can one of the admins verify this patch?

boghison commented Jul 12, 2016

@elopio You need nightly rust to build that, not stable AFAIU (just add rust-channel: nightly I guess)

Can one of the admins verify this patch?

Can one of the admins verify this patch?

Contributor

dholbach commented Jul 13, 2016

Can the failing tests be retried? There was some interest in this: https://twitter.com/boghison/status/753144022445723648?cn=cmVwbHk%3D&refsrc=email

Member

elopio commented Jul 13, 2016

First the conflicts need to be resolved.

boghison commented Jul 16, 2016

Hi! I resolved the conflicts and squashed the commits in 427e3a6, but I have test fails in test_commands_list_plugins.py, how could that be fixed?

Contributor

josepht commented Jul 21, 2016

@boghison I'm not seeing any test failures in test_commands_list_plugins.py with your branch. I didn't see any test failures at all.

@josepht


======================================================================
FAIL: test_list_plugins_large_terminal (snapcraft.tests.test_commands_list_plugins.ListPluginsCommandTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/bogdan/snapcraft/snapcraft/tests/test_commands_list_plugins.py", line 43, in test_list_plugins_large_terminal
    self.assertEqual(fake_terminal.getvalue(), self.default_plugin_output)
AssertionError: 'ant [82 chars]ake  scons      \nautotools  cmake   go    gul[72 chars]nt\n' != 'ant [82 chars]ake  tar-content\nautotools  cmake   go    gul[65 chars]st\n'
Diff is 823 characters long. Set self.maxDiff to None to see it.

======================================================================
FAIL: test_list_plugins_non_tty (snapcraft.tests.test_commands_list_plugins.ListPluginsCommandTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/bogdan/snapcraft/snapcraft/tests/test_commands_list_plugins.py", line 36, in test_list_plugins_non_tty
    self.assertEqual(fake_terminal.getvalue(), self.default_plugin_output)
AssertionError: 'ant [82 chars]ake  scons      \nautotools  cmake   go    gul[72 chars]nt\n' != 'ant [82 chars]ake  tar-content\nautotools  cmake   go    gul[65 chars]st\n'
Diff is 823 characters long. Set self.maxDiff to None to see it.

======================================================================
FAIL: test_list_plugins_small_terminal (snapcraft.tests.test_commands_list_plugins.ListPluginsCommandTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/bogdan/snapcraft/snapcraft/tests/test_commands_list_plugins.py", line 57, in test_list_plugins_small_terminal
    self.assertEqual(fake_terminal.getvalue(), expected_output)AssertionError: 'ant [37 chars]der  scons      \nautotools  gradle  make    p[165 chars]  \n' != 'ant [37 chars]der  tar-content\nautotools  gradle  make    p[152 chars]  \n'
Diff is 666 characters long. Set self.maxDiff to None to see it.

----------------------------------------------------------------------
Ran 633 tests in 398.398s

FAILED (failures=3)

mariogrip added some commits Jul 22, 2016

Contributor

mariogrip commented Jul 22, 2016

Sorry for the lack of updates on this, i have been a bit busy.

Ok, so now at least travis build returns success.

But autopkgtest return error:

ERROR: test_pull (snapcraft.tests.test_plugin_rust.RustPluginTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 137, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 91, in create_connection
    raise err
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 81, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

Anyone know why?

Contributor

josepht commented Jul 22, 2016

@mariogrip I think this when it's trying to download the rustup.sh script. @elopio are the autopkgtests run behind a firewall that might be blocking access to https://static.rust-lang.org/rustup.sh.

FWIW, the test passes for me locally.

Member

elopio commented Jul 26, 2016

Yes they are behind a firewall. Let me request the exception.

Member

elopio commented Jul 26, 2016

retest this please

@sergiusens sergiusens merged commit 24f1def into snapcore:master Jul 27, 2016

3 of 4 checks passed

coverage/coveralls Coverage decreased (-0.03%) to 96.537%
Details
autopkgtest integration Success
Details
autopkgtest snaps Success
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

kalikiana pushed a commit to kalikiana/snapcraft that referenced this pull request Apr 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment