summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-11-17 11:07:38 (GMT)
committerTobias Markmann <tm@ayena.de>2016-11-17 14:13:56 (GMT)
commitdd6f025037faa6b946d71bbd21c729a931178176 (patch)
tree1dfc992571d6361b4b1641dbd16bd9159934660d
parent8743d5714244a63d301d73fca622f648ac374771 (diff)
downloadswift-dd6f025037faa6b946d71bbd21c729a931178176.zip
swift-dd6f025037faa6b946d71bbd21c729a931178176.tar.bz2
Fix version strings generated by GenerateAppCastFeeds.py
Check for updates on start. Test-Information: Manually verified a random sample of 50 Swift version string pairs, that Sparkle currently compares them and detects the new version. Change-Id: Ic88a5fdc5feab42cdcb4cc3c2740d4c24718eb7b
-rwxr-xr-xBuildTools/GenerateAppCastFeeds.py24
-rw-r--r--SwifTools/AutoUpdater/SparkleAutoUpdater.mm2
2 files changed, 14 insertions, 12 deletions
diff --git a/BuildTools/GenerateAppCastFeeds.py b/BuildTools/GenerateAppCastFeeds.py
index 204961b..8135134 100755
--- a/BuildTools/GenerateAppCastFeeds.py
+++ b/BuildTools/GenerateAppCastFeeds.py
@@ -16,8 +16,10 @@ import urlparse
class Release:
def __init__(self, version, absoluteURL, sizeInBytes, date):
- self.version = version
- self.shortVersion = version.split('-', 1)[1]
+ # This is the version string used for update detection.
+ self.fullVersion = version.split('-', 1)[1]
+ # This is a human readable version string, only used for presentation.
+ self.presentationVersion = version
self.url = absoluteURL
self.sizeInBytes = sizeInBytes
self.date = date
@@ -26,10 +28,10 @@ class Release:
self.dateString = eut.formatdate(dateTimestamp)
def __str__(self):
- return "Release(%s, %s, %s, %s)" % (self.version, self.url, self.sizeInBytes, self.date)
+ return "Release(%s, %s, %s, %s)" % (self.fullVersion, self.url, self.sizeInBytes, self.date)
def __repr__(self):
- return "Release(%s, %s, %s, %s)" % (self.version, self.url, self.sizeInBytes, self.date)
+ return "Release(%s, %s, %s, %s)" % (self.fullVersion, self.url, self.sizeInBytes, self.date)
def getReleaseFromAbsoluteFilePath(absolutePath, downloadsFolder, releasesURL):
version = os.path.splitext(absolutePath.split('/')[-1])[0]
@@ -84,18 +86,18 @@ def writeAppcastFile(filename, title, description, regexPattern, appcastURL, rel
<description>{{ description }}</description>
<language>en</language>
{% for item in releases %}<item>
- <title>Swift version {{ item.version }}</title>
+ <title>Swift version {{ item.fullVersion }}</title>
<pubDate>{{ item.dateString }}</pubDate>
<enclosure url="{{ item.url }}"
- sparkle:version="{{ item.version }}"
- sparkle:shortVersionString="{{ item.shortVersion }}"
+ sparkle:version="{{ item.fullVersion }}"
+ sparkle:shortVersionString="{{ item.presentationVersion }}"
length="{{ item.sizeInBytes }}"
type="application/octet-stream" />
</item>
{% endfor %}</channel>
</rss>''')
- matchingReleases = [i for i in releases if re.match(regexPattern, i.version)]
+ matchingReleases = [i for i in releases if re.match(regexPattern, i.fullVersion)]
matchingReleases = matchingReleases[:2] # only include the first two matches in the appcast
appcastContent = template.render(title=title, appcast_url=appcastURL, description=description, releases=matchingReleases)
@@ -134,18 +136,18 @@ automaticReleases.sort(key=lambda release: release.date, reverse=True)
writeAppcastFile(filename=os.path.join(args.outputFolder, "swift-stable-appcast-mac.xml"),
title="Swift Stable Releases",
description="",
- regexPattern="^Swift\-\d+(\.\d+)?(\.\d+)?$",
+ regexPattern="^\d+(\.\d+)?(\.\d+)?$",
appcastURL=urlparse.urljoin(args.downloadsURL, "swift-stable-appcast-mac.xml"),
releases=manualReleases)
writeAppcastFile(filename=os.path.join(args.outputFolder, "swift-testing-appcast-mac.xml"),
title="Swift Testing Releases",
description="",
- regexPattern="^Swift\-\d+(\.\d+)?(\.\d+)?(beta\d+)?(rc\d+)?$",
+ regexPattern="^\d+(\.\d+)?(\.\d+)?(beta\d+)?(rc\d+)?$",
appcastURL=urlparse.urljoin(args.downloadsURL, "swift-testing-appcast-mac.xml"),
releases=manualReleases)
writeAppcastFile(filename=os.path.join(args.outputFolder, "swift-development-appcast-mac.xml"),
title="Swift Development Releases",
description="",
- regexPattern="^Swift\-\d+(\.\d+)?(\.\d+)?(alpha)?(beta\d+)?(rc\d+)?(-dev\d+)?$",
+ regexPattern="^\d+(\.\d+)?(\.\d+)?(alpha)?(beta\d+)?(rc\d+)?(-dev\d+)?$",
appcastURL=urlparse.urljoin(args.downloadsURL, "swift-development-appcast-mac.xml"),
releases=automaticReleases)
diff --git a/SwifTools/AutoUpdater/SparkleAutoUpdater.mm b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm
index ed5f094..0c296ee 100644
--- a/SwifTools/AutoUpdater/SparkleAutoUpdater.mm
+++ b/SwifTools/AutoUpdater/SparkleAutoUpdater.mm
@@ -51,7 +51,7 @@ void SparkleAutoUpdater::setAppcastFeed(const std::string& appcastFeed) {
}
void SparkleAutoUpdater::checkForUpdates() {
- //[d->updater resetUpdateCycle]; // This is useful for testing to force a check ot start.
+ [d->updater resetUpdateCycle];
[d->updater checkForUpdatesInBackground];
}