rpms/rhythmbox/F-7 rb-disable-local-uri-escaping-5.patch, NONE, 1.1 rhythmbox.spec, 1.116, 1.117 rhythmbox-disable-local-uri-escaping.patch, 1.1, NONE

Bastien Nocera (hadess) fedora-extras-commits at redhat.com
Mon Oct 29 13:19:06 UTC 2007


Author: hadess

Update of /cvs/pkgs/rpms/rhythmbox/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv24652

Modified Files:
	rhythmbox.spec 
Added Files:
	rb-disable-local-uri-escaping-5.patch 
Removed Files:
	rhythmbox-disable-local-uri-escaping.patch 
Log Message:
* Mon Oct 29 2007 - Bastien Nocera <bnocera at redhat.com> - 0.10.1-4.fc7
- Update fix related to file URIs escaping (#291571)


rb-disable-local-uri-escaping-5.patch:

--- NEW FILE rb-disable-local-uri-escaping-5.patch ---
Index: lib/rb-file-helpers.c
===================================================================
--- lib/rb-file-helpers.c	(revision 5418)
+++ lib/rb-file-helpers.c	(working copy)
@@ -1070,41 +1070,37 @@
 {
 	char *result = NULL;
 
+	g_return_val_if_fail (uri != NULL, NULL);
+
 	if (uri[0] == '/') {
 		/* local path */
 		char *tmp;
 		result = gnome_vfs_make_path_name_canonical (uri);
-		tmp = gnome_vfs_escape_path_string (result);
+		tmp = gnome_vfs_get_uri_from_local_path (result);
 		g_free (result);
 		if (tmp == NULL)
 			return NULL;
-		tmp = escape_extra_gnome_vfs_chars (tmp);
-		result = g_strconcat ("file://", tmp, NULL);
-		g_free (tmp);
-	} else  if (g_str_has_prefix (uri, "file://")) {
-	    	/* local file, rhythmdb wants this path escaped */
-		char *tmp1, *tmp2;
-		tmp1  = gnome_vfs_unescape_string (uri + 7, NULL);  /* ignore "file://" */
-		tmp2 = gnome_vfs_escape_path_string (tmp1);
-		g_free (tmp1);
-		if (tmp2 == NULL)
-			return NULL;
-		tmp2 = escape_extra_gnome_vfs_chars (tmp2);
-		result = g_strconcat ("file://", tmp2, NULL); /* re-add scheme */
-		g_free (tmp2);
-	} else {
-		GnomeVFSURI *vfsuri = gnome_vfs_uri_new (uri);
+		result = tmp;
+	} else if (strstr (uri, "://") == NULL) {
+		/* local relative path */
+		char *curdir, *escaped, *curdir_withslash;
 
-		if (vfsuri != NULL) {
-			/* non-local uri, leave as-is */
-			gnome_vfs_uri_unref (vfsuri);
+		curdir = g_get_current_dir ();
+		escaped = gnome_vfs_escape_path_string (curdir);
+		curdir_withslash = g_strdup_printf ("file://%s%c",
+						    escaped, G_DIR_SEPARATOR);
+		g_free (escaped);
+		g_free (curdir);
+
+		escaped = gnome_vfs_escape_path_string (uri);
+		result = gnome_vfs_uri_make_full_from_relative
+			(curdir_withslash, escaped);
+		g_free (curdir_withslash);
+		g_free (escaped);
+	} else {
+		result = gnome_vfs_make_uri_canonical (uri);
+		if (result == NULL)
 			result = g_strdup (uri);
-		} else {
-			/* this may just mean that gnome-vfs doesn't recognise the
-			 * uri scheme, so return it as is */
-			rb_debug ("Error processing probable URI %s", uri);
-			result = g_strdup (uri);
-		}
 	}
 
 	return result;
Index: rhythmdb/rhythmdb-tree.c
===================================================================
--- rhythmdb/rhythmdb-tree.c	(revision 5418)
+++ rhythmdb/rhythmdb-tree.c	(working copy)
@@ -107,7 +107,9 @@
 					RBTreePropertyItFunc genres_func,
 					gpointer data);
 
-#define RHYTHMDB_TREE_XML_VERSION "1.3"
+/* Update both of those! */
+#define RHYTHMDB_TREE_XML_VERSION "1.4"
+#define RHYTHMDB_TREE_XML_VERSION_INT 140
 
 static void destroy_tree_property (RhythmDBTreeProperty *prop);
 static RhythmDBTreeProperty *get_or_create_album (RhythmDBTree *db, RhythmDBTreeProperty *artist,
@@ -326,6 +328,20 @@
 	gboolean reload_all_metadata;
 };
 
+/* Returns the version as an int, multiplied by 100,
+ * eg. "1.4" becomes 140 */
+static int
+version_to_int (const char *version)
+{
+	float ver;
+
+	if (sscanf (version, "%f", &ver) != 1) {
+		return (int) (1.0 * 100);
+	}
+
+	return ver * 100;
+}
+
 static void
 rhythmdb_tree_parser_start_element (struct RhythmDBTreeLoadContext *ctx,
 				    const char *name,
@@ -351,22 +367,32 @@
 				if (!strcmp (*attrs, "version")) {
 					const char *version = *(attrs+1);
 
-					if (!strcmp (version, "1.0") || !strcmp (version, "1.1")) {
+					switch (version_to_int (version)) {
+					case 100:
+					case 110:
+						rb_debug ("old version of rhythmdb, performing URI canonicalisation for all entries (DB version 1.0 or 1.1)");
 						ctx->canonicalise_uris = TRUE;
-						rb_debug ("old version of rhythmdb, performing URI canonicalisation for all entries");
-					} else if (!strcmp (version, "1.2")) {
-						/* current version*/
-						rb_debug ("reloading all file metadata to get MusicBrainz tags");
+					case 120:
+						rb_debug ("reloading all file metadata to get MusicBrainz tags (DB version 1.2)");
 						ctx->reload_all_metadata = TRUE;
-					} else if (!strcmp (version, "1.3")) {
-						/* current version*/
-					} else {
-						g_set_error (ctx->error,
-							     RHYTHMDB_TREE_ERROR,
-							     RHYTHMDB_TREE_ERROR_DATABASE_TOO_NEW,
-							     _("The database was created by a later version of rhythmbox."
-							       "  This version of rhythmbox cannot read the database."));
-						xmlStopParser (ctx->xmlctx);
+					case 130:
+						/* Avoid being warned twice for very old DBs */
+						if (ctx->canonicalise_uris == FALSE) {
+							rb_debug ("old version of rhythmdb, performing URI canonicalisation for all entries (DB version 1.3)");
+							ctx->canonicalise_uris = TRUE;
+						}
+					case RHYTHMDB_TREE_XML_VERSION_INT:
+						/* current version */
+						break;
+					default:
+						if (version_to_int (version) > RHYTHMDB_TREE_XML_VERSION_INT) {
+							g_set_error (ctx->error,
+								     RHYTHMDB_TREE_ERROR,
+								     RHYTHMDB_TREE_ERROR_DATABASE_TOO_NEW,
+								     _("The database was created by a later version of rhythmbox."
+								       "  This version of rhythmbox cannot read the database."));
+							xmlStopParser (ctx->xmlctx);
+						}
 					}
 				} else {
 					g_assert_not_reached ();


Index: rhythmbox.spec
===================================================================
RCS file: /cvs/pkgs/rpms/rhythmbox/F-7/rhythmbox.spec,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- rhythmbox.spec	18 Oct 2007 09:15:03 -0000	1.116
+++ rhythmbox.spec	29 Oct 2007 13:18:33 -0000	1.117
@@ -3,7 +3,7 @@
 Name: rhythmbox
 Summary: Music Management Application 
 Version: 0.10.1
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPL
 Group: Applications/Multimedia
 URL: http://www.gnome.org/projects/rhythmbox/
@@ -50,7 +50,7 @@
 Patch3: rhythmbox-0.10-shops-resizing.patch
 Patch4: rhythmbox-0.10.1-podcasts.patch
 # https://bugzilla.redhat.com/show_bug.cgi?id=291571
-Patch5: rhythmbox-disable-local-uri-escaping.patch
+Patch5: rb-disable-local-uri-escaping-5.patch
 
 %description
 Rhythmbox is an integrated music management application based on the powerful
@@ -158,6 +158,9 @@
 %{_libexecdir}/rhythmbox-metadata
 
 %changelog
+* Mon Oct 29 2007 - Bastien Nocera <bnocera at redhat.com> - 0.10.1-4.fc7
+- Update fix related to file URIs escaping (#291571)
+
 * Thu Oct 18 2007 - Bastien Nocera <bnocera at redhat.com> - 0.10.1-3.fc7
 - Hopefully fix indexing files with spaces in the name (#291571)
 


--- rhythmbox-disable-local-uri-escaping.patch DELETED ---




More information about the fedora-extras-commits mailing list