Commit Graph

396 Commits (18451644ffba004395bb016adbdb0bfe7d6ff50e)

Author SHA1 Message Date
Alexander Larsson 4190458d8a Make flatpak-builder run not forward wrong build-finish flags
Some of the build-finish flags we may use make no sense
to pass to flatpak build, so skip them
2017-02-07 16:39:23 +01:00
Alexander Larsson b24228277d Support appdata in share/metainfo also with rename-appdata-file 2017-02-06 11:59:03 +01:00
Jan Grulich 7c7c64c378 Search also in share/metainfo subdir for appstream metadata 2017-02-06 11:54:15 +01:00
Alexander Larsson 69235eeb77 builder: Support cleanup-platform-commands 2017-02-06 10:22:09 +01:00
Alexander Larsson 4feb82e75b builder: Remove the sdk locale/debug extension from the platform
Without this the platform metadata has locale extensions from
both the sdk and the platform
2017-02-02 13:55:30 +01:00
Alexander Larsson e38d980bca builder: Initial version of extension building support 2017-01-27 15:27:55 +01:00
Alexander Larsson 7d4ca72cba builder: User the new --type=runtime to build runtimes 2017-01-27 10:07:23 +01:00
Bartłomiej Piotrowski 751cae4639 builder: add cmake-ninja support
The commit adds another buildsystem, cmake-ninja, that tells
CMake to generate Ninja rules instead of Makefile.

Fixes #461.
2017-01-20 15:28:27 +01:00
Ikey Doherty 605c7ee87b Fix compiler warnings with uninitialised cleanup pointers
This change fixes GCC compiler warnings where a cleanup function was
specified on an uninitialised pointer, which in the view of GCC could
result in an errornous free of uninitialised memory, if the functions
that initialise them do not return NULL.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-01-19 10:05:13 +01:00
Patrick Griffis a410e86fff builder: Error when failing to include modules
Currently it can silently fail if an included file is invalid
or missing. This makes that fatal.
2016-12-22 14:39:41 +01:00
Alexander Larsson 8737153ded builder: Fix --verbose logging
We need to pass the right log domain in.
2016-12-19 14:55:22 +01:00
Alexander Larsson 364def2135 builder: Add some spew when applying patches
This makes it easier to figure out what patch is broken
2016-12-12 17:20:36 +01:00
Alexander Larsson e514dc2e14 Add flatpak_create_soup_session 2016-12-08 16:41:20 +01:00
Patrick Griffis 21b65947e8 builder: Add buildsystem option and meson support
Closes #400
2016-11-30 16:59:20 +01:00
Alexander Larsson 632f714509 builder: Add "options" property to patch sources
This lets you specify custom arguments to the patch command.

Fixes https://github.com/flatpak/flatpak/issues/417
2016-11-30 10:17:15 +01:00
Alexander Larsson 8ce04c6788 builder: Add support for --jobs=N to limit parallel builds
As requested in: https://github.com/flatpak/flatpak/issues/419
2016-11-30 09:57:55 +01:00
Alexander Larsson 462178bcd3 builder-options: Fix leaks 2016-11-28 17:23:38 +01:00
Alexander Larsson 100038513d builder: Fix coverity warning
If type is NULL we should never look at it.
2016-11-21 10:28:13 +01:00
Matthew Leeds 7b8becd1b2 builder: Don't download modules that won't be built
Currently flatpak-builder downloads the sources for all modules, even if
the --stop-at option prevents them from being built. This commit changes
the behavior so that we don't bother to download the ignored modules.
2016-11-15 15:01:05 +01:00
Alexander Larsson 7c0ef5dccb builder-source: Check for type == NULL before dereferencing 2016-11-11 10:48:37 +01:00
Matthew Leeds 8b50648ec0 builder: Check if .gitmodules exists before showing it. Fixes #366
This commit checks if <revision>:.gitmodules exists in the repo before
calling git-show on it, so an error message doesn't show up in the
program's output.
2016-11-01 09:30:31 +01:00
Alexander Larsson 6e31932221 OCI: Generate an oci image dir structure instead of a runtime 2016-10-31 20:11:14 +01:00
Alexander Larsson 1b09719298 builder: Handle app ids with dashes in them
An app id like org.domain.App-name is now allowed (dashes in the
last element), but blindly appending e.g. ".Locale" to these
for the locale extension will cause an invalid id.

In order to handle this we replace "-" with "_" in this case, which
should be fine as both are under the org.domain control which can
make sure there are no conflicts, and there is no requirement for
the id prefixes to exactly match.

This fixes https://github.com/flatpak/flatpak/issues/370
2016-10-26 21:40:49 +02:00
Alexander Larsson fad8af2f36 builder: Break out name generation for Debug and Locale extensions
These helpers lets us tweak these names
2016-10-26 20:57:57 +02:00
Alexander Larsson 0f05143227 builder: Handle the case where the source directory is in a symlink
It can happen, like in https://github.com/flatpak/flatpak/issues/353
that there are references in the source to the absolute source path.
We need to ensure that is visible in the build. We mostly do this,
but for technical reasons it didn't get the same pathname when
the source was inside a symlinked directory. We fix this with an
extra bind-mount to the symlinked directory name too.

