Commit Graph

46 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 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 30581bf63a Support multiple instances of install-deps-from
Closes: #284
Approved by: alexlarsson
2019-06-10 06:30:10 +00:00
Alexander Larsson 2d938e2ccd Move flatpak_version_check to builder-utils.c
Closes: #274
Approved by: alexlarsson
2019-03-05 07:13:34 +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
Mathieu Bridon 7d318128b6 from-git: Check out the whole tree instead of just the manifest
Some manifests now make use of the shared-modules Git repo from Flathub.
At least Totem does that, and we might see others do the same.

    https://gitlab.gnome.org/GNOME/totem/blob/master/flatpak/org.gnome.Totem.json
    http://sdkbuilder.gnome.org/logs/build-2019-01-18-141001/build-gnome-apps-nightly-master-org.gnome.Totem-x86_64.txt

That means we have to checkout the whole tree, otherwise we can't parse
the manifest.

Closes: #260
Approved by: alexlarsson
2019-02-05 14:58:27 +00:00
Mathieu Bridon dec058da72 from-git: Fetch the submodules as well
Some manifests now make use of the shared-modules Git repo from Flathub.
At least Totem does that, and we might see others do the same.

    https://gitlab.gnome.org/GNOME/totem/blob/master/flatpak/org.gnome.Totem.json
    http://sdkbuilder.gnome.org/logs/build-2019-01-18-141001/build-gnome-apps-nightly-master-org.gnome.Totem-x86_64.txt

That means we have to fetch the Git submodules before we can parse the
manifest.

Closes: #260
Approved by: alexlarsson
2019-02-05 14:58:27 +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
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 51fc2cb07b Set SOURCE_DATE_EPOCH to the mtime of the manifest
This will help make reproducible builds.

Closes: #255
Approved by: alexlarsson
2019-01-11 15:40:43 +00:00
Matthias Clasen 02c69e65d1 Check the flatpak version
Before using --noninteractive, check that we are dealing
with a new-enough flatpak to understand that option.

Closes: #254
Approved by: alexlarsson
2019-01-11 14:53:08 +00:00
Matthias Clasen d5d6debdce Pass --noninteractive to flatpak install
This produces output more suitable for flatpak-builder.

Closes: #254
Approved by: alexlarsson
2019-01-11 14:53:08 +00:00
Alexander Larsson fb43fa0e00 mirror-screenshots: Run appstream-util "mirror-screenshots in the sandbox
This way we don't rely on the host appstream-glib which could be old.
We already rely on it in the runtime for appstream-compose.

Closes: #217
Approved by: alexlarsson
2018-09-26 12:40:11 +00:00
Alexander Larsson 050e075b81 mirror-screenshots: Don't modify cache object
appstream-util mirror-screenshots rewrites the xml file in-place, so
we need to break hardlinks the before running it, otherwise it will
modify the cache object in place, breaking the repo.

Closes: #217
Approved by: alexlarsson
2018-09-26 12:40:11 +00:00
Bastien Nocera dda576d899 builder: Ensure committer is set when running git-commit
Otherwise buildbots, and other non-interactive/clean-room builds might
not have git committer information set, and make it impossible to
successfully commit, and git erroring out with:
*** Please tell me who you are.

Closes: #183
Approved by: alexlarsson
2018-08-11 10:34:34 +00:00
Robert McQueen b9584e7fb1 main: ensure mirror URLs are /-terminated
The mirror URL is composed with the file we want using soup_uri_new_with_base,
which means a mirror path that is not /-terminated will have it's last element
stripped off. When parsing the list of sources URI arguments, add a / if needed
before the Soup base URI object is created.

Closes: #198
Approved by: alexlarsson
2018-08-08 12:47:50 +00:00
Alexander Larsson 99a5356bfb Make p2p support non-optional, now that we depend on 0.99.1
Closes: #175
Approved by: alexlarsson
2018-06-28 11:22:24 +00:00
Alexander Larsson 247525a800 Fix --install with latest flatpak by passing -y
These days flatpak install will always prompt for input,
so we pass -y to it because otherwise (due to non-inherited
stdin) we auto-answer no.

Fixes https://github.com/flatpak/flatpak-builder/issues/170
2018-06-27 16:05:39 +02:00
Denis Ollier 7bd6440b75 Don't prune build stages from cache with --{export,finish}-only
A commonly used CI workflow [1] is to chain the following steps:

    > flatpak-builder --stop-at=<module>
    > flatpak build <commands to build module from local checkout>
    > flatpak-builder --finish-only

Unfortunately, the last step always purge all the compilation cache
created by the first one. All build steps are marked unused by default
and since they are skipped due to the option --finish-only, all of them
are always pruned by the gc function.

As a result, flatpak-builder cache becomes useless, a full compilation
is always performed.

Improve this by not cleaning unused stages when no compilation is done
by flatpak-builder (i.e: when flatpak-builder is used with --export-only
or --finish-only option).

