Welcome, guest | Sign In | My Account | Store | Cart

this tool is used to check whether an SVM number is included in current build or not. please note that this is only for internal use.

Python, 59 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import os
import re
from urllib2 import urlopen

base_url_qacandrot = "https://qacand.sflab.ondemand.com/sf-version.properties"
base_url_qapatch = "http://qapatch.successfactors.com/sf-version.properties"
base_url_qacand = "http://qacand.successfactors.com/sf-version.properties"

# get test environment
print "Before use this tool, please make sure you connect to VPN!"
env = raw_input("Please enter your test env: qacand, qacandrot or qapatch (Non case sensitive): ")

if env.strip().lower() == "qacand":
    html_resource = urlopen(base_url_qacand).read()
elif env.strip().lower() == "qapatch":
    html_resource = urlopen(base_url_qapatch).read()
elif html_resource == "qacandrot":
    html_resource = urlopen(base_url_qacandrot).read()

module_svn_map = {}

pattern = "(.*?)-(.*?)-(.*?)sion=(\d+$)"
p = re.compile(pattern)

for strofmodule in html_resource.split():
    if re.match(pattern, strofmodule):
        results = re.findall(pattern, strofmodule)
        module = results[0][1]
        svn_number = results[0][3]
        module_svn_map[module] = svn_number
        
build_num_pattern = "com.successfactors.sf-packages.version="
build_num_len = html_resource.index(build_num_pattern) + len(build_num_pattern)
build_version = html_resource[build_num_len:]

print "build version is " + build_version, "please make sure it is same as that on " + env.strip().lower() + "."


while 1:
    build_by_module = raw_input("Is your module build by module: (y or n, Non case sensitive) ")

    if build_by_module.strip().lower() == "n":
        your_module = "V4"
        your_svn_number = raw_input("Please enter your svn number (6 digit): ")
        if int(your_svn_number) <= int(module_svn_map[your_module]):
            print "Your svn number is included in current build on " + env.strip().lower() + "."
        else:
            print "Your svn number is NOT included on " +env.strip().lower() + "."
        os.system("pause")    
    elif build_by_module.strip().lower() == "y":
        print "Please make sure your input is exactly same as one of module above!"
        your_module = raw_input("Please enter your module name: ")
        your_svn_number = raw_input("Please enter your svn number (6 digit): ")
        if your_module.strip().lower() in module_svn_map.keys():
            if int(your_svn_number) <= int(module_svn_map[your_module]):
                print "Your svn number is included in current build on " + env.strip().lower() + "."
            else:
                print "Your svn number is NOT included on " + env.strip().lower() + "."
        os.system("pause")