Commit Graph

52 Commits (master)

Author SHA1 Message Date
Dan Nicholson aec06b3945 Support passing --token-type to build-export
Provide a --token-type command line option and a token-type manifest
property that allows passing the token type to build-export. The
manifest property takes precendence over the CLI option. In either case,
the value will be passed to build-export if it's >= 0. This requires
flatpak >= 1.6 to use the --token-type option in build-export.
2020-03-19 16:29:27 +01:00
Alexander Larsson 8cd9401619 Support duplicate module names
If two modules happen to have the same name we uniquify them by
appending "-$n". While you shouldn't normally rely on this it is
sometimes hard to avoid when you're including some json snippet you
don't have control over.

Closes: #308
Approved by: alexlarsson
2019-09-13 13:25:32 +00:00
Alexander Larsson aab7bcd5e9 Support --show-manifest
We want to use this in flathub to avoid all the problems we've having
parsing json manifests via the python parser, which isn't *quite* compatible
with json-glib (differs in comment and multiline string support for instance).

Closes: #307
Approved by: alexlarsson
2019-09-13 12:55:18 +00:00
Matthew Leeds 9baa2134e7 Use flatpak_spawnv() more
This means when flatpak-builder runs a flatpak command in a subprocess,
we can see the arguments passed to flatpak in the flatpak-builder
output, if -v was used.

Closes: #291
Approved by: alexlarsson
2019-06-28 08:55:11 +00:00
Seppo Yli-Olli cd1923a776 Make error handling more understandable
Closes: #284
Approved by: alexlarsson
2019-06-10 06:30:10 +00:00
Seppo Yli-Olli 30581bf63a Support multiple instances of install-deps-from
Closes: #284
Approved by: alexlarsson
2019-06-10 06:30:10 +00:00
Alexander Larsson 15eb895e00 Update platform creation to ensure good mtimes and better cacheing
This splits the platform creation into 3 parts:
 * base - create the initial directory based on the parent platform
 * prepare - run prepare commands and apply all changes
 * cleanup - apply cleanups and cleanup commands

This has cacheing advantages in that prepare_commands and cleanup changes
only cause the minimal amount of rebuilds.

Additionally, it ensures that the mtimes are zeroed out (from the
previous checkout) both when the prepare and cleanup commands are run.
This is actually important, since these often generate caches (for
example fontconfig ones) which rely on zeroed mtimes so they match
what will be deployed.

Closes: #277
Approved by: alexlarsson
2019-04-04 08:48:18 +00:00
Alexander Larsson acec80a8db install-deps: Pass --noninteractive for flatpak >= 1.2.0
Closes: #274
Approved by: alexlarsson
2019-03-05 07:13:34 +00:00
Alexander Larsson c7f8a50f7b Fix handling of sdk default compiler options
It turns out that newer flatpaks changed the output of flatpak info
and we relied on parsing that due to the lack of --show-location option
to flatpak info. However, that has been added since flatpak 0.11.8, so
just use that instead of parsing it.

Closes: #270
Approved by: alexlarsson
2019-02-08 10:21:47 +00:00
Alexander Larsson 8839ff08b1 Fixup error messages
We were printing argv[3] which is wrong (and typically null).
Instead set the error message where it happens and we know
what we were trying to do.

Closes: #269
Approved by: alexlarsson
2019-02-06 09:04:44 +00:00
Alexander Larsson ab72117fdd Add --add/remove-tag options
We'd like to use these in flathub.

Closes: #268
Approved by: alexlarsson
2019-02-04 10:02:33 +00:00
Mathieu Velten 21356f8616 manifest: use the sdk branch from the sdk ref specified by the user
install_extension_deps now takes the sdk branch as param as a side effect

Closes: #266
Approved by: alexlarsson
2019-02-04 09:52:04 +00:00
Alexander Larsson 00f63cfe7e manifest: Add default-branch key
This is similar to branch and used if branch is not set. However, this
key (as opposed to branch) is overridden by the --default-branch option.

The idea is that most apps in flathub would use default-branch=stable, so
that a standart flatpak-builder command will build a "stable" release.
However, when building a test build we can use --default-branch=test to
override that. Then special cases like theme extensions and other things
that require a specific branch value to work at all can use branch="1.0".

Closes: #264
Approved by: alexlarsson
2019-01-26 03:16:27 +00:00
Alexander Larsson fd802105c5 Keep x-* properties in manifest.json
This add custom (de)serialization code for the source, module and manifest
objects so that properties starting with "x-" are kep and then put back
in the manifest.

We also add a checksum of the manifest to the "finish" phase so that
if you change them the manifest is re-generated.

Closes: #203
Approved by: TingPing
2018-08-15 16:39:06 +00:00
Alexander Larsson b664e2fc32 Support --run in a sandbox
Closes: #195
Approved by: alexlarsson
2018-08-08 14:02:32 +00:00
Alexander Larsson d0a489d90c Make X-Flatpak-RenamedFrom a list so that we can handle multiple renames
Fixes https://github.com/flatpak/flatpak-builder/issues/184

Closes: #193
Approved by: alexlarsson
2018-08-08 12:10:15 +00:00
Alexander Larsson cfcbf75cd7 rename-desktop-file: Add X-Flatpak-RenamedFrom key
This way desktop environment can handle the case
where a desktop file was renamed and avoid showing
two icons.

Closes: #181
Approved by: alexlarsson
2018-07-10 16:46:08 +00:00
Alexander Larsson 6d9f874c12 install-deps: Always pass -y when installing
The prompts don't currently work when we shell out to
flatpak, so this is broken without -y.
2018-06-21 10:47:40 +02:00
Richard Hughes a233e84c11 Rewrite the <launchable> tag when using rename-desktop-file
This also changes the <id> rewriting to use the non-desktop suffixed version of
the application ID as this has been deprecated now the launchable tag exists.

Applications shipping an appdata file without a launchable set will have one
auto-added at runtime based on the appstream <id>.

This copies FlatpakXml from the flatpak project.

Fixes https://github.com/flatpak/flatpak-builder/issues/155

Closes: #164
Approved by: alexlarsson
2018-06-19 13:16:30 +00:00
Alexander Larsson 31f92b5044 Fix C99 warning on rhel7 2018-05-14 15:53:20 +02:00
Valentin David 37b9ea8d5d Load SDK configuration file.
Closes: #148
Approved by: alexlarsson
2018-05-07 15:26:15 +00:00
Alexander Larsson 1fcd849ce3 When using --download-only skip some checks
When downloading only we will not be building, so we can skip all the checks for dependencies
and for the state-dir properties.

Closes: #145
Approved by: alexlarsson
2018-05-03 15:43:41 +00:00
Alexander Larsson ed2eabc65b --run: bind-mount both /run/build and /run/build-runtime
We need /run/build-runtime if what we're building was a runtime, and
its not clear what we're building, so just bind both.
2018-04-23 14:19:26 +02:00
Alexander Larsson e779d3c485 Support using app-extensions during the build
This adds add-build-extensions which is similar to add-extensions
except the extension is added at build-init time, so can be
used during the build. It can also optionally be removed after
the build is done.

This depends on the flatpak work in:
  https://github.com/flatpak/flatpak/pull/1598

With this I was able to build the following app which runs 32bit binaries
in a 64bit build:

```
{
    "app-id": "org.example.Multilib",
    "runtime": "org.freedesktop.Platform",
    "sdk": "org.freedesktop.Sdk",
    "runtime-version": "1.6",
    "command": "/usr/bin/true",
    "add-build-extensions": {
        "org.freedesktop.Platform.Compat32": {
            "directory": "lib/32bit",
            "add-ld-path": "lib",
            "version": "1.6"
        }
    },
    "modules": [
        {
            "name": "test 32bit",
            "buildsystem": "simple",
            "build-commands": [
                "ln -s /app/lib/32bit/lib/ld-linux.so.2 /app/lib/ld-linux.so.2",
                "/app/lib/32bit/bin/echo echoing from 32bit world"
            ]
        }
    ]
}
```

Closes: #129
Approved by: alexlarsson
2018-04-23 07:06:07 +00:00
Alexander Larsson 3d62f01610 Record the built extensions in the metadata
This adds a section to the main metadata like:
```
[Build]
built-extension=org.the.App.Locale;
```

This can be used to figure out what refs where built that are
related to the app, for example if you want to bundle them all.

