Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Köplinger <alex.koeplinger@outlook.com>2015-10-19 17:02:46 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2015-10-19 18:14:47 +0300
commit51f95c3b9107875eef83f78186e2ca90c05eec32 (patch)
tree5c55948542e6ff8fb5c6fa534b23f060a1ccc450 /acceptance-tests
parent0ec96b12419f63da50719118820a028eb256baaa (diff)
[acceptance-tests] Convert Ruby script to Python
Most of the other scripts in the repo use Python and we decided to converge on that one.
Diffstat (limited to 'acceptance-tests')
-rw-r--r--acceptance-tests/Makefile.am2
-rw-r--r--acceptance-tests/SUBMODULES.json40
-rw-r--r--acceptance-tests/versions.mk16
-rwxr-xr-xacceptance-tests/versions.py52
-rwxr-xr-xacceptance-tests/versions.rb61
5 files changed, 81 insertions, 90 deletions
diff --git a/acceptance-tests/Makefile.am b/acceptance-tests/Makefile.am
index 187ecce99c0..4e75d485aac 100644
--- a/acceptance-tests/Makefile.am
+++ b/acceptance-tests/Makefile.am
@@ -5,7 +5,7 @@ MSTESTSUITE_PATH=$(TOP)/../ms-test-suite
include versions.mk
-EXTRA_DISTFILES=README.md SUBMODULES.json versions.mk versions.rb
+EXTRA_DISTFILES=README.md SUBMODULES.json versions.mk versions.py
check: check-roslyn check-coreclr check-ms-test-suite
diff --git a/acceptance-tests/SUBMODULES.json b/acceptance-tests/SUBMODULES.json
index 9aa4494fab2..088dd65cef6 100644
--- a/acceptance-tests/SUBMODULES.json
+++ b/acceptance-tests/SUBMODULES.json
@@ -1,26 +1,26 @@
[
{
- "name": "roslyn",
- "directory": "roslyn",
- "url": "git://github.com/dotnet/roslyn.git",
- "branch": "master",
- "remote-branch": "origin/master",
- "rev": "2e68ae5e6ec51762296c681aadf57a6f33f2f34f"
- },
+ "name": "roslyn",
+ "url": "git://github.com/dotnet/roslyn.git",
+ "rev": "2e68ae5e6ec51762296c681aadf57a6f33f2f34f",
+ "remote-branch": "origin/master",
+ "branch": "master",
+ "directory": "roslyn"
+ },
{
- "name": "coreclr",
- "directory": "coreclr",
- "url": "git://github.com/dotnet/coreclr.git",
- "branch": "master",
- "remote-branch": "origin/master",
- "rev": "b9920ebea8d8d77b65d0ca10ffdb840f0cd36f06"
- },
+ "name": "coreclr",
+ "url": "git://github.com/dotnet/coreclr.git",
+ "rev": "b9920ebea8d8d77b65d0ca10ffdb840f0cd36f06",
+ "remote-branch": "origin/master",
+ "branch": "master",
+ "directory": "coreclr"
+ },
{
- "name": "ms-test-suite",
- "directory": "ms-test-suite",
- "url": "git@github.com:xamarin/ms-test-suite.git",
- "branch": "master",
- "remote-branch": "origin/master",
- "rev": "4caab98ae449836c2aaacb9748fe0c796b71517f"
+ "name": "ms-test-suite",
+ "url": "git@github.com:xamarin/ms-test-suite.git",
+ "rev": "4caab98ae449836c2aaacb9748fe0c796b71517f",
+ "remote-branch": "origin/master",
+ "branch": "master",
+ "directory": "ms-test-suite"
}
] \ No newline at end of file
diff --git a/acceptance-tests/versions.mk b/acceptance-tests/versions.mk
index 3d869cf156a..3a16bce02d7 100644
--- a/acceptance-tests/versions.mk
+++ b/acceptance-tests/versions.mk
@@ -7,11 +7,11 @@ CONFIG=SUBMODULES.json
define ValidateVersionTemplate
#$(eval REPOSITORY_$(2):=$(shell test -z $(3) && echo $(1) || echo "$(3)"))
-#$(eval DIRECTORY_$(2):=$(shell ruby versions.rb get-dir $(1)))
+#$(eval DIRECTORY_$(2):=$(shell python versions.py get-dir $(1)))
#$(eval DIRECTORY_$(2):=$(shell test -z $(DIRECTORY_$(2)) && echo $(1) || echo $(DIRECTORY_$(2))))
-#$(eval MODULE_$(2):=$(shell ruby versions.rb get-url $(1)))
-#$(eval NEEDED_$(2)_VERSION:=$(shell ruby versions.rb get-rev $(1)))
-#$(eval $(2)_BRANCH_AND_REMOTE:=$(shell ruby versions.rb get-remote-branch $(1)))
+#$(eval MODULE_$(2):=$(shell python versions.py get-url $(1)))
+#$(eval NEEDED_$(2)_VERSION:=$(shell python versions.py get-rev $(1)))
+#$(eval $(2)_BRANCH_AND_REMOTE:=$(shell python versions.py get-remote-branch $(1)))
#$(eval $(2)_VERSION:=$$$$(shell cd $($(2)_PATH) 2>/dev/null && git rev-parse HEAD ))
@@ -108,21 +108,21 @@ reset:
__bump-version-%:
@if [ "$(REV)" = "" ]; then echo "Usage: make bump-version-$* REV=<ref>"; exit 1; fi
@if [ "$(COMMIT)" = "1" ]; then git pull; fi
- ruby versions.rb set-rev $* $(REV)
+ python versions.py set-rev $* $(REV)
@if [ "$(COMMIT)" = "1" ]; then echo "Bump $* to pick up $(REV)." | git commit -F - $(CONFIG); fi
__bump-branch-%:
@if [ "$(BRANCH)" = "" ]; then echo "Usage: make bump-branch-$* BRANCH=<branch> REMOTE_BRANCH=<remote branch>"; exit 1; fi
@if [ "$(REMOTE_BRANCH)" == "" ]; then echo "Usage: make bump-branch-$* BRANCH=<branch> REMOTE_BRANCH=<remote branch>"; exit 1; fi
@if [ "$(COMMIT)" = "1" ]; then git pull; fi
- ruby versions.rb set-branch $* $(BRANCH)
- ruby versions.rb set-remote-branch $* $(REMOTE_BRANCH)
+ python versions.py set-branch $* $(BRANCH)
+ python versions.py set-remote-branch $* $(REMOTE_BRANCH)
@if [ "$(COMMIT)" = "1" ]; then echo "Bump $* to switch to $(BRANCH) $(REMOTE BRANCH)." | git commit -F - $(CONFIG); fi
__bump-current-version-%:
@if [ "$(COMMIT)" = "1" ]; then git pull; fi
REV=$(shell cd $(TOP)/../$* && git log -1 --pretty=format:%H); \
- ruby versions.rb set-rev $* $$REV; \
+ python versions.py set-rev $* $$REV; \
if [ "$(COMMIT)" = "1" ]; then echo "Bump $* to pick up $$REV:" | git commit -F - $(CONFIG); fi
# Bump the given submodule to the revision given by the REV make variable
diff --git a/acceptance-tests/versions.py b/acceptance-tests/versions.py
new file mode 100755
index 00000000000..5fff4f18f38
--- /dev/null
+++ b/acceptance-tests/versions.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+
+import sys
+import json
+
+def find_module(submodules, name):
+ for item in submodules:
+ if item["name"] == name:
+ return item
+
+ print "Not found"
+ sys.exit(1)
+
+
+if len(sys.argv) < 2:
+ print "Usage: versions.py <command>"
+ sys.exit(1)
+
+CONFIG_FILE = "SUBMODULES.json"
+command = sys.argv[1]
+
+submodules = json.load(open(CONFIG_FILE))
+
+if command == "get-rev":
+ mod = find_module(submodules, sys.argv[2])
+ print mod["rev"]
+elif command == "get-url":
+ mod = find_module(submodules, sys.argv[2])
+ print mod["url"]
+elif command == "get-dir":
+ mod = find_module(submodules, sys.argv[2])
+ print mod["directory"]
+elif command == "get-remote-branch":
+ mod = find_module(submodules, sys.argv[2])
+ print mod["remote-branch"]
+elif command == "set-rev":
+ mod = find_module(submodules, sys.argv[2])
+ mod["rev"] = sys.argv[3]
+ json.dump(submodules, open(CONFIG_FILE, "w"), indent = 2)
+elif command == "set-branch":
+ mod = find_module(submodules, sys.argv[2])
+ mod["branch"] = sys.argv[3]
+ json.dump(submodules, open(CONFIG_FILE, "w"), indent = 2)
+elif command == "set-remote-branch":
+ mod = find_module(submodules, sys.argv[2])
+ mod["remote-branch"] = sys.argv[3]
+ json.dump(submodules, open(CONFIG_FILE, "w"), indent = 2)
+elif command == "cat":
+ print json.dumps(submodules, indent = 2)
+else:
+ print "Unknown command "" + command + ""."
+ sys.exit(1)
diff --git a/acceptance-tests/versions.rb b/acceptance-tests/versions.rb
deleted file mode 100755
index ff43d7344da..00000000000
--- a/acceptance-tests/versions.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'optparse'
-require 'json'
-
-def find_module(submodules, name)
- mod = submodules.find { |m| m['name'] == name }
- if mod == nil
- # FIXME:
- puts "Not found"
- exit 1
- end
- return mod
-end
-
-if ARGV.length < 1 then
- puts "Usage: versions.rb <command>"
- exit(1)
-end
-
-command = ARGV[0]
-
-submodules = JSON.parse(File.read("SUBMODULES.json"))
-
-case command
-when "get-rev"
- mod = find_module(submodules, ARGV[1])
- puts mod['rev']
-when "get-url"
- mod = find_module(submodules, ARGV[1])
- puts mod['url']
-when "get-dir"
- mod = find_module(submodules, ARGV[1])
- puts mod['directory']
-when "get-remote-branch"
- mod = find_module(submodules, ARGV[1])
- puts mod['remote-branch']
-when "set-rev"
- mod = find_module(submodules, ARGV[1])
- mod['rev'] = ARGV[2]
- f = File.new("SUBMODULES.json", "w")
- f.write(JSON.pretty_generate(submodules))
- f.close()
-when "set-branch"
- mod = find_module(submodules, ARGV[1])
- mod['branch'] = ARGV[2]
- f = File.new("SUBMODULES.json", "w")
- f.write(JSON.pretty_generate(submodules))
- f.close()
-when "set-remote-branch"
- mod = find_module(submodules, ARGV[1])
- mod['remote-branch'] = ARGV[2]
- f = File.new("SUBMODULES.json", "w")
- f.write(JSON.pretty_generate(submodules))
- f.close()
-when "cat"
- puts JSON.pretty_generate(submodules)
-else
- puts "Unknown command '#{command}'."
- exit 1
-end