Skip to content

Commit

Permalink
Add more info about reusable parts. (#527)
Browse files Browse the repository at this point in the history
Add link to the parts wiki in serveral places and add a section to
the parts documentation explaining how to reuse parts.

LP: #1582499
  • Loading branch information
josepht authored and sergiusens committed Jun 23, 2016
1 parent b234942 commit 8a64112
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 6 deletions.
13 changes: 7 additions & 6 deletions docs/snapcraft-advanced-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ after:
```

As we never define the `curl` part in the above example, `snapcraft` will
check the Ubuntu Wiki, which is where we currently host examples of
successful snapcraft parts. The build order in this case would be `curl`,
then `main`.
check the Ubuntu [Wiki][wiki],
which is where we currently host examples of successful snapcraft parts.
The build order in this case would be `curl`, then `main`.


## Finishing steps
Expand Down Expand Up @@ -270,8 +270,9 @@ add to the snap.

### Endless possibilities

Combining various plugins and parts and using the wiki plugin make `snapcraft`
incredibly versatile. On top of that, you can write [your own plugin] [plugin]
as well.
Combining various plugins and parts and using [the wiki][wiki] plugin make
`snapcraft` incredibly versatile. On top of that, you can write
[your own plugin] [plugin] as well.

[plugin]: plugins.md
[wiki]: https://wiki.ubuntu.com/snapcraft/parts
40 changes: 40 additions & 0 deletions docs/snapcraft-parts.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,43 @@ If you only need to embed a Java runtime, add a part with the jdk type. This
will pull a relocatable OpenJDK via the default-jdk Ubuntu package and will
set the proper `JAVA_HOME` and `PATH` environment variables in wrapper
scripts generated by snapcraft or when running the app locally.


## Reusing parts

Successful snapcraft parts can be published in
[the wiki][wiki] and reused by other snapcraft.yaml files. A part that does
not include the 'plugin' option will be searched for on [the wiki][wiki] and
the content from there will be used to build the part locally. As the number
of published parts increases, writing a snapcraft.yaml file will get easier
because one would simply include a set of published parts and the local part(s)
specific to the snap being created.

The format of the wiki entries is a stream of YAML documents with the following
required fields:

* origin - The url where the snapcraft.yaml is located
* project-part - The actual part to be published
* description - A brief description of the part.
* maintainer - The person who maintains the part's name and email address.

Optional fields are:

* origin-type - A hint about the type of project that contains the part. (e.g. bzr, git, tar)
* parts - A YAML list of other parts from the snapcraft.yaml that are needed to use the project-part.

### Note:

It can take up to an hour for updates to the wiki to become available to snapcraft.

### Example:

```yaml
---
project-part: curl
origin: https://github.com/curl/curl
maintainer: John Doe <john.doe@example.com>
parts: [libcurl]
```

[wiki]: https://wiki.ubuntu.com/snapcraft/parts

0 comments on commit 8a64112

Please sign in to comment.