Commit 3c960ce9 authored by Pablo Correa Gomez's avatar Pablo Correa Gomez Committed by Rasmus Thomsen
Browse files

community/appstream: backport patch to fix compose screenshot generator

Downstream issue: alpine/infra/compose/appstream-generator#2
Upstream discussion: https://github.com/ximion/appstream/issues/395
parent c358328d
......@@ -2,7 +2,7 @@
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=appstream
pkgver=0.15.3
pkgrel=0
pkgrel=1
pkgdesc="Provides a standard for creating app stores across distributions"
url="https://distributions.freedesktop.org/wiki/AppStream"
arch="all"
......@@ -29,7 +29,9 @@ subpackages="
$pkgname-qt
$pkgname-lang
"
source="https://www.freedesktop.org/software/appstream/releases/AppStream-$pkgver.tar.xz"
source="https://www.freedesktop.org/software/appstream/releases/AppStream-$pkgver.tar.xz
fix-compose-screenshots.patch
"
builddir="$srcdir/AppStream-$pkgver"
# librsvg doesn't exist on these arches
......@@ -91,4 +93,5 @@ qt() {
sha512sums="
f38eda7cb8da95fca2dbbd1aecca17ce74b2e3c438a82cffbd7485b24a3588fccbc91d8c5eb83d2840da1d9bde4e8ed73bcc1c68809581c982fac753f622b866 AppStream-0.15.3.tar.xz
101ae7e2f6113a23801f1d9e8fcea13f63df98724452c4c926b8641979ae8665c1514f4ced30602d855ecdb8772ff2bb3a779d3b171274047ffbf0b9ece71495 fix-compose-screenshots.patch
"
diff --git c/compose/asc-utils-screenshots.c w/compose/asc-utils-screenshots.c
index f42579eb..4e8beec8 100644
--- c/compose/asc-utils-screenshots.c
+++ w/compose/asc-utils-screenshots.c
@@ -410,7 +410,7 @@ asc_process_screenshot_images (AscResult *cres,
gboolean thumbnails_generated = FALSE;
g_autoptr(GError) error = NULL;
- imgs = as_screenshot_get_images (scr);
+ imgs = as_screenshot_get_images_all (scr);
if (imgs->len == 0) {
asc_result_add_hint_simple (cres, cpt, "metainfo-screenshot-but-no-media");
return NULL;
@@ -434,7 +434,7 @@ asc_process_screenshot_images (AscResult *cres,
orig_img = g_object_ref (AS_IMAGE (g_ptr_array_index (imgs, 0)));
/* drop metainfo images */
- g_ptr_array_remove_range (imgs, 0, imgs->len);
+ as_screenshot_clear_images (scr);
orig_img_url = as_image_get_url (orig_img);
orig_img_locale = as_image_get_locale (orig_img);
@@ -621,7 +621,7 @@ asc_process_screenshot_images (AscResult *cres,
continue;
}
- // finally prepare the thumbnail definition and add it to the metadata
+ /* finally prepare the thumbnail definition and add it to the metadata */
img = as_image_new ();
as_image_set_locale (img, orig_img_locale);
as_image_set_kind (img, AS_IMAGE_KIND_THUMBNAIL);
diff --git c/src/as-screenshot.c w/src/as-screenshot.c
index c2e722a7..dfad8910 100644
--- c/src/as-screenshot.c
+++ w/src/as-screenshot.c
@@ -264,6 +264,23 @@ as_screenshot_add_image (AsScreenshot *screenshot, AsImage *image)
g_ptr_array_add (priv->images_lang, g_object_ref (image));
}
+/**
+ * as_screenshot_clear_images:
+ * @screenshot: a #AsScreenshot instance.
+ *
+ * Remove all images associated with this screenshot.
+ *
+ * Since: 0.15.4
+ **/
+void
+as_screenshot_clear_images (AsScreenshot *screenshot)
+{
+ AsScreenshotPrivate *priv = GET_PRIVATE (screenshot);
+
+ g_ptr_array_remove_range (priv->images, 0, priv->images->len);
+ g_ptr_array_remove_range (priv->images_lang, 0, priv->images_lang->len);
+}
+
/**
* as_screenshot_get_videos:
* @screenshot: a #AsScreenshot instance.
diff --git c/src/as-screenshot.h w/src/as-screenshot.h
index 6901f39e..6fa886bb 100644
--- c/src/as-screenshot.h
+++ w/src/as-screenshot.h
@@ -104,6 +104,7 @@ AsImage *as_screenshot_get_image (AsScreenshot *screenshot,
guint height);
void as_screenshot_add_image (AsScreenshot *screenshot,
AsImage *image);
+void as_screenshot_clear_images (AsScreenshot *screenshot);
GPtrArray *as_screenshot_get_videos (AsScreenshot *screenshot);
void as_screenshot_add_video (AsScreenshot *screenshot,
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment