summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-07-17 17:36:36 +0200
committerAnand Thakker <github@anandthakker.net>2018-07-20 10:58:50 -0400
commit6d7072162b764c2432c010cd463a5a2c0093d606 (patch)
tree70710d98a0fd7048f473207c9ef16c75f4ad8d52 /scripts
parent1985b893b7c50f56e10ecc07776d60103a5a3e5b (diff)
downloadqtlocation-mapboxgl-6d7072162b764c2432c010cd463a5a2c0093d606.tar.gz
[build] add nitpick step for verifying that dependencies are up-to-date and unmodifiedupstream/vendor-gtest
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/nitpick/vendoring.js38
-rwxr-xr-xscripts/vendor/common.sh5
2 files changed, 41 insertions, 2 deletions
diff --git a/scripts/nitpick/vendoring.js b/scripts/nitpick/vendoring.js
new file mode 100755
index 0000000000..07f39ddbc8
--- /dev/null
+++ b/scripts/nitpick/vendoring.js
@@ -0,0 +1,38 @@
+#!/usr/bin/env node
+const nitpick = require('.');
+const fs = require('fs');
+const {execSync} = require('child_process');
+
+const head = process.env['CIRCLE_SHA1'];
+const mergeBase = process.env['CIRCLE_MERGE_BASE'];
+if (!mergeBase) {
+ console.log('No merge base available.');
+ return;
+}
+
+const checkAll = process.argv.indexOf('--check-all') >= 2;
+
+// Run the vendoring script for all vendored packages that were modified in this PR, and check for changes.
+fs.readdirSync('vendor')
+ .filter(name => name[0] != '.')
+ .filter(name => fs.statSync(`vendor/${name}`).isDirectory())
+ .filter(name => checkAll || execSync(`git diff --shortstat ${mergeBase} ${head} -- vendor/${name}`).toString().trim())
+ .forEach(name => {
+ execSync(`scripts/vendor/${name}.sh`);
+
+ // List missing files
+ var missing = execSync(`git ls-files --others --exclude-standard -- vendor/${name}`).toString().trim();
+ if (!missing.length) {
+ nitpick.ok(`All files vendored for ${name} are checked in`);
+ } else {
+ nitpick.fail(`These vendored files for ${name} are not checked in:`, missing);
+ }
+
+ // Diff existing files
+ const diff = execSync(`git -c color.ui=always diff -- vendor/${name}`).toString().trim();
+ if (!diff.length) {
+ nitpick.ok(`All files vendored for ${name} are unmodified`);
+ } else {
+ nitpick.fail(`These vendored files for ${name} have modifications:`, diff);
+ }
+ });
diff --git a/scripts/vendor/common.sh b/scripts/vendor/common.sh
index 3679152218..680211bfcc 100755
--- a/scripts/vendor/common.sh
+++ b/scripts/vendor/common.sh
@@ -23,9 +23,10 @@ function init {
function extract {
echo ">> Unpacking files from $VENDOR/.cache/$NAME-$VERSION.tar.gz..."
- tar xzf "$VENDOR/.cache/$NAME-$VERSION.tar.gz" --strip-components=${STRIP_COMPONENTS:-1} -C "$VENDOR/$NAME" $@
+ [ ! -z "$(tar --version | grep "GNU tar")" ] && WC="--wildcards" || WC=""
+ tar xzf "$VENDOR/.cache/$NAME-$VERSION.tar.gz" $WC --strip-components=${STRIP_COMPONENTS:-1} -C "$VENDOR/$NAME" $@
}
function file_list {
- (cd "$VENDOR/$NAME" && find $@ | sort > "$VENDOR/$NAME/files.txt")
+ (cd "$VENDOR/$NAME" && find $@ | LC_ALL=C sort > "$VENDOR/$NAME/files.txt")
}