[vlc-devel] commit: Allow binary maintainer to pass a custom string ( Christophe Mutricy )

git version control git at videolan.org
Thu Jul 3 23:44:39 CEST 2008


vlc | branch: master | Christophe Mutricy <xtophe at videolan.org> | Thu Jul  3 20:02:37 2008 +0100| [223bc6472936d8761b4397a20496e914b5cb5982]

Allow binary maintainer to pass a custom string

Soo that we avoid plugin cache problem between binary version.

This patch was first thought for Debian but considering it is usefull
for all distros and for VideoLAN own win32 and MacOSX builds, I
think it has its place in the master tree.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=223bc6472936d8761b4397a20496e914b5cb5982
---

 configure.ac        |   11 +++++++++++
 src/modules/cache.c |   20 +++++++++++++++++++-
 2 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 885d6e6..f709a9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,17 @@ AC_C_CONST
 AC_C_INLINE
 AC_C_RESTRICT
 
+dnl Allow binary package maintainer to pass a custom string to avoid 
+dnl cache problem
+AC_ARG_WITH(binary-version, 
+	AS_HELP_STRING([--with-binary-version=STRING],
+	     [To avoid plugins cache problem between binary version]),[],[])
+AS_IF([test -n "${with_binary_version}"],[
+      AC_DEFINE_UNQUOTED([DISTRO_VERSION],["${with_binary_version}"],
+			 [Binary specific version])
+      ])
+
+
 dnl
 dnl  Check for the contrib directory
 dnl
diff --git a/src/modules/cache.c b/src/modules/cache.c
index 25b0605..538e8a2 100644
--- a/src/modules/cache.c
+++ b/src/modules/cache.c
@@ -178,6 +178,20 @@ void CacheLoad( vlc_object_t *p_this )
         return;
     }
 
+#ifdef DISTRO_VERSION
+    /* Check for distribution specific version */
+    char p_distrostring[sizeof( DISTRO_VERSION )];
+    i_size = sizeof( DISTRO_VERSION ) - 1;
+    i_read = fread( p_distrostring, 1, i_size, file );
+    if( i_read != i_size ||
+        memcmp( p_distrostring, DISTRO_VERSION, i_size ) )
+    {
+        msg_Warn( p_this, "This doesn't look like a valid plugins cache" );
+        fclose( file );
+        return;
+    }
+#endif
+
     /* Check Sub-version number */
     i_read = fread( &i_marker, 1, sizeof(i_marker), file );
     if( i_read != sizeof(i_marker) || i_marker != CACHE_SUBVERSION_NUM )
@@ -496,7 +510,11 @@ void CacheSave( vlc_object_t *p_this )
     /* Contains version number */
     if (fputs ("cache "COPYRIGHT_MESSAGE, file) == EOF)
         goto error;
-
+#ifdef DISTRO_VERSION
+    /* Allow binary maintaner to pass a string to detect new binary version*/
+    if (fputs( DISTRO_VERSION, file ) == EOF)
+        goto error;
+#endif
     /* Sub-version number (to avoid breakage in the dev version when cache
      * structure changes) */
     i_file_size = CACHE_SUBVERSION_NUM;




More information about the vlc-devel mailing list