Commit Graph

45 Commits (d667f4e81c5b673b7f673047359f183f426dc996)

Author SHA1 Message Date
Alexander Larsson 07cd13e757 Add copyright headers 2015-03-23 12:17:58 +01:00
Alexander Larsson 8f427c4fb6 Use g_steal_pointer 2015-03-20 16:55:05 +01:00
Alexander Larsson ad8164a47f Use glnx_set_error_from_errno 2015-03-20 16:45:09 +01:00
Alexander Larsson b99e01b25b Switch to GLnxDirFd 2015-03-20 16:41:06 +01:00
Alexander Larsson 88c5c65e2d Use cleanup macros from libglnx 2015-03-20 16:36:17 +01:00
Alexander Larsson c856556b8a Convert to g_autoptr 2015-03-20 16:33:18 +01:00
Alexander Larsson db191015d4 xdg-app-dir: Move exports to update_exports
During installation of an app we rewrite and clean up the
deployed export directory, but don't actually export it.

Instead we export only the "current" version of the application
when we run update_exports (passing in which app changed). This way
we ensure that any newly exported files in the current app are exported
before we remove all dangling symlinks.

To make the symlinks properly dangle we also make the export symlinks
point use the "current" and "active" symlinks so non-current deployed
dirs don't keep an old symlink from being removed.
2015-03-11 10:25:18 +01:00
Alexander Larsson c71c8d0b5b Make sure we initialize variables that auto-cleanup 2015-03-11 10:25:18 +01:00
Alexander Larsson e2fdfc531c Track which branch of an app is current
When installed a branch is made current, and we list this in list-apps.
This means nothing atm, but will be used to limit exports to the current
branch of an app.
2015-03-10 16:26:51 +01:00
Alexander Larsson 737a516ce1 Add xdg_app_dir_list_refs[_for_name] helpers
These lists all the deployed refs in a given directory.
2015-03-10 15:30:53 +01:00
Alexander Larsson 961c3afb1d Move update_exports out of deploy/undeploy
We call this in the builtins rather than the lowlevel deploys,
which lets us call it less times if we're doing multiple deploys
in an operation.
2015-03-10 10:14:12 +01:00
Alexander Larsson c90f9473e1 deploy: Split the file rewriting and prefix checkout out from the exporting
We need this so that we can export an app multiple times, if you're e.g.
switching between deployed versions.
2015-03-09 17:13:04 +01:00
Alexander Larsson 471cdba23e Move writable area from /var to ~/.var/app/$appid
Having /var writable is pretty weird for a desktop app, this
is typically a system location. Instead of doing this
we assume the user writes writable data into  ~/.var/app/$appid.
This means an app following this can run both as standalone or
as an xdg-app without changes.

If the app has access to the home directory, then this just works.  If
it does not, then we ensure we have this directory in the volatile
home directory and then bind mount in the real directory there.

We also pre-create config/data/cache subdirectories in this
directory and set XDG_DATA/CONFIG/CACHE_HOME to point to them, which
means apps that use these "just work".
2015-02-19 22:52:01 +01:00
Alexander Larsson bcf2b13279 Don't double-quote command when rewriting desktop files 2015-02-13 11:45:13 +01:00
Alexander Larsson 0cb23de365 export: Ensure all exported files are prefixed by the app name
All exported regular files (not directories) need to have a filename
that starts with the application name, followed by either a dot or
any character that is invalid in an app name.

For instance, given an app name of org.gnome.gedit, these filenames
are exported:
org.gnome.gedit
org.gnome.gedit.png
org.gnome.gedit.plugin1.png
org.gnome.gedit-symbolic.svg (- is not a valid character)

However, these are not exported:

org.gnome.geditor
gedit.png

This has several advantages. First of all it ensures that there are no
conflicts between unrelated applications, secondly we also only allow
applications to install dbus services and desktop ids that are the
same as the app id, or sub-services of it.
2015-02-11 14:32:45 +01:00
Alexander Larsson d9c10e5103 export: keep the original name for modified desktop/service files
Rather than keeping around a symlink to the temporary file we rename
the temporary over the original name. Also we keep all seen
files and temporary files in a hashtable so we don't accidentally
process anything twice.
2015-02-11 14:30:53 +01:00
Alexander Larsson c1a0b41a7d Ensure all exported dbus service files have the right name
We're enforcing that the dbus name and the filename has to be the same,
or we're not exporting the file.
2015-02-11 14:29:16 +01:00
Alexander Larsson 4fad768593 Merge pull request #48 from matthiasclasen/prefix-ostree-errors
Prefix many ostree error messages
2015-02-08 01:15:59 +01:00
Matthias Clasen f412d38458 Quote commandline arguments
We don't expect branch or arch names to contain spaces. But if
they do, we should not fall over needlessly.
2015-02-07 18:38:29 +01:00
Matthias Clasen 41ea4e4ebc Prefix many ostree error messages
Some of the ostree error messages don't contain sufficient detail
to be useful, so use g_prefix_error to add some context.
2015-02-07 18:02:04 +01:00
Alexander Larsson 287a93742f Put system installed apps/runtimes in localstatedir (/var) 2015-02-06 11:59:38 +01:00
Alexander Larsson 4903fe100d Remove unused removed dirs after install/uninstall 2015-02-05 22:50:38 +01:00
Alexander Larsson 6ea2391583 During undeploy, keep files around if they are in use
We check for a lock on the .ref file to detect if anything
is using a partilular checkout before we remove it.
2015-02-05 22:47:48 +01:00
Alexander Larsson 7c8fb83f20 Create files/.ref when deploying
This will be used later to avoid deleting active mounts.
They have to be created during deploy, because we are
then guaranteed to be able to write to the directory,
and we don't want the resulting file to be hardlinked
to any other deployment (as then locks could be shared).
2015-02-05 18:34:02 +01:00
Matthias Clasen b01a6e3523 Don't create a useless .ref file
This serves no purpose.
2015-01-29 21:16:34 -05:00
Alexander Larsson 353365990e Support extension points in apps and runtimes
If you put in the metadat file something like:

[Extension org.gnome.Platform.Timezones]
directory=share/zoneinfo
subdirectories=false

[Extension org.gnome.Platform.Locale]
directory=share/gnome-sdk/locale/
subdirectories=true

then /usr/share/zoneinfo will be overridden with
whatever is in the org.gnome.Platform.Timezones
runtime if that is installed, and any runtime
like org.gnome.Platfrom.Locale.* will be mounted
at the corresponding name under /usr/gnome-sdk/locale
2015-01-22 20:42:23 +01:00
Matthias Clasen d357c1fee1 End the console status line after pull
Failure to do so causes the next shell prompt to appear in the
same line as the status, which looks broken.
2015-01-20 23:07:21 -05:00
Alexander Larsson deab96c8fb Update exports on uninstall too
This means we remove dangling links and re-run triggers.
2015-01-19 12:12:30 +01:00
Alexander Larsson c239e3b077 Merge pull request #23 from matthiasclasen/update-to-commit
Some work towards rollback and checkout
2015-01-19 11:43:14 +01:00
Alexander Larsson 4d2cc777f3 Also rewrite Exec= in service files 2015-01-19 11:14:20 +01:00
Alexander Larsson 2b8be8c7fd Rewrite exec stuff in all groups 2015-01-19 10:21:09 +01:00
Matthias Clasen a7994cc769 Make xdg_app_dir_deploy more capable
If we are given a checksum that is not present in the local
repository, pull it from the remote for the app (or runtime)
that is identified by ref.
2015-01-16 21:49:54 -05:00
Alexander Larsson 5e6597aa31 Properly export desktop files
This makes a copy of all .desktop files and removes all TryExec lines
and converts all Exec lines to use xdg-app run.
2015-01-16 18:46:08 +01:00
Alexander Larsson daf41bab9c Add triggers for exports
This runs the triggers in a read-only environment to update things
like desktop file databases, icon caches and mimeinfo databases.
2015-01-15 21:45:55 +01:00
Alexander Larsson eedc570a8a Use new ostree_repo_pull_default_console_progress_changed, 2015-01-12 16:49:06 +01:00
Alexander Larsson cf9713e9c4 Clean up dangling exported symlinks on deploy. 2015-01-12 08:50:09 +01:00
Alexander Larsson 0c28aab49a Explode exports on deploy 2015-01-12 08:50:09 +01:00
Alexander Larsson ed4aae8cf7 Use bare-user for user repo 2015-01-12 08:49:43 +01:00
Alexander Larsson 3a2eb66888 change name on "latest" symlink to "active" 2014-12-19 11:21:47 +01:00
Alexander Larsson 6f2a406d12 update: Remove old deployment and prune 2014-12-19 11:18:27 +01:00
Alexander Larsson 8be8442fa2 Use "checksum" not "hash" to reference commit ids
This is what ostree does
2014-12-19 09:35:38 +01:00
Alexander Larsson 13261318e0 Add initial version of run command 2014-12-18 17:51:37 +01:00
Alexander Larsson 3b53ae6489 Add app install/update 2014-12-18 15:26:40 +01:00
Alexander Larsson 06e57a081d Add install-runtime builtin 2014-12-18 11:06:37 +01:00
Alexander Larsson 63859dc0ee Add XdgAppDir and use 2014-12-18 10:14:46 +01:00