Add debs plugin to easily create snaps from deb files #53

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

longsleep commented Oct 30, 2015

The debs plugin helps to easily create snaps with files built as deb packages. It can use local deb files or pull deb files from remote http urls.

Example for busybox

busybox:
    plugin: debs
    debs:
      - http://ports.ubuntu.com/pool/main/b/busybox/busybox-static_1.22.0-15ubuntu1_armhf.deb

We use this to build armhf snaps on amd64 build platform like this:

DEB_BUILD_ARCH=armhf DEB_BUILD_MULTIARCH=arm-linux-gnueabihf snapcraft

It also allows us to use existing clean builds (cowbuilder to create deb packages) to directly use with snappy.

+
+from snapcraft.repo import _fix_contents
+from snapcraft.common import isurl
+
@sergiusens

sergiusens Oct 30, 2015

Collaborator

Can you add a docstring here explaining the plugin a bit? Use the other plugins as inspiration for the format explaining the keys and use.

@longsleep

longsleep Oct 30, 2015

Contributor

Yes - i will add docs and preferably also an example - suggestions for a package which would make a fine example?

+ def schema(cls):
+ return {
+ 'properties': {
+ 'debs': {
@sergiusens

sergiusens Oct 30, 2015

Collaborator

I have an inclination for calling this deb-packages or debian-packages, in the help we also need to mention that dependencies won't we resolved.

+
+ def pull_file(self, source, destdir=None):
+ if isurl(source):
+ self.run(['wget', '-q', '-c', source], cwd=destdir)
@sergiusens

sergiusens Oct 30, 2015

Collaborator

how about using python requests?

@longsleep

longsleep Oct 30, 2015

Contributor

Sure, i can use requests - seems like snapcraft has that dependency already / i did not want to introduce any new dependencies.

+ if isurl(source):
+ self.run(['wget', '-q', '-c', source], cwd=destdir)
+ else:
+ self.run(['cp', os.path.join(os.getcwd(), source), destdir])
@sergiusens

sergiusens Oct 30, 2015

Collaborator

how about shutil.copy.* or os.link?

+
+ def build(self):
+ self.unpack_debs(self.packages, self.installdir, debdir=self.sourcedir)
+ _fix_contents(debdir=self.installdir)
@sergiusens

sergiusens Oct 30, 2015

Collaborator

this is a private implementation, if you wish to use it fine, but remove the _

Collaborator

sergiusens commented Oct 30, 2015

Can you get master rebased/merged to get the .travis.yml

longsleep added some commits Jul 31, 2015

Contributor

longsleep commented Oct 30, 2015

Rebased to master to get travis.

Collaborator

sergiusens commented Oct 30, 2015

The integration tests failed, luckily a simple one:
2015.com.canonical.snapcraft::snapcraft/normal/list-plugins: fail

Collaborator

sergiusens commented Nov 16, 2015

I'll be closing this until it is ready again. Looking forward to seeing this pass its tests.

@sergiusens sergiusens closed this Nov 16, 2015

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