Closes: #128
Approved by: alexlarsson
2018-04-19 12:54:02 +00:00
Ryan Gonzalez e24c2218f1 Add YAML support as an alternative to JSON (closes #2)
Closes: #127
Approved by: alexlarsson
2018-04-19 12:44:38 +00:00
Sam Spilsbury 8eabc27920 manifest: Add support for "extension-tag"
This passes an --extension-tag to flatpak build-init which will
set the "tag" option on the ExtensionOf section in the metadata.

Closes: #126
Approved by: alexlarsson
2018-04-19 11:25:13 +00:00
Alexander Larsson 1619ef1861 Add inherit-sdk-extensions property
This is similar to inherit-extensions, but the extensions
are not also inherited into the platform when it is created.

Closes: #121
Approved by: alexlarsson
2018-03-27 14:10:15 +00:00
Alexander Larsson 52c17219eb Add support for -y, passed on to all install commands
This allows you to run --install-from-deps=foo -y to always install all
dependencies. Useful for auto-builders like flathub.

Closes: #107
Approved by: mwleeds
2018-02-16 07:49:17 +00:00
Christian Hergert 551d245207 manifest: run flatpak on the host if inside of flatpak
This allows us to be run from inside of a flatpak application and
successfully build by proxying the flatpak commands to the host.

Closes: #100
Approved by: alexlarsson
2018-01-12 10:06:12 +00:00
Christian Hergert 897fe1b768 utils: add GSubprocessFlags parameter
This allows us to pass it through in the case we're running in the same
pid namespace as the flatpak-builder process.

Closes: #100
Approved by: alexlarsson
2018-01-12 10:06:12 +00:00
Alexander Larsson 39ad84c499 flatpak_compose_ref: Remove unused error argument
Closes: #81
Approved by: alexlarsson
2017-12-14 09:27:59 +00:00
Alexander Larsson 960c36ab88 appdata: Only rename complete matches of the id
We don't want to rename partial hits of the desktop id, nor
inside any other tag.

Fixes https://github.com/flatpak/flatpak/issues/1118

Closes: #83
Approved by: alexlarsson
2017-12-14 08:47:51 +00:00
Alexander Larsson cf9d35de32 Add --log-*-bus to flatpak-builder --run
This requires https://github.com/flatpak/flatpak/pull/1160

Closes: #63
Approved by: alexlarsson
2017-11-14 12:02:46 +00:00
Alexander Larsson 0a2c7a0dea Fix warning about /* inside comment
Closes: #63
Approved by: alexlarsson
2017-11-14 12:02:46 +00:00
Alexander Larsson 426e664b7a appdata: When looking for appdata, find canonical name first
bijben had both a metainfo and an appdata, which caused EEXIST when
renaming the file.
2017-11-07 15:39:32 +01:00
Alexander Larsson f5693ab5de run: Don't pass --die-with-parent when we --run
In this case we will exec rather than fork + exec, so we don't
want to use prctl, as that can cause the app to die if any
*thread* in the parent dies (rather then the whole process).

In particular, this caused issues for gnome-builder starting
a newly built flatpak:ed app.

Closes: #51
Approved by: alexlarsson
2017-10-27 06:43:23 +00:00
Alexander Larsson 039a24aeb4 utils: Add flags argument to flatpak_spawn
This allows you to e.g. silence STDERR

Closes: #47
Approved by: alexlarsson
2017-10-17 10:31:28 +00:00
Alexander Larsson 3b14684464 Drop _compat_ things we added
We want a clean slate for 0.10, and it actually makes sense to rebuild
now, because the debuginfo compression will change everything (for
the better).
2017-10-09 13:32:41 +02:00
Alexander Larsson 1a4240eacc platform: Delete from base the things that were deleted in the sdk.
This fixes the issue in:
    https://github.com/flatpak/flatpak/issues/1024#issuecomment-333321323
Where we removed the base platform gstreamer plugins in the the
sdk, but they were not removed in the platform.
2017-10-09 13:29:19 +02:00
Alexander Larsson 01eb5dc945 Add prepare-platform-commands property
This allows you to modify the base platform, before applying the
new files. For instance, this is one way to fix
https://github.com/flatpak/flatpak/issues/1024#issuecomment-333321323
where we need to remove old gstreamer plugins from the base.
2017-10-09 13:29:19 +02:00
Alexander Larsson fb71c99ffb Accept .metainfo.xml appdata extensions
We find these either in the appdata or the metainfo directory.
However, we always move it to the appdata dir with the appdata
extension, because that means older versions of appstream-compose
will always pick it up.

Closes: #44
Approved by: alexlarsson
2017-10-06 12:48:58 +00:00
Alexander Larsson 5818790510 Add extra-data source type
All this does is construct a finish arg, but it makes it a lot nicer
to create extra-data using manifest. Additionally, it allows you to
create per-arch extra data if you set only-arches on the source.

Closes: #40
Approved by: alexlarsson
2017-09-29 07:01:53 +00:00
Alexander Larsson 9f3e786c29 Add appdata-license field
This lets you modify the project_license field in the appdata file.
This is useful because appdata files from upstream generally only
contain license information for the app itself, whereas the
bundled app may contain other code with additional licenses.

Closes: #41
Approved by: alexlarsson
2017-09-29 07:01:40 +00:00
Alexander Larsson d768afabfe Drop all compat from the checksum in preparation of new stable release
This means a lot of caches will rebuild, but we're then in a
stage where we can start adding new things in a compat way in the
stable series.
2017-09-22 17:10:06 +02:00
Alexander Larsson 709b71a268 Always set locale-subset=true for locale extensions 2017-09-21 17:04:07 +02:00
Alexander Larsson 9e5a4b1103 Pass --with-appdir when doing flatpak-builder --run 2017-09-19 11:53:53 +02:00
Alexander Larsson 2b61639790 cache: Always return changes sorted
This helps in comparisons, etc.
2017-09-14 13:27:33 +02:00
Alexander Larsson 584af95176 Add more terminal title status updates 2017-09-06 17:03:37 +02:00
Alexander Larsson 5068a700d0 builder: Pass --die-with-parent to all flatpak build commands
This is not done by default anymore, as per
 75d7e76276
2017-08-30 11:27:57 +02:00