[Pkg-owncloud-commits] [owncloud-client] 31/89: Add build number into versioning scheme

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Dec 14 01:02:32 UTC 2013


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit f5e8efd435aad3273c73d95944322f2f74c2b1ff
Author: Daniel Molkentin <danimo at owncloud.com>
Date:   Mon Dec 9 16:35:30 2013 +0100

    Add build number into versioning scheme
    
    This is an enabler to improve update experience
---
 OwnCloudCPack.cmake                     |  9 +++++----
 VERSION.cmake                           | 25 ++++++++++++++++++++-----
 cmake/modules/MacOSXBundleInfo.plist.in |  6 +++---
 cmake/modules/NSIS.template.in          | 10 +++++++---
 src/CMakeLists.txt                      |  4 ++--
 src/mirall/owncloudtheme.cpp            |  2 +-
 src/mirall/theme.cpp                    |  5 +++++
 src/mirall/theme.h                      |  5 +++++
 src/mirall/updatedetector.cpp           | 12 +++++-------
 src/mirall/version.h.in                 | 19 ++++++++++++-------
 10 files changed, 65 insertions(+), 32 deletions(-)

diff --git a/OwnCloudCPack.cmake b/OwnCloudCPack.cmake
index 3b7a4ac..d2c4c4a 100644
--- a/OwnCloudCPack.cmake
+++ b/OwnCloudCPack.cmake
@@ -9,10 +9,11 @@ else ()
 endif()
 
 include( VERSION.cmake )
-set( CPACK_PACKAGE_VERSION_MAJOR  ${VERSION_MAJOR} )
-set( CPACK_PACKAGE_VERSION_MINOR  ${VERSION_MINOR} )
-set( CPACK_PACKAGE_VERSION_PATCH  ${VERSION_PATCH} )
-set( CPACK_PACKAGE_VERSION  ${VERSION} )
+set( CPACK_PACKAGE_VERSION_MAJOR  ${MIRALL_VERSION_MAJOR} )
+set( CPACK_PACKAGE_VERSION_MINOR  ${MIRALL_VERSION_MINOR} )
+set( CPACK_PACKAGE_VERSION_PATCH  ${MIRALL_VERSION_PATCH} )
+set( CPACK_PACKAGE_VERSION_BUILD  ${MIRALL_VERSION_BUILD} )
+set( CPACK_PACKAGE_VERSION  ${MIRALL_VERSION_FULL} )
 
 if(APPLE)
     set( CPACK_GENERATOR "DragNDrop" )
diff --git a/VERSION.cmake b/VERSION.cmake
index 6f3ed48..0b6bc18 100644
--- a/VERSION.cmake
+++ b/VERSION.cmake
@@ -1,6 +1,21 @@
-set( VERSION_MAJOR 1 )
-set( VERSION_MINOR 5 )
-set( VERSION_PATCH 0 )
-set( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX}beta2")
-set( SOVERSION 0 )
+set( MIRALL_VERSION_MAJOR 1 )
+set( MIRALL_VERSION_MINOR 5 )
+set( MIRALL_VERSION_PATCH 0 )
+set( MIRALL_SOVERSION 0 )
 
+set( MIRALL_VERSION_SUFFIX "" CACHE STRING "e.g. beta1, beta2, rc1" )
+set( MIRALL_VERSION_BUILD  "0" CACHE STRING "Integer ID. Generated by the build system")
+
+# Composite defines
+# Used e.g. for libraries Keep at x.y.z.
+set( MIRALL_VERSION "${MIRALL_VERSION_MAJOR}.${MIRALL_VERSION_MINOR}.${MIRALL_VERSION_PATCH}" )
+# Version with Build ID. Used in the installer
+set( MIRALL_VERSION_FULL ${MIRALL_VERSION} )
+set( MIRALL_VERSION_STRING ${MIRALL_VERSION} )
+set( MIRALL_VERSION_FULL "${MIRALL_VERSION_FULL}.${MIRALL_VERSION_BUILD}" )
+
+if( MIRALL_VERSION_SUFFIX )
+  set( MIRALL_VERSION_STRING "${MIRALL_VERSION} ${MIRALL_VERSION_SUFFIX} (build ${MIRALL_VERSION_BUILD})" )
+else( MIRALL_VERSION_SUFFIX )
+  set( MIRALL_VERSION_STRING "${MIRALL_VERSION} (build ${MIRALL_VERSION_BUILD})" )
+endif( MIRALL_VERSION_SUFFIX )
diff --git a/cmake/modules/MacOSXBundleInfo.plist.in b/cmake/modules/MacOSXBundleInfo.plist.in
index 2998885..e31f21e 100644
--- a/cmake/modules/MacOSXBundleInfo.plist.in
+++ b/cmake/modules/MacOSXBundleInfo.plist.in
@@ -17,15 +17,15 @@
         <key>CFBundleInfoDictionaryVersion</key>
         <string>6.0</string>
         <key>CFBundleLongVersionString</key>
