diff options
-rw-r--r-- | data/tests/app-1-1.fc21.i686.rpm | bin | 13476 -> 13620 bytes | |||
-rw-r--r-- | data/tests/app-1-1.fc21.x86_64.rpm | bin | 13440 -> 13584 bytes | |||
-rw-r--r-- | data/tests/app-console-1-1.fc21.noarch.rpm | bin | 6764 -> 6796 bytes | |||
-rw-r--r-- | data/tests/app-extra-1-1.fc21.noarch.rpm | bin | 6652 -> 6680 bytes | |||
-rw-r--r-- | data/tests/app.spec | 10 | ||||
-rw-r--r-- | libappstream-builder/asb-utils.c | 16 |
6 files changed, 23 insertions, 3 deletions
diff --git a/data/tests/app-1-1.fc21.i686.rpm b/data/tests/app-1-1.fc21.i686.rpm Binary files differindex be0aa9f..478333c 100644 --- a/data/tests/app-1-1.fc21.i686.rpm +++ b/data/tests/app-1-1.fc21.i686.rpm diff --git a/data/tests/app-1-1.fc21.x86_64.rpm b/data/tests/app-1-1.fc21.x86_64.rpm Binary files differindex 60011fb..a85dfda 100644 --- a/data/tests/app-1-1.fc21.x86_64.rpm +++ b/data/tests/app-1-1.fc21.x86_64.rpm diff --git a/data/tests/app-console-1-1.fc21.noarch.rpm b/data/tests/app-console-1-1.fc21.noarch.rpm Binary files differindex 640d753..e0b6c0d 100644 --- a/data/tests/app-console-1-1.fc21.noarch.rpm +++ b/data/tests/app-console-1-1.fc21.noarch.rpm diff --git a/data/tests/app-extra-1-1.fc21.noarch.rpm b/data/tests/app-extra-1-1.fc21.noarch.rpm Binary files differindex 6e03922..e8dd104 100644 --- a/data/tests/app-extra-1-1.fc21.noarch.rpm +++ b/data/tests/app-extra-1-1.fc21.noarch.rpm diff --git a/data/tests/app.spec b/data/tests/app.spec index 349027c..efc3adf 100644 --- a/data/tests/app.spec +++ b/data/tests/app.spec @@ -44,7 +44,14 @@ Sub package with console "application". %install install -Dp %{SOURCE0} $RPM_BUILD_ROOT/%{_datadir}/%{name}-%{version}/README install -Dp %{SOURCE1} $RPM_BUILD_ROOT/%{_datadir}/applications/app.desktop -install -Dp %{SOURCE2} $RPM_BUILD_ROOT/%{_datadir}/pixmaps/app.png + +# test decompressing a symlink destination +install -Dp %{SOURCE2} $RPM_BUILD_ROOT/%{_datadir}/app/app.png +mkdir -p $RPM_BUILD_ROOT/%{_datadir}/pixmaps +cd $RPM_BUILD_ROOT +ln -s %{_datadir}/app/app.png usr/share/pixmaps/app.png +cd - + install -Dp %{SOURCE3} $RPM_BUILD_ROOT/%{_datadir}/appdata/app.appdata.xml install -Dp %{SOURCE4} $RPM_BUILD_ROOT/%{_datadir}/gnome-shell/search-providers/search-provider.ini install -Dp %{SOURCE5} $RPM_BUILD_ROOT/%{_datadir}/help/C/app/index.page @@ -75,6 +82,7 @@ install -Dp %{SOURCE16} $RPM_BUILD_ROOT/%{_datadir}/applications/console2.deskto %{_datadir}/kde4/apps/app/app.notifyrc %{_datadir}/locale/en_GB/LC_MESSAGES/app.mo %{_datadir}/locale/ru/LC_MESSAGES/app.mo +%{_datadir}/app/app.png %{_datadir}/pixmaps/app.png %files extra diff --git a/libappstream-builder/asb-utils.c b/libappstream-builder/asb-utils.c index f4544ea..43c425f 100644 --- a/libappstream-builder/asb-utils.c +++ b/libappstream-builder/asb-utils.c @@ -181,7 +181,8 @@ asb_utils_ensure_exists_and_empty (const gchar *directory, GError **error) static gboolean asb_utils_explode_file (struct archive_entry *entry, const gchar *dir, - GPtrArray *glob) + GPtrArray *glob, + GPtrArray *symlink_glob) { const gchar *tmp; gchar buf[PATH_MAX]; @@ -212,6 +213,7 @@ asb_utils_explode_file (struct archive_entry *entry, /* update hardlinks */ tmp = archive_entry_hardlink (entry); if (tmp != NULL) { + g_ptr_array_add (symlink_glob, asb_glob_value_new (tmp, "")); g_snprintf (buf, PATH_MAX, "%s/%s", dir, tmp); archive_entry_update_hardlink_utf8 (entry, buf); } @@ -219,6 +221,7 @@ asb_utils_explode_file (struct archive_entry *entry, /* update symlinks */ tmp = archive_entry_symlink (entry); if (tmp != NULL) { + g_ptr_array_add (symlink_glob, asb_glob_value_new (tmp, "")); g_snprintf (buf, PATH_MAX, "%s/%s", dir, tmp); archive_entry_update_symlink_utf8 (entry, buf); } @@ -251,6 +254,7 @@ asb_utils_explode (const gchar *filename, struct archive *arch = NULL; struct archive_entry *entry; _cleanup_free_ gchar *data = NULL; + _cleanup_ptrarray_unref_ GPtrArray *symlink_glob = NULL; /* load file at once to avoid seeking */ ret = g_file_get_contents (filename, &data, &len, error); @@ -273,6 +277,7 @@ asb_utils_explode (const gchar *filename, } /* decompress each file */ + symlink_glob = asb_glob_value_array_new (); for (;;) { r = archive_read_next_header (arch, &entry); if (r == ARCHIVE_EOF) @@ -288,7 +293,7 @@ asb_utils_explode (const gchar *filename, } /* only extract if valid */ - valid = asb_utils_explode_file (entry, dir, glob); + valid = asb_utils_explode_file (entry, dir, glob, symlink_glob); if (!valid) continue; r = archive_read_extract (arch, entry, 0); @@ -302,6 +307,13 @@ asb_utils_explode (const gchar *filename, goto out; } } + + /* there are soft or hard links to explode too */ + if (symlink_glob->len > 0) { + ret = asb_utils_explode (filename, dir, symlink_glob, error); + if (!ret) + goto out; + } out: if (arch != NULL) { archive_read_close (arch); |