New plugin: jhbuild #812

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants

attente commented Sep 19, 2016

No description provided.

Member

kyrofa commented Sep 19, 2016

Hey @attente! You could probably use some test coverage, here 😉 .

attente commented Sep 19, 2016

Ah, of course. On the way :)

So this works only on a lxc container?

+ - modules (required): a list of modules to include in the part, modules that
+ should be skipped should be prefixed with '-'
+ - moduleset: the module set JHBuild should use (default: gnome-world)
+ - snap-name (required): the name of the snap this part is included in
@elopio

elopio Sep 20, 2016

Member

This will always be $SNAPCRAFT_PROJECT_NAME. We probably can drop this attribute.

@attente

attente Sep 22, 2016

Is there a way to obtain that value in the plugin though?

+ should be skipped should be prefixed with '-'
+ - moduleset: the module set JHBuild should use (default: gnome-world)
+ - snap-name (required): the name of the snap this part is included in
+ - snap-revision: the revision of the snap this part is included in
@elopio

elopio Sep 20, 2016

Member

same as above, for $SNAPCRAFT_PROJECT_VERSION.

@attente

attente Sep 22, 2016

Same question as above.

+ - release: the release of the distribution the LXC container is based off of
+ (default: host release)
+ - architecture: the architecture of the LXC container
+ (default: host architecture)
@elopio

elopio Sep 20, 2016

Member

I like that you can select the image you want, but I think this should be more general, not just for this plugin.
We had https://bugs.launchpad.net/snapcraft/+bug/1597952 for this.

+ - jhcheckout: the directory on the host container DVCS checkout repositories
+ - ccache: the directory on the host to use for ccache caching
+ - disable-pull: True to skip the pull stage (default: False)
+ - disable-build: True to skip the build stage (default: False)
@elopio

elopio Sep 20, 2016

Member

why would you like to disable pull or build?

+ - Using the debmirror option in combination with a local apt-cacher-ng
+ installation can prevent repeated downloading of .deb packages. Use the IP
+ address of your lxcbr0 interface with the port number apt-cacher-ng uses.
+ For example, debmirror: http://10.0.3.1:3142
@elopio

elopio Sep 20, 2016

Member

https://bugs.launchpad.net/snapcraft/+bug/1602085
Here again, I think it should be general, not only for this plugin.

snapcraft/plugins/jhbuild.py
+ - Specify directories on your host for jhtarballs and jhmirror to prevent
+ repeated downloading of the JHBuild module sources. It is best to reserve
+ directories on your local machine that can be used for all snaps you might
+ want to build.
@elopio

elopio Sep 20, 2016

Member

We have caching for debs. This makes me wonder if we should offer a simple and generic caching solution for all plugins. It might be a mess, though.

@attente

attente Sep 22, 2016

Right, I'm just not sure how to make the LXC container grab the debs that Snapcraft already caches. If there's a way, I'd gladly prefer to use that instead.

snapcraft/plugins/jhbuild.py
+
+ - If you are debugging your snap, but don't need to rebuild the sources (for
+ example, to determine the list of plugs required under confinement), use
+ the disable-pull, disable-build, and disable-jhupdate options.
@elopio

elopio Sep 20, 2016

Member

Ah, I see. But the problem here IMO is that if you want to debug your snap, you usually do it outside of the lxc cleanbuild. So you run pull once, and the next time it will be skipped.
I think we need some cool design to allow us to keep and reuse a lxc machine for cleanbuild, so we could do something similar.

+
+ - To add a shell for debugging your snap, add an extra app whose command is:
+ jhbuild -f $SNAP/etc/jhbuildrc shell. You might also want to add gdb,
+ strace, etc. to your list of stage-packages for debugging purposes.
@elopio

elopio Sep 20, 2016

Member

I must say that this section for tips and tricks is great.

snapcraft/plugins/jhbuild.py
+# build dependencies that JHBuild doesn't know about
+MODULE_EXCEPTIONS = {
+ 'vala': ['valac'],
+ 'gst-plugins-bad': ['libgl1-mesa-dev'],
@elopio

elopio Sep 20, 2016

Member

I don't think it's common in python to use spaces like this, to format a table. I would prefer just one space between the : and the element. You might even get pep8 errors for this, I'm not sure.

snapcraft/plugins/jhbuild.py
+
+ @property
+ def skipped_modules(self):
+ return [module[1:] for module in self.options.modules if module.startswith('-')]
@elopio

elopio Sep 20, 2016

Member

I might be slow, but why are you removing the first element?

@attente

attente Sep 22, 2016

It's just to remove the initial '-' that's present for the skipped modules, like '-Webkit' -> 'WebKit'.

snapcraft/plugins/jhbuild.py
+
+ /<path to snapcraft.yaml>/parts/<part name>/src/jhtarballs
+ """
+ return self.options.jhtarballs or os.path.join(self.sourcedir, 'jhtarballs')
@elopio

elopio Sep 20, 2016

Member

wouldn't this be better in the init?

snapcraft/plugins/jhbuild.py
+
+ /snap/<snap name>/<snap revision>/usr/share
+ """
+ return os.path.join(self.prefix, 'usr', 'share')
@elopio

elopio Sep 20, 2016

Member

We usually define the attributes in the init, not as properties. Because then the statement is executed only once, not every time the attribute is accessed.

attente added some commits Sep 7, 2016

attente commented Nov 22, 2016

Superceded by #924 which doesn't require the use of LXC any more.

@attente attente closed this Nov 22, 2016

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