Commit Graph

65 Commits (df6a5450c16656cdf4c4b72e7c47bfaf5ed53b1d)

Author SHA1 Message Date
Alexander Larsson 8fd165074c bundle: Properly handle byteswapping 2016-10-06 12:31:54 +02:00
Alexander Larsson 63638583b0 Change app-id rules again, now only allow dashes in last element
It turns out that live apps were exporting files with dashes
other than "-symbolic". For instance "org.libreoffice.LibreOffice" was
exporting "org.libreoffice.LibreOffice-writer.desktop".

Allowing any dashes in the last segment like this is really no diffent
than allowing org.libreoffice.LibreOffice.writer.desktop which we
already do. Any conflicts here are under the control of the owner
of the org.libreoffice prefix.

However, allowing dashes in the earlier segments is more problematic.
For instance, any file exported by "org.my-foo.App" could conflict with
an app called "org.my" if this was allowed.

So, as a middle ground, we're allowing dashes in the last segment of
the App id only.
2016-10-06 11:36:28 +02:00
Alexander Larsson af76206ba5 common: Add flatpak_variant_builder_init_from_variant 2016-09-27 12:39:27 +02:00
Alexander Larsson 5c075525a8 Allow application ids containing "-"
For a long time we have been disallowing "-" in application names,
which is different than what dbus allows for bus names. Also "-" used
to be not allowed by GApplication in glib. This is in part because
dbus object paths do *not* allow dashes, so you can't legally map
from e.g. a valid name like "org.foo-bar.gazonk" to a valid path
like "/org/foo-bar/gazonk".

This is a problem because many existing apps already use "-" in the
name, either as the last part (org.gnome.font-viewer) or because
the dns name it refers to has a dash.

This was recently discussed in the dbus community, and the result
is to recommend that "-" in the bus names be converted to "_" in object
paths.

This change makes it also allowed to have "-" in a flatpak app id.

For flatpak specifically we were relying on "-" not being allowed to
handle the case of exporting "org.foo.App-symbolic.png". If "-" is
allowed this name can conflict between apps called "org.foo.App-symbolic"
and "org.foo.App".

To handle this we add two special cases:
 * App ids can't end with "-symbolic".
 * Apps are allowed to export files with $appid-symbolic as prefix.
2016-09-16 16:44:05 +02:00
Sebastian Rasmussen b21f4bf542 Prefer g_strerror() to strerror()
It handles encodins better, is thread-safe and more portable.
2016-09-15 01:22:54 +08:00
Alexander Larsson 1d1189aeab Fix crash if completing with NULL shell_cur
This happens if you do e.g.
  flatpak complete "flatpak install " 11

Reported by aki237
2016-09-14 14:31:33 +02:00
Matthias Clasen 06c7aca9f9 Make flatpak_is_valid_branch set a GError
Return detailed information about the problem with the branch in
the GError. Update all callers.
2016-09-13 13:28:42 -04:00
Matthias Clasen fe91657a44 Update the docs
Update the doc comment for flatpak_is_valid_name to reflect
current reality.
2016-09-13 13:15:41 -04:00
Matthias Clasen 687cae783e Always set an error when failing name validation
This was an oversight in the previous patch to improve
name validation error messages.
2016-09-13 13:13:43 -04:00
Matthias Clasen b2b281e485 Make flatpak_is_valid_name set a GError
Return detailed information about the problem with the name in
the GError. Update all callers.
2016-09-12 23:25:54 -04:00
Alexander Larsson fba645a999 Remove unused local variables reported by clang 2016-09-12 11:11:35 +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 e16ca25a67 utils: Change flatpak_invocation_lookup_app_id to lookup_app_info
This lets you get the entire app info rather than just the id.
For host processes you'll get an empty info with just an empty
name.
2016-09-08 12:37:32 +02:00
Alexander Larsson 4408468e78 common: Remove leftover spew 2016-09-08 12:36:11 +02:00
Alexander Larsson 0d22bad5e6 document-portal: Detect remote peer app id using flatpak-info
This drops the requirement on unprivileged cgroups, and thus the
dependency on systemd --user.
2016-09-08 11:24:10 +02:00
Alexander Larsson aafc0f3b66 run/metadata: Add support for --allow=devel
This enables support for ptrace and perf for the app, similar
to what run -d manually gave you before. This is nice to be
able to package an app like gnome-software.
2016-09-05 21:41:14 +02:00
Alexander Larsson ff6839a291 utils: Add flatpak_is_in_sandbox() helper 2016-09-05 11:54:12 +02:00
Alexander Larsson e50f7a363f build-update-repo: Reuse cache info from old summary
This makes rebuilding partial changes much faster.
2016-09-02 11:13:11 +02:00
Alexander Larsson ba377b29e6 common: Add utility function to load summary file from local repo 2016-09-02 11:10:29 +02:00
Dan Nicholson d2d9804187 utils: Only collect cache data once per revision
If there are multiple refs pointing to the same revision, then
collecting the size and metadata info for each of them is wasteful.
Maintain a hash table of the data so that it's only collected once per
revision.