-        <string>@APPLICATION_NAME@ @VERSION@</string>
+        <string>@APPLICATION_NAME@ @MIRALL_VERSION_FULL@</string>
         <key>CFBundlePackageType</key>
         <string>APPL</string>
         <key>CFBundleSignature</key>
         <string>????</string>
         <key>CFBundleVersion</key>
-        <string>@VERSION@</string>
+        <string>@VERSION_FULL@</string>
         <key>CFBundleShortVersionString</key>
-        <string>@VERSION@</string>
+        <string>@VERSION_FULL@</string>
         <key>NSHumanReadableCopyright</key>
         <string>(C) 2012 @APPLICATION_VENDOR@</string>
 </dict>
diff --git a/cmake/modules/NSIS.template.in b/cmake/modules/NSIS.template.in
index 6c4c750..73a2b7b 100644
--- a/cmake/modules/NSIS.template.in
+++ b/cmake/modules/NSIS.template.in
@@ -49,7 +49,8 @@
 
 !define VER_MAJOR "@CPACK_PACKAGE_VERSION_MAJOR@"
 !define VER_MINOR "@CPACK_PACKAGE_VERSION_MINOR@"
-!define VER_BUILD "@CPACK_PACKAGE_VERSION_PATCH@"
+!define VER_PATCH "@CPACK_PACKAGE_VERSION_PATCH@"
+!define VER_BUILD "@CPACK_PACKAGE_VERSION_BUILD@"
 !define VERSION "@CPACK_PACKAGE_VERSION@"
 
 ;-----------------------------------------------------------------------------
@@ -205,7 +206,10 @@ Function PageReinstall
    IntCmp $R0 ${VER_MAJOR} minor_check new_version older_version
    minor_check:
       ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionMinor"
-      IntCmp $R0 ${VER_MINOR} build_check new_version older_version
+      IntCmp $R0 ${VER_MINOR} rev_check new_version older_version
+   rev_check:
+      ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionRevision"
+      IntCmp $R0 ${VER_PATCH} build_check new_version older_version
    build_check:
       ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionBuild"
       IntCmp $R0 ${VER_BUILD} same_version new_version older_version
@@ -410,7 +414,7 @@ Section -post
    WriteRegStr HKLM "Software\${APPLICATION_NAME}" "" $INSTDIR
    WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionMajor" "${VER_MAJOR}"
    WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionMinor" "${VER_MINOR}"
-   WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionRevision" "${REVISION}"
+   WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionRevision" "${VER_PATCH}"
    WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionBuild" "${VER_BUILD}"
 
    ;Add or Remove Programs entry.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 54f2409..4bd8b6b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -199,8 +199,8 @@ add_library(${synclib_NAME} SHARED ${libsync_SRCS} ${syncMoc})
 qt5_use_modules(${synclib_NAME} Widgets Network Xml WebKitWidgets Sql)
 
 set_target_properties( ${synclib_NAME}  PROPERTIES
-	VERSION ${VERSION}
-	SOVERSION ${SOVERSION}
+	VERSION ${MIRALL_VERSION}
+	SOVERSION ${MIRALL_SOVERSION}
 )
 
 target_link_libraries(${synclib_NAME} ${libsync_LINK_TARGETS} )
diff --git a/src/mirall/owncloudtheme.cpp b/src/mirall/owncloudtheme.cpp
index 8abb134..335bb7c 100644
--- a/src/mirall/owncloudtheme.cpp
+++ b/src/mirall/owncloudtheme.cpp
@@ -60,7 +60,7 @@ QString ownCloudTheme::about() const
                "Based on Mirall by Duncan Mac-Vicar P.</small></p>"
                "%7"
                )
-            .arg(MIRALL_STRINGIFY(MIRALL_VERSION))
+            .arg(MIRALL_VERSION_STRING)
             .arg("http://" MIRALL_STRINGIFY(APPLICATION_DOMAIN))
             .arg(MIRALL_STRINGIFY(APPLICATION_DOMAIN))
             .arg(devString);
diff --git a/src/mirall/theme.cpp b/src/mirall/theme.cpp
index ce6a85c..d103041 100644
--- a/src/mirall/theme.cpp
+++ b/src/mirall/theme.cpp
@@ -193,6 +193,11 @@ bool Theme::systrayUseMonoIcons() const
     return _mono;
 }
 
