www/adium.im 771:b29a309f1692: Adding wixardy's work on getting ...

commits at adium.im commits at adium.im
Fri Jun 14 10:56:06 UTC 2013


details:	http://hg.adium.im/www/adium.im/rev/b29a309f1692
revision:	771:b29a309f1692
branch:		adiumx.com
author:		Thijs Alkemade <me at thijsalkema.de>
date:		Fri Jun 14 12:55:42 2013 +0200

Adding wixardy's work on getting Sparkle-deltas to work with nightlies.

diffs (93 lines):

diff -r 6477b87bd2de -r b29a309f1692 sparkle/appcast-nightly.php
--- a/sparkle/appcast-nightly.php	Wed Jun 12 14:04:11 2013 +0200
+++ b/sparkle/appcast-nightly.php	Fri Jun 14 12:55:42 2013 +0200
@@ -39,6 +39,7 @@
     define("NIGHTLY_DOMAIN", "nightly.adium.im");        
     // The remote file name which contains the current build's information.
     define("NIGHTLY_REMOTE_NAME", "latest.info");
+    define("NIGHTLY_DELTA_NAME", "latestDelta.info");
     // The interval in seconds to check the remote file.
     define("UPDATE_INTERVAL", 60*15);
     
@@ -51,6 +52,7 @@
     define("NIGHTLY_HOST", sprintf("%s/$repo_branch/", NIGHTLY_DOMAIN));
     // The location to cache the remote file.
     define("NIGHTLY_CACHE", $config["cachedgraphs"] . "/nightly-$repo_branch-cache.dat");
+    define("DELTA_CACHE", $config["cachedgraphs"] . "/delta-$repo_branch-cache.dat");
 
     // Offsets by line in the build file:
     define("FILENAME", 0);
@@ -59,6 +61,11 @@
     define("SIZE", 3);
     define("VERSION", 4);
     define("DSA", 5);
+    // Offsets for the delta file:
+    define("dREVISION", 0);
+    define("dVERSION", 1);
+    define("dSIZE", 1);
+    define("dFILENAME", 2);
     
     // Update from the remote file if it's out of date or nonexistant.
     if ((!is_file(NIGHTLY_CACHE) || (($stat = stat(NIGHTLY_CACHE)) && ($stat[10]+UPDATE_INTERVAL <= time())))) {
@@ -68,6 +75,11 @@
         // Don't push nothing in.
         if ($contents) {
             @file_put_contents(NIGHTLY_CACHE, $contents);
+            // Look for a delta file for this update.
+            $deltas = @file_get_contents(sprintf("http://%s/%s", NIGHTLY_HOST, NIGHTLY_DELTA_NAME));
+            if ($deltas) {
+                @file_put_contents(DELTA_CACHE, $deltas);
+            }
         }
     }
     
@@ -80,6 +92,8 @@
     // The address for the changelog.
     $tracURL = sprintf("http://hg.adium.im/$repo/log?rev=%s", str_replace("r", "", $nightlyData[REVISION]));
 
+    $deltaData = explode("\n", file_get_contents(DELTA_CACHE));
+
 ?><?php echo('<?');?>xml version="1.0" encoding="UTF-8"?>
 <rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
   <channel>
@@ -88,7 +102,7 @@
     <item>
         <title><?=$nightlyData[FILENAME]?></title>
         <pubDate></pubDate>
-        <sparkle:releaseNotesLink><?=$tracURL?></sparkle:releaseNotesLink> 
+        <sparkle:releaseNotesLink><?=$tracURL?></sparkle:releaseNotesLink>
         <sparkle:minimumSystemVersion><?=($repo == 'adium-1.4') ? '10.5.8' : '10.6'?></sparkle:minimumSystemVersion>
         <enclosure
             sparkle:dsaSignature="<?=$nightlyData[DSA]?>"
@@ -97,6 +111,29 @@
             url="<?=$nightlyURL?>"
             length="<?=$nightlyData[SIZE]?>"
             type="application/octet-stream" />
+<?php
+    if ($deltaData) {
+        if ($nightlyData[VERSION] == $deltaData[dVERSION]) {
+                // There is a delta update file for this revision.
+?>        <sparkle:deltas>
+<?php            foreach ($deltaData as $delta) {
+                    $delta = explode(",", $delta);
+                    if (!$delta[dFILENAME])
+                        continue;
+                    
+                    $deltaURL = sprintf("http://%s/%s", NIGHTLY_HOST, $delta[dFILENAME]);
+?>
+                <enclosure url="<?=$deltaURL?>"
+                      sparkle:version="<?=$deltaData[dVERSION]?>"
+                      sparkle:deltaFrom="<?=$delta[dREVISION]?>"
+                      length="<?=$delta[dSIZE]?>"
+                      type="application/octet-stream" />
+<?php
+                }
+?>        </sparkle:deltas>
+<?php    }
+    }
+?>
     </item>
   </channel>
-</rss>
\ No newline at end of file
+</rss>




More information about the commits mailing list