Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: tools/apps/update_homebrew/bin/update_homebrew.dart

Issue 1160383002: update_homebrew: support version-formatted revisions (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/apps/update_homebrew/bin/update_homebrew.dart
diff --git a/tools/apps/update_homebrew/bin/update_homebrew.dart b/tools/apps/update_homebrew/bin/update_homebrew.dart
index dfdf41fff81c18931e754654978db7f5dea23f6c..7e21db92645214140f3be747d569a7f1da9690b7 100644
--- a/tools/apps/update_homebrew/bin/update_homebrew.dart
+++ b/tools/apps/update_homebrew/bin/update_homebrew.dart
@@ -33,7 +33,8 @@ const DARTIUM_FILES = const [
final FILES = []..addAll(SDK_FILES)..addAll(DARTIUM_FILES);
-Future<String> getHash256(String channel, int revision, String download) async {
+Future<String> getHash256(
+ String channel, String revision, String download) async {
var client = new http.Client();
try {
var api = new storage.StorageApi(client);
@@ -48,7 +49,7 @@ Future<String> getHash256(String channel, int revision, String download) async {
}
}
-Future<String> getVersion(String channel, int revision) async {
+Future<String> getVersion(String channel, String revision) async {
var client = new http.Client();
try {
var api = new storage.StorageApi(client);
@@ -68,7 +69,16 @@ Future setCurrentRevisions(Map revisions) async {
var lines = await (new File('$repository/dart.rb')).readAsLines();
for (var channel in CHANNELS) {
- final regExp = new RegExp('channels/$channel/release/(\\d*)/sdk');
+ /// This RegExp between release/ and /sdk matches
+ /// * 1 digit followed by
+ /// * Any number of letters, numbers, dashes and dots
+ /// This covers both numeric- and version-formatted revisions
+ ///
+ /// Note: all of the regexp escape slashes `\` are double-escaped within the
+ /// Dart string
+ final regExp =
+ new RegExp('channels/$channel/release/(\\d[\\w\\d\\-\\.]*)/sdk');
+
revisions[channel] =
regExp.firstMatch(lines.firstWhere(regExp.hasMatch)).group(1);
}
@@ -87,7 +97,7 @@ Future setHashes(Map revisions, Map hashes) {
return Future.wait(waitOn);
}
-Future writeHomebrewInfo(String channel, int revision) async {
+Future writeHomebrewInfo(String channel, String revision) async {
var revisions = {};
var hashes = {};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698