This fixes https://github.com/flatpak/flatpak/issues/353
2016-10-18 11:06:43 +02:00
Alexander Larsson 4cb3f7fd79 builder: Support application inheritance
When initializing a build you can initialize the application directory
with the files from another directory, and optionally a set of its
extensions. This allows one to create a "base" application that
can be derived from in multiple forms. A typical example is an application
framework like Electron. The base electron app has all the dependencies
needed to write Electron app, and then your manifest can add the specific
files needed for your application.

An example snipped could look something like:

    "base": "org.base.App",
    "base-version": "stable",
    "base-extensions": ["org.base.app.Locale", "org.base.app.Debug" ],
2016-10-17 11:40:57 +02:00
Alexander Larsson a9c924928c builder: Add runtime-commit to resolved manifest
Apparently this must have been forgotten when sdk-commit was added.
2016-10-17 10:19:36 +02:00
Matt Watson b9521e719b builder: add allow missing runtimes options
The --allow-missing-runtimes options will allow flatpak builder to
not abort immediately if the sdk or runtime for the app being built
are missing.

This option will be useless when building anything in the modules
section of the app manifest. The calls to flatpak-build will fail
because of the missing sdk.

However, it may be useful when an application does not require
building anything inside the sandbox, and the application files
will be installed via other means.
2016-10-17 09:49:34 +02:00
Matt Watson e968b87f6a builder: add a build finish option
With the option you can resume an application build where it left
off when calling flatpak-buidler --build-only
2016-10-17 09:49:34 +02:00
Alexander Larsson c0e0fe31ef utils: Remove unused variable 2016-10-06 12:31:54 +02:00
Alexander Larsson ea17c27b37 builder: Add missing debug sprew when running an app 2016-10-06 12:31:54 +02:00
Niv Sardi 7f036570fd flatpak-builder: don't strip zip files
It is allowed to make a self-executable zip, it will then be an ELF file
on Linux. The problem is that the current stripping code somehow breaks
that file (i.e. ./file.zip doesn't work anymore after stripping).

Signed-off-by: Niv Sardi <xaiki@endlessm.com>
2016-10-06 12:05:30 +02:00
Alexander Larsson 91c9d474dd flatpak-builder: Add support for --show-deps 2016-09-20 15:58:43 +02:00
Tobias Mueller 72de257ec0 builder: check for name being defined in expand_modules
If this is not checked, flatpak-builder might crash like this:

Starting program: /var/tmp/flatpak/bin/flatpak-builder -v --force-clean
-v --ccache --repo=/tmp/fb.repo --gpg-sign=tobiasmue@gnome.org
/tmp/fpbuilder org.gnome.Sdk.ASan.json
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-
gnu/libthread_db.so.1".
[New Thread 0x7ffff139c700 (LWP 20407)]

Thread 1 "flatpak-builder" received signal SIGSEGV, Segmentation fault.
0x00007ffff697c770 in g_str_hash () from /lib/x86_64-linux-
gnu/libglib-2.0.so.0
(gdb) bt
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    expanded=expanded@entry=0x7fffffffdae0, names=names@entry=0x690a40,
    error=error@entry=0x7fffffffdc08) at builder/builder-manifest.c:175
    expanded=expanded@entry=0x696158, names=names@entry=0x690a40,
    error=error@entry=0x7fffffffdc08) at builder/builder-manifest.c:169
(self=self@entry=0x696050,
    context=context@entry=0x697970, error=error@entry=0x7fffffffdc08)
    at builder/builder-manifest.c:933
    at builder/builder-main.c:349
(gdb) up
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb)
    expanded=expanded@entry=0x7fffffffdae0, names=names@entry=0x690a40,
    error=error@entry=0x7fffffffdc08) at builder/builder-manifest.c:175
175	      if (g_hash_table_lookup (names, name) != NULL)
(gdb) l
170	        return FALSE;
171
172	      *expanded = g_list_concat (*expanded, submodules);
173
174	      name = builder_module_get_name (m);
175	      if (g_hash_table_lookup (names, name) != NULL)
176	        {
177	          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
178	                       "Duplicate modules named '%s'", name);
179	          return FALSE;
(gdb) p names
$1 = (GHashTable *) 0x690a40
(gdb) p name
$2 = 0x0
(gdb) p m
$3 = (BuilderModule *) 0x6978d0
(gdb) p *m
$4 = {parent = {g_type_instance = {g_class = 0x6959d0}, ref_count = 1,
    qdata = 0x0}, name = 0x0, subdir = 0x0, post_install = 0x0,
config_opts = 0x0, make_args = 0x0, make_install_args = 0x0, disabled
= 0,
rm_configure = 0, no_autogen = 0, no_parallel_make = 0,
no_python_timestamp_fix = 0, cmake = 0, builddir = 0, build_options =
0x0,
changes = 0x0, cleanup = 0x0, cleanup_platform = 0x0, sources = 0x0,
modules = 0x0}
(gdb)

