Hello community,

here is the log from the commit of package appstream-glib for openSUSE:Factory 
checked in at 2015-04-23 08:03:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/appstream-glib (Old)
 and      /work/SRC/openSUSE:Factory/.appstream-glib.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "appstream-glib"

Changes:
--------
--- /work/SRC/openSUSE:Factory/appstream-glib/appstream-glib.changes    
2015-04-15 17:42:39.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.appstream-glib.new/appstream-glib.changes       
2015-04-23 08:03:29.000000000 +0200
@@ -1,0 +2,10 @@
+Wed Apr 22 07:22:32 UTC 2015 - [email protected]
+
+- Update to version 0.3.6+git.20150414:
+  + trivial: post-branch version bump
+  + Use the sanitized font filename as the cache-id
+  + trivial: Never attempt to mirror generated screenshots
+  + Check for duplicate screenshots when adding fonts
+  + trivial: Convert the porting document to markdown
+
+-------------------------------------------------------------------

Old:
----
  appstream-glib-0.3.6+git.20150409.tar.xz

New:
----
  appstream-glib-0.3.6+git.20150414.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ appstream-glib.spec ++++++
--- /var/tmp/diff_new_pack.k4r2wQ/_old  2015-04-23 08:03:30.000000000 +0200
+++ /var/tmp/diff_new_pack.k4r2wQ/_new  2015-04-23 08:03:30.000000000 +0200
@@ -20,7 +20,7 @@
 %define _build_from_vcs 1
 
 Name:           appstream-glib
-Version:        0.3.6+git.20150409
+Version:        0.3.6+git.20150414
 Release:        0
 Summary:        AppStream Abstraction Library
 License:        LGPL-2.1+

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.k4r2wQ/_old  2015-04-23 08:03:30.000000000 +0200
+++ /var/tmp/diff_new_pack.k4r2wQ/_new  2015-04-23 08:03:30.000000000 +0200
@@ -1,4 +1,4 @@
 <servicedata>
 <service name="tar_scm">
             <param 
name="url">https://github.com/hughsie/appstream-glib.git</param>
-          <param 
name="changesrevision">85b1dae71e2d138bd616e5be0bb558489dc36f20</param></service></servicedata>
\ No newline at end of file
+          <param 
name="changesrevision">3dfc25a98058454b5e04e780b1729ea4ad411a05</param></service></servicedata>
\ No newline at end of file

++++++ appstream-glib-0.3.6+git.20150409.tar.xz -> 
appstream-glib-0.3.6+git.20150414.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/appstream-glib-0.3.6+git.20150409/RELEASE 
new/appstream-glib-0.3.6+git.20150414/RELEASE
--- old/appstream-glib-0.3.6+git.20150409/RELEASE       2015-04-10 
13:01:21.000000000 +0200
+++ new/appstream-glib-0.3.6+git.20150414/RELEASE       2015-04-22 
09:22:31.000000000 +0200
@@ -5,7 +5,7 @@
 git shortlog appstream_glib_0_3_6.. | grep -i -v trivial | grep -v Merge > 
NEWS.new
 
 
--------------------------------------------------------------------------------
-Version 0.3.7
+Version 0.4.0
 ~~~~~~~~~~~~~
 Released: 2015-xx-xx
 
@@ -20,8 +20,8 @@
 
 4. Commit changes in git:
 
-git commit -a -m "Release version 0.3.7"
-git tag -s -f -m "Release 0.3.7" appstream_glib_0_3_7
+git commit -a -m "Release version 0.4.0"
+git tag -s -f -m "Release 0.4.0" appstream_glib_0_4_0
 <gpg password>
 git push --tags
 git push
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/appstream-glib-0.3.6+git.20150409/client/as-util.c 
new/appstream-glib-0.3.6+git.20150414/client/as-util.c
--- old/appstream-glib-0.3.6+git.20150409/client/as-util.c      2015-04-10 
13:01:21.000000000 +0200
+++ new/appstream-glib-0.3.6+git.20150414/client/as-util.c      2015-04-22 
09:22:31.000000000 +0200
@@ -3070,10 +3070,11 @@
        _cleanup_object_unref_ SoupMessage *msg = NULL;
        _cleanup_object_unref_ SoupSession *session = NULL;
 
