Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add add_path extension option #5482

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions common/flatpak-metadata-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ G_BEGIN_DECLS

#define FLATPAK_METADATA_GROUP_PREFIX_EXTENSION "Extension "
#define FLATPAK_METADATA_KEY_ADD_LD_PATH "add-ld-path"
#define FLATPAK_METADATA_KEY_ADD_PATH "add-path"
#define FLATPAK_METADATA_KEY_AUTODELETE "autodelete"
#define FLATPAK_METADATA_KEY_DIRECTORY "directory"
#define FLATPAK_METADATA_KEY_DOWNLOAD_IF "download-if"
Expand Down
6 changes: 6 additions & 0 deletions common/flatpak-run.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ flatpak_run_add_extension_args (FlatpakBwrap *bwrap,
}
}

if (ext->add_path)
{
g_autofree char *path = g_build_filename (full_directory, ext->add_path, NULL);
/* TODO: add the appropriate path to the PATH variable */
}

for (i = 0; ext->merge_dirs != NULL && ext->merge_dirs[i] != NULL; i++)
{
g_autofree char *parent = g_path_get_dirname (directory);
Expand Down
1 change: 1 addition & 0 deletions common/flatpak-utils-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ typedef struct
char *files_path;
char *subdir_suffix;
char *add_ld_path;
char *add_path;
char **merge_dirs;
int priority;
gboolean needs_tmpfs;
Expand Down
11 changes: 8 additions & 3 deletions common/flatpak-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -5868,6 +5868,7 @@ flatpak_extension_new (const char *id,
FlatpakDecomposed *ref,
const char *directory,
const char *add_ld_path,
const char *add_path,
const char *subdir_suffix,
char **merge_dirs,
GFile *files,
Expand All @@ -5884,6 +5885,7 @@ flatpak_extension_new (const char *id,
ext->directory = g_strdup (directory);
ext->files_path = g_file_get_path (files);
ext->add_ld_path = g_strdup (add_ld_path);
ext->add_path = g_strdup (add_path);
ext->subdir_suffix = g_strdup (subdir_suffix);
ext->merge_dirs = g_strdupv (merge_dirs);
ext->is_unmaintained = is_unmaintained;
Expand Down Expand Up @@ -6006,6 +6008,9 @@ add_extension (GKeyFile *metakey,
g_autofree char *add_ld_path = g_key_file_get_string (metakey, group,
FLATPAK_METADATA_KEY_ADD_LD_PATH,
NULL);
g_autofree char *add_path = g_key_file_get_string (metakey, group,
FLATPAK_METADATA_KEY_ADD_PATH,
NULL);
g_auto(GStrv) merge_dirs = g_key_file_get_string_list (metakey, group,
FLATPAK_METADATA_KEY_MERGE_DIRS,
NULL, NULL);
Expand Down Expand Up @@ -6045,7 +6050,7 @@ add_extension (GKeyFile *metakey,
if (flatpak_extension_matches_reason (extension, enable_if, TRUE))
{
ext = flatpak_extension_new (extension, extension, ref, directory,
add_ld_path, subdir_suffix, merge_dirs,
add_ld_path, add_path, subdir_suffix, merge_dirs,
files, deploy_dir, is_unmaintained,
is_unmaintained ? NULL : flatpak_dir_get_repo (dir));
res = g_list_prepend (res, ext);
Expand Down Expand Up @@ -6081,7 +6086,7 @@ add_extension (GKeyFile *metakey,
if (subdir_files && flatpak_extension_matches_reason (id, enable_if, TRUE))
{
ext = flatpak_extension_new (extension, id, dir_ref, extended_dir,
add_ld_path, subdir_suffix, merge_dirs,
add_ld_path, add_path, subdir_suffix, merge_dirs,
subdir_files, subdir_deploy_dir, FALSE,
flatpak_dir_get_repo (subdir_dir));
ext->needs_tmpfs = TRUE;
Expand All @@ -6104,7 +6109,7 @@ add_extension (GKeyFile *metakey,
if (subdir_files && flatpak_extension_matches_reason (unmaintained_refs[j], enable_if, TRUE))
{
ext = flatpak_extension_new (extension, unmaintained_refs[j], dir_ref,
extended_dir, add_ld_path, subdir_suffix,
extended_dir, add_ld_path, add_path, subdir_suffix,
merge_dirs, subdir_files, NULL, TRUE, NULL);
ext->needs_tmpfs = TRUE;
res = g_list_prepend (res, ext);
Expand Down
9 changes: 8 additions & 1 deletion doc/flatpak-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,14 @@
to LD_LIBRARY_PATH. Available since 0.9.1, and
backported to the 0.8.x branch in 0.8.3.
</para></listitem>
</varlistentry>
</varlistentry>
<varlistentry>
<term><option>add-path</option> (string)</term>
<listitem><para>
A path relative to the extension point directory that will be appended
to PATH. Available since 1.14.5.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>merge-dirs</option> (string)</term>
<listitem><para>
Expand Down