+QString Theme::updateCheckUrl() const
+{
+    return QLatin1String("https://updates.owncloud.com/client/");
+}
+
 QString Theme::about() const
 {
     return QString::null;
diff --git a/src/mirall/theme.h b/src/mirall/theme.h
index 11a66b8..d819ce2 100644
--- a/src/mirall/theme.h
+++ b/src/mirall/theme.h
@@ -170,6 +170,11 @@ public:
      */
     bool systrayUseMonoIcons() const;
 
+    /**
+     * @brief Where to check for new Updates.
+     */
+    virtual QString updateCheckUrl() const;
+
 protected:
     QIcon themeIcon(const QString& name, bool sysTray = false) const;
     Theme() {}
diff --git a/src/mirall/updatedetector.cpp b/src/mirall/updatedetector.cpp
index 42be36d..3419233 100644
--- a/src/mirall/updatedetector.cpp
+++ b/src/mirall/updatedetector.cpp
@@ -41,8 +41,7 @@ void UpdateDetector::versionCheck( Theme *theme )
 {
     connect(_accessManager, SIGNAL(finished(QNetworkReply*)), this,
             SLOT(slotVersionInfoArrived(QNetworkReply*)) );
-    QUrl url(QLatin1String("https://download.owncloud.com/clientupdater.php"));
-    QString ver = QString::fromLatin1("%1.%2.%3").arg(MIRALL_VERSION_MAJOR).arg(MIRALL_VERSION_MINOR).arg(MIRALL_VERSION_MICRO);
+    QUrl url(Theme::instance()->updateCheckUrl());
 
     QString platform = QLatin1String("stranger");
 #ifdef Q_OS_LINUX
@@ -60,7 +59,8 @@ void UpdateDetector::versionCheck( Theme *theme )
     if( !sysInfo.isEmpty() ) {
         url.addQueryItem(QLatin1String("client"), sysInfo );
     }
-    url.addQueryItem( QLatin1String("version"), ver );
+    url.addQueryItem( QLatin1String("version"),
+                      QLatin1String(MIRALL_STRINGIFY(MIRALL_VERSION_FULL)) );
     url.addQueryItem( QLatin1String("platform"), platform );
     url.addQueryItem( QLatin1String("oem"), theme->appName() );
 
@@ -99,9 +99,6 @@ QString UpdateDetector::getSystemInfo()
 
 void UpdateDetector::showDialog()
 {
-    // if the version tag is set, there is a newer version.
-    QString ver = QString::fromLatin1("%1.%2.%3")
-            .arg(MIRALL_VERSION_MAJOR).arg(MIRALL_VERSION_MINOR).arg(MIRALL_VERSION_MICRO);
     QDialog *msgBox = new QDialog;
 
     QIcon info = msgBox->style()->standardIcon(QStyle::SP_MessageBoxInformation, 0, 0);
@@ -121,7 +118,8 @@ void UpdateDetector::showDialog()
     QLabel *lbl = new QLabel;
     QString txt = tr("<p>A new version of the %1 Client is available.</p>"
                      "<p><b>%2</b> is available for download. The installed version is %3.<p>")
-            .arg(Theme::instance()->appNameGUI()).arg(ocClient.versionstring()).arg(ver);
+            .arg(Theme::instance()->appNameGUI()).arg(ocClient.versionstring())
+            .arg(QLatin1String(MIRALL_STRINGIFY(MIRALL_VERSION_FULL)));
 
     lbl->setText(txt);
     lbl->setTextFormat(Qt::RichText);
diff --git a/src/mirall/version.h.in b/src/mirall/version.h.in
index 7e2cd66..e661bd9 100644
--- a/src/mirall/version.h.in
+++ b/src/mirall/version.h.in
@@ -19,17 +19,22 @@
 #define MIRALL_TOSTRING(s) #s
 
 /* MIRALL version macros */
-#define MIRALL_VERSION_INT_(a, b, c) ((a) << 16 | (b) << 8 | (c))
+#define MIRALL_VERSION_INT_(a, b, c, d) ((a) << 24 | (b) << 16 | (c << 8) | (d))
 
 /* MIRALL version */
-#define MIRALL_VERSION_MAJOR  @VERSION_MAJOR@ 
-#define MIRALL_VERSION_MINOR  @VERSION_MINOR@
-#define MIRALL_VERSION_MICRO  @VERSION_PATCH@
-#define MIRALL_VERSION        @VERSION@
+#define MIRALL_VERSION_MAJOR @MIRALL_VERSION_MAJOR@
+#define MIRALL_VERSION_MINOR @MIRALL_VERSION_MINOR@
+#define MIRALL_VERSION_PATCH @MIRALL_VERSION_PATCH@
+#define MIRALL_VERSION_BUILD @MIRALL_VERSION_BUILD@
+
+#define MIRALL_VERSION       @MIRALL_VERSION@
+#define MIRALL_VERSION_FULL  @MIRALL_VERSION_FULL@
+
+#define MIRALL_VERSION_STRING "@MIRALL_VERSION_STRING@"
 
 #define MIRALL_VERSION_INT MIRALL_VERSION_INT_(MIRALL_VERSION_MAJOR, \
                                            MIRALL_VERSION_MINOR, \
-                                           MIRALL_VERSION_MICRO)
-
+                                           MIRALL_VERSION_PATCH, \
+                                           MIRALL_VERSION_BUILD)
 
 #endif // VERSION_H

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list