banshee r4904 - in trunk/banshee: . src src/Core/Banshee.Services/Banshee.ServiceStack src/Core/Banshee.ThickClient/Banshee.Gui



Author: abock
Date: Sun Jan 11 05:43:59 2009
New Revision: 4904
URL: http://svn.gnome.org/viewvc/banshee?rev=4904&view=rev

Log:
2009-01-11  Aaron Bockover  <abock gnome org>

    ATTENTION PACKAGERS: This is a VERY important commit; please read this
    ChangeLog message as it applies to YOU :). Conforming to this will
    help with bug reports.

    * configure.ac: Accept --with-vendor-build-id=<foo> for packagers to use.
    This string should always be set by packagers and detail the distro
    name and version (e.g. openSUSE 11.1), and the repository origin, such
    as 'Banshee Team PPA'; for example, the %distribution macro is used in
    the openSUSE Build Service, which expands to something like this:
    'home:gabrielburt:branches:Banshee / openSUSE_Factory'; also the
    build/configure time is stored along with the host OS and CPU

    * src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs: Print all
    build metadata at startup so it hits the log file, should be very helpful
    for bug reports, especially when debugging against patched builds

    * src/AssemblyInfo.cs.in: Store build metadata from configure in assembly
    attributes (vendor, build time, host os/cpu)

    * src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs: Added
    APIs for accessing the build metadata



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/configure.ac
   trunk/banshee/src/AssemblyInfo.cs.in
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs

Modified: trunk/banshee/configure.ac
==============================================================================
--- trunk/banshee/configure.ac	(original)
+++ trunk/banshee/configure.ac	Sun Jan 11 05:43:59 2009
@@ -135,6 +135,18 @@
 fi
 AC_SUBST(GMCS_FLAGS)
 
+AC_ARG_WITH(vendor-build-id,
+	AC_HELP_STRING([--with-build-id=<vendor-build-id>],
+		[Set a vendor build ID, recommended for packagers]),
+	[vendor_build_id="$withval"], [vendor_build_id="source-tarball"])
+BUILD_VENDOR_ID="$vendor_build_id"
+BUILD_HOST_OS="$host_os"
+BUILD_HOST_CPU="$host_cpu"
+BUILD_TIME=`date +"%F %T %Z"`
+AC_SUBST(BUILD_VENDOR_ID)
+AC_SUBST(BUILD_HOST_OS)
+AC_SUBST(BUILD_HOST_CPU)
+AC_SUBST(BUILD_TIME)
 
 dnl generated files
 AC_OUTPUT([
@@ -260,6 +272,7 @@
 
     Unit Tests:        ${do_tests}	(requires nunit >= ${NUNIT_REQUIRED})
     Release Build:     ${enable_release}
+    Vendor Build ID:   ${vendor_build_id}
 "
 
 # Unstable/in-development features; only show them if they were manually enabled

Modified: trunk/banshee/src/AssemblyInfo.cs.in
==============================================================================
--- trunk/banshee/src/AssemblyInfo.cs.in	(original)
+++ trunk/banshee/src/AssemblyInfo.cs.in	Sun Jan 11 05:43:59 2009
@@ -3,6 +3,8 @@
 using System.Runtime.CompilerServices;
 
 [assembly: ApplicationVersion ("@VERSION@", "@DISPLAY_VERSION@")]
+[assembly: ApplicationBuildInformation ("@BUILD_VENDOR_ID@", "@BUILD_HOST_OS@", "@BUILD_HOST_CPU@", "@BUILD_TIME@")]
+
 [assembly: AssemblyVersion ("@ASM_VERSION@")]
 [assembly: AssemblyTitle ("Banshee")]
 [assembly: AssemblyDescription ("Banshee Media Player")]
@@ -29,3 +31,35 @@
     }
 }
 
+[AttributeUsage (AttributeTargets.Assembly, Inherited = false)]
+internal sealed class ApplicationBuildInformationAttribute : Attribute
+{
+    private string vendor;
+    public string Vendor {
+        get { return vendor; }
+    }
+
+    private string host_os;
+    public string HostOperatingSystem {
+        get { return host_os; }
+    }
+
+    private string host_cpu;
+    public string HostCpu {
+        get { return host_cpu; }
+    }
+
+    private string build_time;
+    public string BuildTime {
+        get { return build_time; }
+    }
+
+    public ApplicationBuildInformationAttribute (string vendor, string hostOs, string hostCpu, string time)
+    {
+        this.vendor = vendor;
+        this.host_os = hostOs;
+        this.host_cpu = hostCpu;
+        this.build_time = time;
+    }
+}
+

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs	Sun Jan 11 05:43:59 2009
@@ -268,18 +268,62 @@
             get { return display_version ?? (display_version = GetVersion ("DisplayVersion")); }
         }
         
+        private static string build_time;
+        public static string BuildTime {
+            get { return build_time ?? (build_time = GetBuildInfo ("BuildTime")); }
+        }
+        
+        private static string build_host_os;
+        public static string BuildHostOperatingSystem {
+            get { return build_host_os ?? (build_host_os = GetBuildInfo ("HostOperatingSystem")); }
+        }
+        
+        private static string build_host_cpu;
+        public static string BuildHostCpu {
+            get { return build_host_cpu ?? (build_host_cpu = GetBuildInfo ("HostCpu")); }
+        }
+        
+        private static string build_vendor;
+        public static string BuildVendor {
+            get { return build_vendor ?? (build_vendor = GetBuildInfo ("Vendor")); }
+        }
+        
+        private static string build_display_info;
+        public static string BuildDisplayInfo {
+            get {
+                if (build_display_info != null) {
+                    return build_display_info;
+                }
+                
+                build_display_info = String.Format ("{0} ({1}, {2}) @ {3}",
+                    BuildVendor, BuildHostOperatingSystem, BuildHostCpu, BuildTime);
+                return build_display_info;
+            }
+        }
+        
         private static string GetVersion (string versionName)
         {
+            return GetCustomAssemblyMetadata ("ApplicationVersionAttribute", versionName) 
+                ?? Catalog.GetString ("Unknown");
+        }
+        
+        private static string GetBuildInfo (string buildField)
+        {
+            return GetCustomAssemblyMetadata ("ApplicationBuildInformationAttribute", buildField);
+        }
+        
+        private static string GetCustomAssemblyMetadata (string attrName, string field)
+        {
             foreach (Attribute attribute in Assembly.GetEntryAssembly ().GetCustomAttributes (false)) {
                 Type type = attribute.GetType ();
-                PropertyInfo property = type.GetProperty (versionName);
-                if (type.Name == "ApplicationVersionAttribute" && property != null && 
+                PropertyInfo property = type.GetProperty (field);
+                if (type.Name == attrName && property != null && 
                     property.PropertyType == typeof (string)) {
                     return (string)property.GetValue (attribute, null); 
                 }
             }
             
-            return Catalog.GetString ("Unknown");
+            return null;
         }
     }
 }

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs	Sun Jan 11 05:43:59 2009
@@ -46,7 +46,8 @@
         
         public static void Startup<T> (string [] args) where T : GtkBaseClient
         {
-            Hyena.Log.InformationFormat ("Running Banshee {0}", Application.Version);
+            Hyena.Log.InformationFormat ("Running Banshee {0}: [{1}]", Application.Version,
+                Application.BuildDisplayInfo);
             
             // This could go into GtkBaseClient, but it's probably something we
             // should really only support at each client level



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]