New plugin: Script (runs bash scripts) #664

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
5 participants

MonJamp commented Jul 15, 2016

Allows the user to use bash scripts during the build and pull stages.

Fixes LP#1604107
I've signed the CLA and my username on Launchpad is filjoa.

Can one of the admins verify this patch?

Can one of the admins verify this patch?

Collaborator

sergiusens commented Jul 20, 2016

Hi, thanks for your contribution. There are some simple fixes required like fixing the Copyright dates. It also feels like this plugin should be called script (run) instead of bash.

On the usefulness side, aside from the integration test is there any real world project that could use this already?

Last but not least, is there any benefit of not doing this in a custom plugin itself?

snapcraft/plugins/bash.py
+ super().pull()
+
+ if "pull" in self.options.stages:
+ command = [self.sourcedir + '/' + self.options.script]
@sergiusens

sergiusens Jul 20, 2016

Collaborator

please use os.path.join here.

New plugin: Bash
Pass static tests

Passed some unit tests

Initial integration tests

Remove import os

Improve coverage

Renamed bash to script and other fixes

Update snapcraft.yaml

Pass unit tests

Pass static test and other fixes

Pass integration tests

Pass final tests

MonJamp commented Jul 20, 2016

I renamed the plugin to script and fixed the copyright dates.

I don't know about any real world projects that use bash scripts but I do have a project that I'm working on that would need to run a bash script in order to allow others to easily build. The project has a dependency that can only be obtained by going to the creator's website, logging in, downloading the dependency, and then manually installing the headers/libraries.

I'm not sure I completely understand your last question but having an existing bash plugin shipped with snapcraft means the user doesn't have to do any extra fiddling trying to get their project snapped. I haven't been on the IRC room for that long but I've already seen a few people asking how to run their bash scripts.

@MonJamp MonJamp changed the title from New plugin: Bash to New plugin: Script (runs bash scripts) Jul 20, 2016

+ Run the given script name.
+ - stages:
+ (list of strings)
+ Run the script in the given stages. (default: ['build'])
@elopio

elopio Jul 21, 2016

Member

You could have a script for pull, and a different one for build. Or you could have to run two commands in one of those phases.

I'm not quite sure about this plugin, because you are trying to wrap a wild (and sometimes a little random :) thing like a custom build script into a generic workflow with fixed phases and arguments. So there will be a lot of cases that will need modifications on this plugin to work.

I think that instead of providing a plugin to run a script, we should provide better guidelines to let people make their own custom plugin that runs whatever they need to pull, and then whatever they need to build. In these past weeks I've seen all kinds of crazy things during build, I see no good way to make them behave in a similar way.

Grumpiness aside, welcome to the snapcraft! Your contribution is really appreciated. Thank you.

@MonJamp

MonJamp Jul 21, 2016

I understand what you're saying, but I still think it wouldn't hurt to at least have a simple bash plugin to base custom plugins from. Also I would imagine that running one command for the building phase and maybe another command for the pulling phase covers the majority of the use cases for bash based project building.

Member

kyrofa commented Aug 12, 2016

Yeah, I gotta say I agree with @elopio here. This is opening a can of worms: it feels like a one-size-fits-all solution to a problem that vastly differs from project to project. I see its features quickly bloating as people want capabilities for their specific problem, when we already have a solution for weird problems: local plugins (or just write a Makefile). Bash is not a build system; asking it to be one is asking for problems.

Collaborator

sergiusens commented Aug 17, 2016

Closing as we are discussing in #727

@sergiusens sergiusens closed this Aug 17, 2016

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