This slightly widens an existing race where a ref could be updated
before the summary file is regenerated. In that case, the data in the
xa.cache variant would correspond to the wrong revision. I don't believe
this can be fixed unless there's locking at the ostree level.
2016-09-01 10:11:13 -07:00
Dan Nicholson e86ae01ba0 utils: Only update summary info for flatpak refs
If there are non-flatpak refs in the ostree repo, there's no use in
collecting size or metadata information for them. Instead, only operate
on refs in the appstream, app or runtime prefixes.
2016-09-01 10:11:13 -07:00
Dan Nicholson d304c4eca1 utils: Free list of refs in flatpak_repo_update
Although the data is owned by the hash table, the list storage needs to
be freed with g_list_free(). Use g_autoptr for that.
2016-09-01 10:11:07 -07: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 becb1b88bd Fix crash in "flatpak update" with no args
This crashed, trying to split NULL into parts..
2016-08-24 16:42:36 +02:00
Alexander Larsson 54c5f9a59e Allow specifying partial refs as name in commands
The commands: install, update, uninstall, info, make-current and run
now supports specifying a partial ref for the name. This is a different
way of specifying optional arch and branch arguments.

For instance org.app.App//master is the same as "org.app.App master" or
"--branch=master org.app.App".

This is useful if you're cutting and pasting from e.g. the list -d output.
2016-08-24 09:18:00 +02:00
Alexander Larsson cfba1431b4 Spew less when updating appstream branch
Missing icons are now only visible in verbose logs, and we don't
print warnings about missing appdata for runtimes (such as locale
and debug extensions).
2016-08-23 10:33:22 +02:00
Alexander Larsson 6578d37984 Drop libgsystem dependency 2016-08-22 16:00:33 +02:00
Alexander Larsson 467932e418 Drop use of gs_file_enumerator_iterate 2016-08-22 15:56:35 +02:00
Alexander Larsson 540a3a49df Drop use of gs_file_open_in_tmpdir_at
We import a copy of this
2016-08-22 15:44:52 +02:00
Alexander Larsson c14fbc3efb Drop calls to gs_file_rename
We make an equivalent helper inline.
2016-08-22 15:28:17 +02:00
Alexander Larsson fcffefee26 Replace openat() calls from libgsystem 2016-08-22 14:12:31 +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
Alexander Larsson 5ee07d79c8 common: Add flatpak_complete_ref()
This is for commandline completion of ref:s
2016-08-19 16:51:24 +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
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 8732c5a8fb Translate errors
These show up in the UI and often refer to (translated) parts of
the UI.
2016-07-23 14:37:02 -04:00
Cosimo Cecchi 3d2a42ddf3 utils: fix double loop when extracting icons for appstream
When trying to extract icons to regenerate the appstream, we are looping
over the entire file every time, instead of only trying to copy icons
for the application ID we're looking at the moment.
This is most likely benign, but it causes a lot of "Error copying icon:
No such file or directory:" spew when calling flatpak build-update-repo.
2016-07-21 13:17:36 -07: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 81e61391be utils: Add flatpak_summary_match_subrefs
This is useful to do extension matching in summaries
2016-06-30 11:42:39 +02:00
Alexander Larsson 5897ddd7ef utils: Add flatpak_get_current_locale_subpaths() 2016-06-30 11:41:12 +02:00
Alexander Larsson 0be93ed1dc extensions: Always create a tmpfs for subdirectory extensions.
This makes sure we can actually create a directory as needed, and not
having to have every subdirectory pre-created in the runtime.
2016-06-29 15:56:28 +02:00
Alexander Larsson 853227a3d6 extensions: Minor cleanup
We now store the path to the extension files in the FlatpakExtension
returned from list_extensions instead of having each called look
them up.
2016-06-29 12:20:16 +02:00
Bastien Nocera 2facf8bbf0 utils: Add flatpak_spawnv() helper
This will allow callers to easily add new parameters without tearing
their hair out with varargs.
2016-06-28 14:24:16 +02:00
Alexander Larsson 44b6c31efc fix warning 2016-06-28 11:41:35 +02:00
Alexander Larsson bde74d25d4 common: Add flatpak_get_arches() helper 2016-06-23 11:05:42 +02:00
Alexander Larsson cc08083543 common: Add flatpak_zero_mtime helper
This recursively sets the mtime to 0.
2016-06-08 11:11:01 +02:00
Sam Spilsbury 7bd6c9b277 completion: Don't show one-time switches already in use 2016-06-02 21:38:16 +08:00
Sam Spilsbury 082821288e completion: Store original argv and argc
We deep-free the original argv here, since it isn't modified.
2016-06-02 21:38:16 +08:00