-       /* local files, typically fonts */
-       if (g_str_has_prefix (url, "file:/")) {
+       /* fonts screenshots are auto-generated */
+       if (as_app_get_id_kind (app) == AS_ID_KIND_FONT) {
                _cleanup_free_ gchar *url_new = NULL;
-               url_new = g_build_filename (mirror_uri, "source", url + 6, 
NULL);
+               basename = g_path_get_basename (url);
+               url_new = g_build_filename (mirror_uri, "source", basename, 
NULL);
                im = as_image_new ();
                as_image_set_url (im, url_new, -1);
                as_image_set_kind (im, AS_IMAGE_KIND_SOURCE);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/appstream-glib-0.3.6+git.20150409/configure.ac 
new/appstream-glib-0.3.6+git.20150414/configure.ac
--- old/appstream-glib-0.3.6+git.20150409/configure.ac  2015-04-10 
13:01:21.000000000 +0200
+++ new/appstream-glib-0.3.6+git.20150414/configure.ac  2015-04-22 
09:22:31.000000000 +0200
@@ -1,8 +1,8 @@
 AC_PREREQ(2.63)
 
 m4_define([as_major_version], [0])
-m4_define([as_minor_version], [3])
-m4_define([as_micro_version], [7])
+m4_define([as_minor_version], [4])
+m4_define([as_micro_version], [0])
 m4_define([as_version],
           [as_major_version.as_minor_version.as_micro_version])
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/appstream-glib-0.3.6+git.20150409/docs/PORTING.txt 
new/appstream-glib-0.3.6+git.20150414/docs/PORTING.txt
--- old/appstream-glib-0.3.6+git.20150409/docs/PORTING.txt      2015-04-10 
13:01:21.000000000 +0200
+++ new/appstream-glib-0.3.6+git.20150414/docs/PORTING.txt      1970-01-01 
01:00:00.000000000 +0100
@@ -1,12 +0,0 @@
-0.2.x -> 0.3.x
-==============
-
-* as_app_get_keywords(app)             ->      as_app_get_keywords(app,locale)
-* as_app_add_keyword(app,kw,len)       ->      
as_app_add_keyword(app,locale,kw,len)
-* as_app_get_id(app)                   ->      as_app_get_id_filename(app)
-* as_app_get_id_full(app)              ->      as_app_get_id(app)
-
-Planned, but not yet done:
-
-* as_screenshot_add_image(ss,im)       ->      
as_screenshot_add_image(ss,locale,im)
-* as_screenshot_get_images(ss)         ->      
as_screenshot_get_images(ss,locale)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/appstream-glib-0.3.6+git.20150409/docs/Porting.md 
new/appstream-glib-0.3.6+git.20150414/docs/Porting.md
--- old/appstream-glib-0.3.6+git.20150409/docs/Porting.md       1970-01-01 
01:00:00.000000000 +0100
+++ new/appstream-glib-0.3.6+git.20150414/docs/Porting.md       2015-04-22 
09:22:31.000000000 +0200
@@ -0,0 +1,4 @@
+Planned, but not yet done:
+
+* `as_screenshot_add_image(ss,im)` -> `as_screenshot_add_image(ss,locale,im)`
+* `as_screenshot_get_images(ss)`   -> `as_screenshot_get_images(ss,locale)`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/appstream-glib-0.3.6+git.20150409/libappstream-builder/asb-self-test.c 
new/appstream-glib-0.3.6+git.20150414/libappstream-builder/asb-self-test.c
--- old/appstream-glib-0.3.6+git.20150409/libappstream-builder/asb-self-test.c  
2015-04-10 13:01:21.000000000 +0200
+++ new/appstream-glib-0.3.6+git.20150414/libappstream-builder/asb-self-test.c  
2015-04-22 09:22:31.000000000 +0200
@@ -451,7 +451,7 @@
                "<screenshots>\n"
                "<screenshot type=\"default\">\n"
                "<caption>Liberation Serif – Regular</caption>\n"
-               "<image type=\"source\" height=\"48\" 
width=\"640\">file:/LiberationSerif-660e7a5a60fdeb133d3e8b24e2766f2e.png</image>\n"
+               "<image type=\"source\" height=\"48\" 
width=\"640\">file:/LiberationSerif-85c191549daefb8f3b6cdb4d3d6d8597.png</image>\n"
                "</screenshot>\n"
                "<screenshot priority=\"-32\">\n"
                "<caption>Liberation Serif – Bold</caption>\n"
@@ -617,7 +617,7 @@
                "<screenshots>\n"
                "<screenshot type=\"default\">\n"
                "<caption>Liberation Serif – Regular</caption>\n"
-               "<image type=\"source\" height=\"48\" 
width=\"640\">file:/LiberationSerif-660e7a5a60fdeb133d3e8b24e2766f2e.png</image>\n"
+               "<image type=\"source\" height=\"48\" 
width=\"640\">file:/LiberationSerif-85c191549daefb8f3b6cdb4d3d6d8597.png</image>\n"
                "</screenshot>\n"
                "<screenshot priority=\"-32\">\n"
                "<caption>Liberation Serif – Bold</caption>\n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/appstream-glib-0.3.6+git.20150409/libappstream-builder/plugins/asb-plugin-font.c
 
new/appstream-glib-0.3.6+git.20150414/libappstream-builder/plugins/asb-plugin-font.c
--- 
old/appstream-glib-0.3.6+git.20150409/libappstream-builder/plugins/asb-plugin-font.c
        2015-04-10 13:01:21.000000000 +0200
+++ 
new/appstream-glib-0.3.6+git.20150414/libappstream-builder/plugins/asb-plugin-font.c
        2015-04-22 09:22:31.000000000 +0200
@@ -387,11 +387,16 @@
  * asb_font_add_screenshot:
  */
 static gboolean
-asb_font_add_screenshot (AsbPlugin *plugin, AsbApp *app, FT_Face ft_face, 
GError **error)
+asb_font_add_screenshot (AsbPlugin *plugin, AsbApp *app, FT_Face ft_face,
+                        const gchar *cache_id, GError **error)
 {
+       AsImage *im_tmp;
+       AsScreenshot *ss_tmp;
+       GPtrArray *screenshots;
        const gchar *cache_dir;
        const gchar *temp_dir;
        const gchar *tmp;
+       guint i;
        _cleanup_free_ gchar *basename = NULL;
        _cleanup_free_ gchar *cache_fn = NULL;
        _cleanup_free_ gchar *output_fn = NULL;
@@ -408,8 +413,7 @@
        /* is in the cache */
        cache_dir = asb_context_get_cache_dir (plugin->ctx);
        cache_fn = g_strdup_printf ("%s/screenshots/%s.png",
-                                   cache_dir,
-                                   as_app_get_id_filename (AS_APP (app)));
+                                   cache_dir, cache_id);
        if (g_file_test (cache_fn, G_FILE_TEST_EXISTS)) {
                pixbuf = gdk_pixbuf_new_from_file (cache_fn, error);
                if (pixbuf == NULL)
@@ -454,6 +458,25 @@
        if (!gdk_pixbuf_save (pixbuf, output_fn, "png", error, NULL))
                return FALSE;
 
+       /* check the screenshot does not already exist */
+       screenshots = as_app_get_screenshots (AS_APP (app));
+       for (i = 0; i < screenshots->len; i++) {
+               ss_tmp = g_ptr_array_index (screenshots, i);
+               im_tmp = as_screenshot_get_source (ss_tmp);
+               if (im_tmp == NULL)
+                       continue;
+               if (g_strcmp0 (as_image_get_md5 (im_tmp),
+                              as_image_get_md5 (im)) == 0) {
+                       g_set_error (error,
+                                    ASB_PLUGIN_ERROR,
+                                    ASB_PLUGIN_ERROR_FAILED,
+                                    "Font screenshot already exists with hash 
%s",
+                                    as_image_get_md5 (im));
+                       return FALSE;
+               }
+       }
+
+       /* add screenshot */
        ss = as_screenshot_new ();
        as_screenshot_set_kind (ss, AS_SCREENSHOT_KIND_DEFAULT);
        as_screenshot_add_image (ss, im);
@@ -581,7 +604,9 @@
        FT_Library library = NULL;
        const gchar *tmp;
        gboolean ret = TRUE;
+       guint i;
        const FcPattern *pattern;
+       _cleanup_free_ gchar *cache_id = NULL;
        _cleanup_free_ gchar *comment = NULL;
        _cleanup_free_ gchar *icon_filename = NULL;
        _cleanup_object_unref_ GdkPixbuf *pixbuf = NULL;
@@ -618,6 +643,14 @@
                goto out;
        }
 
+       /* use the filename as the cache-id */
+       cache_id = g_path_get_basename (filename);
+       for (i = 0; cache_id[i] != '\0'; i++) {
+               if (g_ascii_isalnum (cache_id[i]))
+                       continue;
+               cache_id[i] = '_';
+       }
+
        /* create app that might get merged later */
        as_app_add_category (AS_APP (app), "Addons", -1);
        as_app_add_category (AS_APP (app), "Fonts", -1);
@@ -632,7 +665,7 @@
        asb_font_add_languages (app, pattern);
        asb_font_add_metadata (app, ft_face);
        asb_font_fix_metadata (app);
-       ret = asb_font_add_screenshot (plugin, app, ft_face, error);
+       ret = asb_font_add_screenshot (plugin, app, ft_face, cache_id, error);
        if (!ret)
                goto out;
 


Reply via email to