Implement API packaging plugin as requested in #1638508 #884

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants

bzoltan1 commented Nov 2, 2016

We have discussed with Sergio/Colin on the sprint about the need of API packages.

The conclusion was that since we do not want -dev snaps in the store we must provide an alternative way to publish API packages.

The story is that an upstream content interface plug developer (for example Qt or Gtk) produces boththe runtime interface and the development interfaces. The runtime interfaces go with the snap package. This PR contains the simple implementation of a snapcraft plugin (development) what creates a tar.gz of the stage space. This tar.gz can be published as the development interfac counterpart of the runtime interfaces.

Member

elopio commented Nov 2, 2016

ok to test

Member

elopio commented Nov 2, 2016

You have static errors:
snapcraft/tests/test_plugin_development.py:31:1: F811 redefinition of unused 'development' from line 26
snapcraft/plugins/development.py:36:1: F401 'subprocess' imported but unused
integration_tests/test_development_plugin.py:19:1: F401 'testtools.matchers.DirExists' imported but unused

You can ./runtests.sh static.

+ after:
+ - project
+
+
@elopio

elopio Nov 2, 2016

Member

Please remove the extra newlines at the end.

@@ -0,0 +1,49 @@
+# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
+#
+# Copyright (C) 2015, 2016 Canonical Ltd
@elopio

elopio Nov 2, 2016

Member

Just 2016.

+ for expected_file in expected_files:
+ self.assertThat(
+ os.path.join(project_dir, 'stage', expected_file),
+ FileExists())
@elopio

elopio Nov 2, 2016

Member

Instead of this, I would untar libapitest-api.tar.gz and verify that it contains the expected files

+ snapcraft.internal.load_config(self.project).data['name'] +\
+ "-" +\
+ self.options.extension +\
+ ".tar.gz"
@elopio

elopio Nov 2, 2016

Member

You don't need \ here. finishing the line in + will just work.

@bzoltan1

bzoltan1 Nov 3, 2016

the ./runtests.sh static was giving 'E901 SyntaxError: invalid syntax' for the line when I have removed the \

I found that \ thing strange too, but only this way keeps both pep and the test happy

+ self.archive_name] +
+ self.options.exclude +
+ ['-C',
+ '%s' % self.project.stage_dir, '.'])
@elopio

elopio Nov 2, 2016

Member

This means that by the time the this part runs, the stage dir needs to be full with the contents from the other parts.
The order in which the parts run is not deterministic. This means that this part needs to have the after keyword including all the other parts. If you forget one, or add a new part and don't update this one, you will get the wrong tar.

Maybe we could hack the after keyword on the init of this plugin, but I'm not sure it's a good idea.
Maybe a better idea would be to add a new step on the lifecycle, that tars stage after all the parts ran?
@kyrofa is on holidays and @sergiusens is in a spring, so we should wait a little for their reviews.

@@ -0,0 +1,159 @@
+# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
+#
+# Copyright (C) 2015 Canonical Ltd
Collaborator

sergiusens commented Nov 2, 2016

I am closing this until we have an initial discussion about this with @evandandrea, you and me.

@sergiusens sergiusens closed this Nov 2, 2016

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