cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject cordova-coho git commit: CB-13183 - Use .sha512 extension instead of .sha for releases
Date Wed, 16 Aug 2017 17:48:12 GMT
Repository: cordova-coho
Updated Branches:
  refs/heads/master ef455c7ee -> cdec4018b


CB-13183 - Use .sha512 extension instead of .sha for releases


Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/cdec4018
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/cdec4018
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/cdec4018

Branch: refs/heads/master
Commit: cdec4018b5aeb76afaac840672be79715c93f2a4
Parents: ef455c7
Author: Shazron Abdullah <shazron@gmail.com>
Authored: Wed Aug 16 10:48:05 2017 -0700
Committer: Shazron Abdullah <shazron@gmail.com>
Committed: Wed Aug 16 10:48:05 2017 -0700

----------------------------------------------------------------------
 src/create-verify-archive.js | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/cdec4018/src/create-verify-archive.js
----------------------------------------------------------------------
diff --git a/src/create-verify-archive.js b/src/create-verify-archive.js
index a426e1b..f2d2e7d 100644
--- a/src/create-verify-archive.js
+++ b/src/create-verify-archive.js
@@ -127,7 +127,7 @@ function *createArchive(repo, tag, outDir, sign) {
     if (sign) {
         yield executil.execHelper(executil.ARGS('gpg --armor --detach-sig --output', outPath
+ '.asc', outPath), false, false);
         fs.writeFileSync(outPath + '.md5', (yield computeHash(outPath, 'MD5')) + '\n');
-        fs.writeFileSync(outPath + '.sha', (yield computeHash(outPath, 'SHA512')) + '\n');
+        fs.writeFileSync(outPath + '.sha512', (yield computeHash(outPath, 'SHA512')) + '\n');
     }
     return outPath;
 }
@@ -177,7 +177,15 @@ function *verifyArchive(archive) {
         apputil.fatal('MD5 does not match.');
     }
     var sha = yield computeHash(archive, 'SHA512');
-    if (extractHashFromOutput(fs.readFileSync(archive + '.sha', 'utf8')) !== sha) {
+    var archiveFileName = archive + '.sha512';
+    var oldArchiveFileName = archive + '.sha';
+    
+    if (fs.existsSync(oldArchiveFileName) && !fs.existsSync(archiveFileName)) {
+        print('Old .sha extension found, this might have been generated by an old cordova-coho
version.');
+        archiveFileName = oldArchiveFileName;
+    }
+
+    if (extractHashFromOutput(fs.readFileSync(archiveFileName, 'utf8')) !== sha) {
         apputil.fatal('SHA512 does not match.');
     }
     print(archive + chalk.green(' signature and hashes verified.'));


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message