[1]: https://gitlab.gnome.org/GNOME/Initiatives/wikis/DevOps-with-Flatpak
2018-06-11 15:47:39 +02:00
Alexander Larsson dd80a13e1b Work around libsoup type initialization deadlocks
As reported in
https://bugzilla.gnome.org/show_bug.cgi?id=796031#c1
we sometimes hang in libsoup downloading stuff. This uses
an early type initialization to avoid that.

We don't use libsoup for the main download anymore, but
its still used for some things, so better safe than sorry.

Closes: #153
Approved by: alexlarsson
2018-05-18 06:20:48 +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
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
Alexander Larsson cbca5b5dce Fix --install to not pass --subpath= to flatpak install
This isn't really right, as install doesn't handle an empty subpath
like that. In fact, doing so will break exports.

Closes: #124
Approved by: alexlarsson
2018-04-06 14:25:39 +00:00
Alexander Larsson 7b042c61e6 Add --no-shallow-clone for git mirroring
This is useful e.g. when doing mirroring only, or if your git
has issues with shallow clones.

Closes: #120
Approved by: alexlarsson
2018-03-27 13:41:42 +00:00
Alexander Larsson cd32a386fb ccache: Enforce disabled if not enabled
This makes sure that ccache is disabled if you don't enable
it on the commandline. This makes sense, because we don't
have any persistant location for the ccache files anyway.

Additionally this is done to work around a race condition initializing
~/.ccache/ccache.conf that causes meson builds to error out.

Closes: #118
Approved by: alexlarsson
2018-03-27 12:54:11 +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 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 543f25e8e3 --install: Fix path != NULL assertion when not using --repo
Closes: #86
Approved by: alexlarsson
2017-12-20 10:18:27 +00:00
Alexander Larsson d869c778ce --install: Fix double unref when --repo is not installed
export_repo is an autopr, so we have to ref it.

Closes: #86
Approved by: alexlarsson
2017-12-20 10:18:27 +00:00
Alexander Larsson 5305a17915 --install: Always pass --reinstall
Otherwise the second --install failes

Closes: #85
Approved by: alexlarsson
2017-12-15 13:04:20 +00:00
Alexander Larsson 07240bf3a7 --install: Warn if --require-changes and --install interact badly
If there were no change we didn't export and there might be nothing
to install, so print a notice that we're ignoring the install.

Closes: #85
Approved by: alexlarsson
2017-12-15 13:04:20 +00:00
Alexander Larsson be191a57f1 --install: Don't pass relative path to flatpak install
That is parsed as a remote name, so ensure we pass the absolute pathname.

Closes: #85
Approved by: alexlarsson
2017-12-15 13:04:20 +00:00
Alexander Larsson 050feb1294 Add --install argument
This allows you to build and install the result in a single operation.
If a --repo is given the app is installed from there, otherwise we
build-export it to the flatpak-builder cache repo, which already has
all the objects that are needed in it, so this will not increase
disk-use.

Closes: #81
Approved by: alexlarsson
2017-12-14 09:27:59 +00:00
Philip Withnall 26e648ae99 context: Expose errors from builder_context_set_checksum_for()
The function only does I/O, so could fail. Expose failure to the caller
rather than hiding it.

Coverity CID: #208385

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #74
Approved by: alexlarsson
2017-12-06 09:23:17 +00:00
Alexander Larsson 9c4007fc0d Add --state-dir option
This allows using a shared state dir for downloads and build caches.

Closes: #67
Approved by: alexlarsson
2017-11-21 13:55:00 +00:00
Alexander Larsson 0797c72db7 Add support for running tests
Modules that say "run-tests": true, will run tests after installation,
unless disabled by --disable-tests.

The tests run by default are make check or ninja test, however you
can control the make/ninja target with test-rule, or supply a list
of commands with test-commands. There is also a test-args argument
in build-options, which you can use to give e.g. network access.

The tests are run with readonly access to the install directory, so
they cannot affect the build results.

Closes: #65
Approved by: alexlarsson
2017-11-16 08:09:21 +00:00
Alexander Larsson 73e64a4434 Change debug output from XAB to FB
This is no longer xdg-app-builder, but flatpak-builder.
2017-11-16 09:03:35 +01: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 25805d5220 git: Add git mirror flags to simplify API
This is nicer than a bunch of booleans

Closes: #62
Approved by: alexlarsson
2017-11-06 12:42:36 +00:00
Alexander Larsson cb11d421f6 --from-git: Allocate builddir before mirroring 2017-10-31 12:50:51 +01:00
Alexander Larsson 0fed4a6433 --from-git: Drop origin/ now that we're not mirroring on checkout 2017-10-31 11:24:20 +01:00
Alexander Larsson ac6a25c981 Add option to disable shallow clone for git sources
Closes: #55
Approved by: alexlarsson
2017-10-30 10:57:35 +00:00
Alexander Larsson 584af95176 Add more terminal title status updates 2017-09-06 17:03:37 +02:00
Alexander Larsson faba587a72 Move common/flatpak-utils.* to src/builder-flatpak-utils.* 2017-08-25 09:36:49 +02:00
Alexander Larsson 5823533bd7 Move builder/ to src/ 2017-08-25 09:30:53 +02:00