This happens when a definition does not include a name, e.g.

            "modules": [
                {
                    "type": "archive",
                    "url": ""foo",
                    "sha256": "123"
                }
2016-09-14 15:52:14 +02:00
Mathieu Bridon d165475e17 builder: Don't fail when submodule path isn't a gitlink
This is what git itself does, so we just should do the same.

cda1bbd474/builtin/submodule--helper.c (L247-L248)
2016-09-13 00:24:42 +02:00
Mathieu Bridon 5430d4d40e builder: Properly check for gitlink trees
Instead of expecting the second word to be "commit", we should do like
git does and check for the file mode, which is 160000 for gitlink trees.

cda1bbd474/cache.h (L96)
2016-09-13 00:24:42 +02:00
Alexander Larsson fba645a999 Remove unused local variables reported by clang 2016-09-12 11:11:35 +02:00
Alexander Larsson 5ef43f6ee3 builder: Bump manifest version to trigger rebuild with new mtimes
To make sure we're not using old caches with the previous mtime
timestamps encoded we bump the manifest version to force a rebuild.
2016-09-09 09:44:54 +02:00
Alexander Larsson 6689c5c7f1 Switch back to mtime==0 for ostree checkouts
OSTree upstream changed back from mtime 1
2016-09-09 09:22:56 +02:00
Alexander Larsson 41443313ca session-helper: Move HostCommand to its own interface 2016-09-06 15:30:38 +02:00
Alexander Larsson e792686892 builder: Propagate build-args to shell sources
This way you can e.g. do network i/o in them.
Thats not a recommended way to do it though, as you work around
a lot of the feature in flatpak-builder like the caching and
verification.
2016-09-05 22:01:56 +02:00
Alexander Larsson c66e394266 builder: Use HostCommand calls if in sandbox 2016-09-05 21:41:14 +02:00
Alexander Larsson ddf05ef063 builder: Use flatpak_spawnv helper in a few more places
This is in preparation for it calling the new host-command.
2016-09-05 21:41:14 +02:00
Alexander Larsson 509bb33a2b Merge pull request #237 from mwleeds/add-trace-msg
utils: Print a debug message when launching subprocesses
2016-08-30 09:22:02 +02:00
Alexander Larsson 07fa8138a2 Merge pull request #194 from smcv/shell-injection
unrpm: prevent shell injection
2016-08-26 11:19:34 +02:00
Alexander Larsson 90d4f8d1b4 Don't fail if appstream-compose fails, instead warn.
This means we stop breaking existing builds e.g. when an older
appstream-compose in the runtime can't handle a new appdata field.
2016-08-25 11:34:10 +02:00
Mathieu Bridon 63cddfa80e builder: Handle submodules using with relative URLs
Some projects declare their Git submodules with URLs relative to their
own.

For example, gedit is hosted at git://git.gnome.org/gedit, and has its
libgd submodule declared with the ../libgd URL. We should treat the
latter as git://git.gnome.org/libgd.

This was in fact properly done in the past, but I broke it in commit
1171e1d202.

This fixes it again.
2016-08-24 21:06:00 +02:00
Alexander Larsson b0a7f8052b builder: Add --sandbox support
This disables build-args support, which is nice when building things
on e.g. a shared build-machine, where we don't want the build to
be able to break out of the sandbox (by specifying e.g. --share=network).
2016-08-22 17:23:32 +02:00
Alexander Larsson b03b21f416 Merge branch 'builder-git-submodules' of git://github.com/bochecha/flatpak into bochecha-builder-git-submodules 2016-08-22 16:08:39 +02:00
Alexander Larsson 6578d37984 Drop libgsystem dependency 2016-08-22 16:00:33 +02:00
Alexander Larsson 65f1cf993d Create and use flatpak_file_get_path_cached
This is simpler that the one in libgs, as well as lockless. Also, it
removes one more use of libgs.
2016-08-22 10:22:42 +02:00
Alexander Larsson 9c907c992d Replace gs_shutil_rm_rf with small helper wrapper over libglnx 2016-08-22 10:06:08 +02:00
Alexander Larsson e0bd22bfe8 Add flatpak_mkdir_p helper and use it
This replaces all current callers of gs_file_ensure_directory with
equivalent code.

Actually, two instances were calling gs_file_ensure_directory with
FALSE, i.e. error out on EEXIST, but those cases seem fine with the
do-nothing-if-exists semantics.
2016-08-22 09:29:24 +02:00
Mathieu Bridon 1171e1d202 builder: Redo git submodules handling
flatpak-builder was mixing the path and the name of a submodule, which
would lead to download failures when they were different.

Fixes #216
2016-08-20 12:44:27 +02:00
Alexander Larsson fb3bfae85b builder: Add --stop-at=module
Stop building at a specified module from the json file.
This is useful during development. For instance, you can do --stop-at=main-app
to build all the dependencies into the appdir, then you can do a build of an
already checked out git repo (possibly with changes).
2016-08-19 11:25:23 +02:00
Alexander Larsson f622b014a7 builder: Handle symbolic icons in rename-icons 2016-08-19 11:05:18 +02:00
Alexander Larsson 0d115fb2e7 builder: Save a copy of the base manifest 2016-08-17 14:24:32 +02:00
Alexander Larsson 7431fff588 Fix up pyo stale file handling
We were not doing what the comments said we should, and we also
want to change what happens in the case of an old py file from
a previous layer (such as a base layer in a runtime) has a non-rewritten
.pyc file. In that case we want to assume its correct and fix it up.
2016-08-11 07:54:48 +02:00
Alexander Larsson 348b7f9ab4 builder: Add some printouts if we remove stale .pyc files
This makes it easier to figure out why it disappeared
2016-08-11 07:54:25 +02:00
Alexander Larsson 006d9a1927 Correctly handle .pyc mtimes for .py files changing multiple times
If a .py file changes multiple times we can end up in a situation
where there is an .py file with corresponding .pyc file that we
rewrote, so both are now mtime==1. Then a new version of the .py file
is added, but the corresponding .pyc file is not updated. This means
that the .pyc file is stale, and python would not normally use it.
However, we will later change the mtime on the .py file to 1, causing
the old .pyo file to look up-to-date even though its stale.

We fix this by detecting the case where the is a new mtime on a .py file
where the .pyc file doesn't match, and remove the stale .pyc file.
2016-08-10 16:24:11 +02:00
Matthew Leeds 392c597c5f utils: Print a debug message when launching subprocesses
This commit makes flatpak print a debug message (which only appears to
the user if the -v option is used) whenever a subprocess is launched.
This should make debugging easier, both for flatpak users and
developers.
2016-08-05 14:15:19 -04:00
Matthew Leeds 25d88477c5 builder: Allow git sources to be specified as paths
Currently to use a local copy of a git repo you have to specify the url
as "file:///path/to/repo". This commit allows you to specify a path directly
as "/path/to/repo", which is faster and more space-efficient because
git-clone will hardlink the objects rather than copying them.
2016-07-29 16:01:30 -04:00
Matthias Clasen 75218c4a65 Fix license headers
We were referring to the nonexisting "version 2" of the
Lesser GPL. It should be "version 2.1".
2016-07-29 14:27:49 -04:00
Matthias Clasen 3a281d0782 Add locations to some error messages
When a file is not found, mention where we looked for it.
This provides useful context for understanding the error.
2016-07-29 14:16:31 -04:00
Matthias Clasen 91b7b0a419 Mention app dir in output
This can help making sense out of error messages when something
goes wrong.
2016-07-29 14:15:46 -04:00
Matthew Leeds b051571de8 builder: Fix a few memory leaks
These changes fix some memory leaks that valgrind pointed out.
2016-07-28 16:03:42 -04:00
Matthew Leeds fcd6da2fa3 builder: Print a message when running flatpak build-finish
This commit makes flatpak-builder print the flatpak build-finish command
it constructs before executing it in a subprocess, which matches the
behavior for flatpak build-init and flatpak build.
2016-07-18 14:29:41 -04:00
Simon McVittie 5b8fdb4998 unrpm: prevent shell injection
Substituting into a shell command-line without escaping is a bad idea.
If the argument is attacker-controlled, it's a security vulnerability;
if the argument is legitimate-user-controlled (as I think it is here)
it's merely wrong.

We could escape the filename with g_shell_quote(), but it's more
straightforward to take advantage of the shell's argument processing.
The first positional parameter (if given) is $0, and the rest are $@.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-07-18 14:32:14 +01:00
Christophe Fergeau 2b609c6624 Add RPM archive support 2016-07-15 11:13:28 +02:00
Christophe Fergeau 543d81c2fe Factor some zip uncompression code in a helper func 2016-07-15 11:13:28 +02:00
Alexander Larsson b5204c908d builder: Clear mtime to 1, not 0, to match what new ostree does 2016-07-01 14:25:22 +02:00
Alexander Larsson eaeb132a5a builder: Set the new extension properties
Set autodelete=true on locale and debug extensions.
Set no-autodownload=true on debug extensions.
Thats what will happen anyway, but its nice to be explicit.

Also, remove subdirectories=true on the locale extensions, as
we're not using that anymore.
2016-06-30 16:55:32 +02:00
Alexander Larsson 9558d7d6ae builder: Strip "." from locale names too
For instance, "C.utf8" => "C" or "en.utf8" => "en".
Mostly this was already handled for e.g. "en_US.utf8" though...
2016-06-30 11:47:45 +02:00
Alexander Larsson de8d8a36c2 Merge pull request #158 from hadess/wip/use-git-patch
Add "use-git" option for patch source types
2016-06-28 15:24:49 +02:00
Alexander Larsson b00dbed3bd builder: Report errors to stderr, not stdout 2016-06-28 15:08:09 +02:00
Bastien Nocera c646f386eb builder: Add "use-git" option for patch source type
Closes #6
2016-06-28 14:24:16 +02:00
Matthias Clasen d3629b8e72 builder: Add support for a var runtime
flatpak build-init as a --var option - support this as a
"var" key in the json.
2016-06-23 10:01:40 +02:00
Alexander Larsson bd485fbc01 builder: Report error details when failing to checkout cache. 2016-06-09 17:45:44 +02:00
Alexander Larsson 5eb671aac4 builder: Warn for duplicate module names 2016-06-09 12:43:31 +02:00
Matthias Clasen 99e4f83e33 Allow inclusions in the module list
When we see a string in the modules array, parse it as a json
file and use the resulting BuilderModule object.
2016-06-09 01:01:37 -04:00
Matthias Clasen 5225e7b1d0 manifest: Prepare expand_modules to report errors
Move the expand_modules call from the modules setter to
builder_manifest_start, where we have a chance to report
errors.
2016-06-09 00:29:02 -04:00
Matthias Clasen e25e379a2a manifest: expand module list
Linearize the tree of modules and submodules when the modules
are set on the manifest, while filtering out disabled modules
at the same time.

Skip source-less modules when building; this makes it possible
to have modules that only contain submodules.

With this approach, we use the tree structure of modules for
serializing and deserializing to and from json, while using
a linear list of modules for building.
2016-06-08 23:56:38 -04:00
Matthias Clasen 2757c63fea Add a modules property to BuilderModule
This will let us load modules recursively.
2016-06-08 23:56:38 -04:00
Matthias Clasen 9a8eef8597 manifest: Skip source-less modules when building
Building such modules won't produce anything. And future
commits will make source-less modules useful to support.
2016-06-08 23:56:38 -04:00
Matthias Clasen 914b841481 module: Be a bit more robust
When we call builder_module_cleanup_collect on a module that
has no changes, we shouldn't crash.
2016-06-08 23:55:57 -04:00
Alexander Larsson bd66da0dad builder: Add support for patching mtime in python bytecode headers
This makes them work at runtime (as the mtime will then be 0) and
makes builds more repeatable.
2016-06-08 13:28:27 +02:00
Alexander Larsson 959fec1cd3 Zero out mtime when commiting
This means we get the same behaviour as if we checked out of
the cache. Also, its the same as the final behaviour will be
when running in flatpak.
2016-06-08 13:14:09 +02:00
Alexander Larsson 4990dd5f86 builder: Manually zero mtime of cache checkout
This works around an ostree bug where this didn't happen in the
mismatched mode (regular checkout, user repo) we're using.
2016-06-08 11:11:24 +02:00
Matthias Clasen 6d1837ce4b Make an error message more helpful
When we see somebody trying to use a command with spaces, we
should be helpful and point out how to do what they want to do.
2016-06-03 09:22:21 -04:00
Alexander Larsson d950ed338f Merge pull request #65 from matthiasclasen/builder-messages
Add another status message to flatpak-builder
2016-06-02 09:12:08 +02:00
Alexander Larsson 4805d49bdf Merge pull request #37 from matthiasclasen/command-check
flatpak-builder: Ensure after build that the binary listed in "command" is installed
2016-06-02 08:58:30 +02:00
matthiasclasen 5e2be3cb10 builder: Some consistency fixes for output (#64)
* builder: Some consistency fixes for output

Capitalize all error messages.
2016-06-02 08:50:58 +02:00
Matthias Clasen 7794a70f50 builder: Check that command exists after build
This keeps us from creating a non-working flatpak.
2016-06-01 23:31:57 -04:00
Matthias Clasen c7594e5515 Add another status message to flatpak-builder
Add a message for the 'rewriting the desktop file' step.
This helps in providing context for error messages when something
goes wrong.
2016-06-01 16:21:25 -04:00
Alexander Larsson c7c9505e90 Always initialize autofree variable 2016-05-27 09:19:45 +02:00
Alexander Larsson 8362d9cafe Merge pull request #36 from matthiasclasen/module-errors
flatpak-builder: Print name of failed module on error
2016-05-27 09:02:44 +02:00
Alexander Larsson f9cbcc3996 Merge pull request #49 from jsoref/spelling
spelling fixes
2016-05-27 09:02:14 +02:00
Josh Soref 37409c4095 spelling: sections 2016-05-27 06:46:23 +00:00
Alexander Larsson 6b65972434 Merge pull request #47 from matthiasclasen/build-error
builder: Avoid a confusing error
2016-05-27 08:45:21 +02:00
Matthias Clasen 5f928b30ac builder: Prefix module errors
Sprinkle g_prefix_error calls in builder-module.c, to make
sure that module-specific errors get a "module foo:" prefix.
This is not quite perfect, since callers tend to impose their
own prefix as well, but at least it clearly identifies the
module in which the error ocurred.
2016-05-27 00:25:28 -04:00
Matthias Clasen 6d1d9724c5 builder: Warn about bad module names
Putting spaces or slashes in module names is a recipe for
cryptic error from one of the many constructed flatpak
commandlines. Better warn early on, as soon as we see such
a name.
2016-05-27 00:05:55 -04:00
Matthias Clasen c89a610a91 builder: Avoid a confusing error
When the sdk is not specified in the manifest, we get a confusing
error from running flatpak info with an invalid commandline.
Avoid that by checking for the the sdk string beforehand.
2016-05-26 23:35:41 -04:00
Alexander Larsson e9e92b79fe builder: Support argument to the command with --run
For instance, this lets you do:

  flatpak-builder app foo.json ls -l

Without flatpak-builder complaining about not knowing "-l".
2016-05-26 12:44:51 +02:00
Alexander Larsson 33c0d49212 builder: Support permission ops with --run 2016-05-26 12:24:43 +02:00
Alexander Larsson f6b4e8ead6 builder: Make the options and help output for --run a bit nicer
We now pre-process for the --run argument in order to only show
related arguments.
2016-05-26 11:20:23 +02:00
Stephan Bergmann 3b6b0da108 exec* returns -1 on error
...so use the == -1 idiom as already used in common/flatpak-run.c
(another fix would be to drop the if completely, as exec* doesn't
return on success)
2016-05-24 17:44:33 +02:00
Simon McVittie a4641280a7 Fix various spelling mistakes
Mostly detected by Debian's Lintian tool.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-05-17 11:43:32 +01:00
Alexander Larsson 9d6bc99649 builder: Untar with --no-same-owner
Without this if you run as root (which is generally a poor idea) it will
extract the sources with the user/group specified on the archive, which
is never what you want when building code.
2016-05-12 19:35:32 +02:00
Alexander Larsson 28c1c65d8f Builder: Support disabled=true to not build a module
This is a simple way to "comment out" a module.
2016-05-09 17:24:42 +02:00
Alexander Larsson 8abbc0186e Rename everything but the on-disk location to flatpak 2016-05-09 11:11:55 +02:00
Alexander Larsson ba37b22d78 Rename library to libflatpak 2016-05-09 09:46:26 +02:00
Alexander Larsson c24528d369 Rename source files to flatpak 2016-05-09 09:00:20 +02:00
Alexander Larsson 6a613d1fab Rename all non-autogenerated symbols to flatpak 2016-05-09 09:00:20 +02:00
Alexander Larsson 1ffdf27d92 uncruftify: Initial run, all non-problematic changes 2016-05-06 16:03:27 +02:00
Alexander Larsson 098e3e426d build: Look for files in the same dir as the manifest, not in the CWD
This makes more sense, the CWD is not necessary a useful place.
2016-05-04 08:47:38 +02:00
Tristan Van Berkom 51e387159b build-export: Add --arch option
This patch adds the --arch option to the build-export builtin command.

Previously build-export derives this from the metadata and then falls back
to xdg_app_get_arch(), except that this does not work when the metadata does
not specify an arch (such as with extensions like .Debug or .Locale).

https://bugs.freedesktop.org/show_bug.cgi?id=95226
2016-05-03 09:05:56 +02:00
Tristan Van Berkom aa69c1afef xdg-app-builder: Add --arch command line option
This is only useful for building for architectures which are
compatible with the build host, e.g. building i686 binaries on
an x86_64 build host.
2016-05-02 08:46:52 +02:00
Tristan Van Berkom bc7bfeef6f BuilderSourceFile: Delete destination file
Sometimes you want to replace an existing file, like a config.sub,
and sometimes that existing config.sub does not have the writable
bits set. Just delete the file if we intend to replace it anyway.
2016-04-27 14:15:05 +02:00
Alexander Larsson 9171c94662 builder: Fix unused return value warnings
This just adds a (void) cast to avoid the warnings.
2016-04-21 09:49:24 +02:00
Alexander Larsson af03d2f5b4 Remove unused local variables reported by clang 2016-04-21 09:48:56 +02:00
Joaquim Rocha f112d117da builder: Do not repeat the separate locales path
These changes replace all occurrences of 'share/runtime/locale' with a
define so it will avoid possible mistakes when having to be replaced
one day.
2016-04-20 12:32:02 +02:00
Joaquim Rocha 39279c8b8b builder: Skip separate locales exportation if directory doesn't exist
This will avoid errors when separate_locales is set to true but the
locales directory does not exist. This is the case of many apps that do
not support separate locales but haven't specifically set
separate_locales to false in the configuration.
2016-04-20 12:32:02 +02:00
Alexander Larsson 265ba5e528 Merge pull request #128 from matthiasclasen/run-fixes
Some fixes for xdg-app-builder --run
2016-04-15 11:50:34 +02:00
Tristan Van Berkom 401c7b2dea BuilderModule: Use builder_options_get_config_opts()
The configure arguments are now a combination of the
default config-opts plus the accumulative sum of the config-opts
specified in the build-options that are active for a given build
context.

https://bugs.freedesktop.org/show_bug.cgi?id=94940
2016-04-15 10:25:55 +02:00
Tristan Van Berkom 17ec9ef3b0 BuilderOptions: Added 'config-opts' option.
Allows conditional configure arguments.

https://bugs.freedesktop.org/show_bug.cgi?id=94940
2016-04-15 10:25:55 +02:00
Matthias Clasen 9426438c0b Fix --run
I have a manifest which has --command=terminix in the finish-args,
and xdg-app build doesn't like that option, so filter it out.
2016-04-14 19:11:48 -04:00
Alexander Larsson 416ad53878 Fix typo for no-debuginfo properly 2016-04-14 19:28:08 +02:00
Matthias Clasen 838d109e58 builder: Add an option to erase app dir
Having to run rm -rf yourself before every new build attempt
gets old. Lets add an option to have xdg-app-builder do it
for us.
2016-04-13 23:06:59 -04:00
Alexander Larsson d52cb3b378 builder: better error messages if failing to find desktop file 2016-04-11 11:20:45 +02:00
Alexander Larsson 545a699698 builder: Only create one locale extension
Given that each app can have 100 locates, ostree just doesn't scale
to having a branch per app/locale combo. For 100 apps and 100 locales
that would be 10000 branches.

Also, things like xdg-app remote-list doesn't properly handle that
either.

We need to handle this by e.g. supporting subsetting the pull of
the locale extension.
2016-04-07 13:02:36 +02:00
Alexander Larsson 7e6b18eddc builder: Actually respect the defined branch 2016-03-23 16:42:40 +01:00
Alexander Larsson d32b13a695 builder: Checksum metadata-platform contents for cache too 2016-03-23 14:54:47 +01:00
Alexander Larsson d6f9e03a61 builder: Use the right field for the platform cache checksum
It was looking at metadata, instead of metadata_platform
2016-03-23 14:49:59 +01:00
Alexander Larsson b3f9da3648 builder: Build single every-locale extension
This is useful for testing, as well as makes building derived runtimes
easier.
2016-03-21 16:37:51 +01:00
Alexander Larsson 08959b4373 xdg-app-builder: Don't export if --build-only specified 2016-03-17 20:55:55 +01:00
Alexander Larsson 728e7a89e1 xdg-app-buildeR: Remove unnecessary spew 2016-03-14 11:57:06 +01:00
Alexander Larsson 6c5e1a8a92 Fix some compiler warning (unused vars) 2016-02-25 16:09:49 +01:00
Alexander Larsson 467e8bf4db builder: Add sources referenced from debuginfo into Debug runtime 2016-02-23 14:13:36 +01:00
Alexander Larsson 90aaed7f7b builder: Build runtimes in /run/build-runtime
This way we the runtime build dir doesn't conflict with the app dir.
Which is good if we want debuginfo with sources for both.
2016-02-23 14:12:20 +01:00
Alexander Larsson 22d997e712 builder: Add builder_get_debuginfo_file_references 2016-02-23 12:44:01 +01:00
Alexander Larsson f98f565df0 Add support for separated locales when creating platforms 2016-02-18 21:49:13 +01:00
Alexander Larsson f1d401e6cd Migrate locales after importing parent runtime 2016-02-18 21:48:33 +01:00
Alexander Larsson b44bbc13c3 Move migrate_locales to builder-utils.c 2016-02-18 21:47:29 +01:00
Alexander Larsson d5d47aa458 builder: Support separating out locale data 2016-02-18 19:22:34 +01:00
Alexander Larsson bb4d67b086 builder: Support tags 2016-02-17 14:54:16 +01:00
Alexander Larsson 71259fa711 builder: Support local archives with path property 2016-02-17 14:50:01 +01:00
Alexander Larsson 6c5feb4e05 builder: Add support for --run to start a command in the build dir 2016-02-17 10:26:35 +01:00
Alexander Larsson c07b1807d1 builder: Move CFLAGS/CXXFLAGS handling into BuilderOptions 2016-02-17 10:26:35 +01:00
Alexander Larsson e233705379 builder: Add build_context_get_build_dir() 2016-02-17 10:26:32 +01:00
Alexander Larsson 393163200d builder: Always create unversioned symlinks while building modules
This way if things go wrong you can always find the latest build
2016-02-17 08:43:29 +01:00
Alexander Larsson faecde5da5 builder: Report errors if eu_strip fails
This was ignoring errors and causing "set-on-top-of-existing-GError"
messages.
2016-02-16 14:45:23 +01:00
Alexander Larsson ea176cd63a builder: Put all builds in a .xdg-app-builder/build subdir
I.e. instead of .xdg-app-builder/build-foo it will be
.xdg-app-builder/build/foo. This makes it easier to separate these
out, and it allows you to symlink this directory to /run/build to pick
up all sources when you use --keep-build-dirs.
2016-02-10 10:15:25 +01:00
Alexander Larsson 9c6d6242a9 builder: Avoid reusing set GError
my_error was used twice, without clearing inbetween, which can
cause issues.
2016-02-08 16:21:28 +01:00
Alexander Larsson 32e9502675 Fix some g_propagate_error typos 2016-02-08 16:16:38 +01:00
Alexander Larsson 1cc94f4f04 builder: Use predictable names for build dirs
Instead of random hex, we use a pure counter
2016-02-08 11:30:48 +01:00
Alexander Larsson 43ac6421f9 builder: Store exact sdk commit id in the build cache and manifest
This means we rebuild everything if the sdk changes, and you can also
see what version an app was built against.
2016-02-03 10:57:50 +01:00
Alexander Larsson 9f2769e0ce builder: Use non-parallel-make option instead of looking at .NONPARALLEL 2016-02-01 21:40:22 +01:00
Alexander Larsson 913eccd30f builder: Add shell source
This lets you run shell commands to modify the source
2016-02-01 21:26:20 +01:00
Alexander Larsson 3a70dcf430 builder: Style fixes 2016-01-28 21:52:45 +01:00
Michael Spencer ba5b5bc6b8 builder: Skip checking out disabled submodules 2016-01-28 12:46:40 -06:00
Alexander Larsson 225c359128 Fix include order to build with older libsoup versions 2016-01-28 14:35:46 +01:00
Alexander Larsson 20d16625a8 builder: support using appstream-compose to create appstream files 2016-01-22 15:33:03 +01:00
Alexander Larsson e8adcc0eb5 builder: Add spew when commiting to cache 2016-01-22 14:08:43 +01:00
Alexander Larsson 5c89d5a4e9 builder: Add some spew before build-init 2016-01-22 12:30:00 +01:00
Alexander Larsson 472405ff7f builder: Add platform-extensions 2016-01-20 14:41:09 +01:00
Alexander Larsson 6d2aa7b29e builder: Support sdk-extensions 2016-01-20 14:11:29 +01:00
Alexander Larsson 622adf88d0 builder: Put debuginfo in the right place for runtimes 2016-01-20 14:00:49 +01:00
Alexander Larsson 6189fd3f7a build-finish: Fix exports
This was reading an unintialized variable
2016-01-19 16:53:11 +01:00
Alexander Larsson 1a4f257cbd builder: Remove leftover debug spew 2016-01-19 13:08:15 +01:00
Alexander Larsson 2f3e790651 builder: Fix error with va_start use 2016-01-19 12:38:16 +01:00
Alexander Larsson 071561637a Remove unused variables 2016-01-19 12:37:51 +01:00
Alexander Larsson 8b3cc77955 builder: Handle modules with invalid refname characters in the cache 2016-01-19 11:57:37 +01:00
Alexander Larsson 496cbac3db cache: Don't fail to create cache if parent dir is not created 2016-01-18 17:17:04 +01:00
Alexander Larsson 87ad85116e builder: Fix random crash due to uninitialized memory 2016-01-18 16:14:42 +01:00
Alexander Larsson e91a4c79e0 Builder: Support commiting a platform 2016-01-18 15:22:56 +01:00
Alexander Larsson 3341fb08ad builder: Allow building runtime sdks (based on existing sdk)
This includes a few different changes:
 * Add build-runtime boolean property
 * Rename "app-id" property to "id"
 * Add metadata property to use a custom base metadata file
 * Default to writable-sdk to TRUE for runtimes
 * Default prefix to /usr for runtimes
 * Put manifest in usr for runtimes
 * Pick up debuginfo from usr for runtimes
 * Make build-finish work on runtimes, but only export appdata
2016-01-18 11:43:02 +01:00
Alexander Larsson 701d800059 builder: Correctly handling non-existing app dir when applying cache 2016-01-18 11:36:24 +01:00
Alexander Larsson f2853a460b cache: Remove target directory before checking out cache
This will be empty anyway, and if its there the checkout fails.
2016-01-17 21:23:03 +01:00
Sam Thursfield d5c176f440 builder: Don't delete the APPDIR directory
A new user might think that APPDIR is the location of the app to be
built, and run something like `xdg-app-builder . ./manifest`. This
could silently the user's entire project that they are trying to
package, which is not acceptable at all! Even if you think it is their
fault for not reading the manual first!

This commit means that APPDIR is no longer deleted. Instead,
xdg-app-builder checks whether it is empty and, if it is not, it asks
the user to delete the contents and then rerun it.

This means you now have to do `rm -Rf APPDIR; xdg-app-builder APPDIR
MANIFEST` when developing your manifest, but I think that's better than
having a build tool that can optionally delete your whole project.
2016-01-17 18:16:05 +00:00
Alexander Larsson 93e8d8bd78 builder: Add some spew when downloading files 2016-01-14 16:45:44 +01:00
Alexander Larsson f3bf30334c builder: Also apply cleanup to changes in usr 2016-01-14 11:16:17 +01:00
Alexander Larsson f8894af8d7 builder: Change the way the cache is indexed
Instead of a single ref we use one ref per stage (init, build module X,
cleanup, finish). This means we don't have to iterate in the cache
lookup, and it also means we get clean refs for each stage so one
can easily inspect the differences between the stages.
2016-01-13 09:50:15 +01:00
Alexander Larsson d43e797b4b builder: Add support for rename-appdata-file option 2016-01-12 16:30:20 +01:00
Alexander Larsson f56d6a7290 builder: Fix up cleanup matching 2016-01-12 16:06:53 +01:00
Alexander Larsson 55e934ee76 builder: Fix handling of builddir 2016-01-12 14:25:41 +01:00
Alexander Larsson 4c47951cbd builder: Add some more spew when exporting 2016-01-12 12:36:07 +01:00
Alexander Larsson a6eab3e732 builder: Don't break if ccache not enabled. 2016-01-12 12:32:44 +01:00
Alexander Larsson 689c36aa8f builder: Pass --body, --subject and --gpg-sign to build-export 2016-01-12 12:25:45 +01:00
Alexander Larsson f95cd2d029 builder: Add option to enable ccache use in build 2016-01-12 12:09:09 +01:00
Alexander Larsson 59c8c49bdd builder: Run builds in /run/build/$modulename
This creates repeatable builds for anything that leaves the build
dir in the resulting files, such as debug info.
2016-01-12 11:05:37 +01:00
Alexander Larsson 13d07d6a6f builder: Add support for exporting with --repo=foo 2016-01-11 15:35:17 +01:00
Alexander Larsson 69d489bbef builder: Create metadata.debuginfo if debug info exists 2016-01-11 14:37:30 +01:00
Alexander Larsson b4fbb84f0a common: Move path_match_prefix to common 2016-01-11 13:56:07 +01:00
Alexander Larsson d3e1ffb4f7 builder: Match debuginfo files against regular cleanup patterns
I.e. if /lib/foo is cleaned, also clean /lib/debug/lib/foo.debug
2016-01-11 11:41:50 +01:00
Alexander Larsson 1b2ed4fe09 builder: Pass down global cleanups via BuildContext 2016-01-11 11:40:46 +01:00
Alexander Larsson 5896b5ae08 builder: Pass down keep-build-dirs via BuildContext 2016-01-11 11:40:46 +01:00
Alexander Larsson 825611a758 builder: Break out helpers for path matching 2016-01-11 11:40:46 +01:00
Alexander Larsson 98a7d731ad builder: Add support for separating out debuginfo 2016-01-11 11:40:46 +01:00
Alexander Larsson 62b4ffaa72 builder: Use libelf to detect elf files
This additionally looks for already stripped files
2016-01-11 11:40:46 +01:00
Alexander Larsson 8be0031355 builder: Print all files removed by cleanup 2016-01-11 11:40:46 +01:00