Commit Graph

217 Commits (7018717ce2abe7503ce6ba3f8b4e219a915b95fb)

Author SHA1 Message Date
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