Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #5 under buildscripts repository #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions check_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
'''
<Program>
check_config.py

<Purpose>
"This is a tool for developers constructing build configuration files for
SeattleTestbed repositories. After running initialize.py and build.py on
your current init/build config for your repository, this script checks for
all of the dependencies you listed whether they require further repos checked
out and files copied, and prints a message for each missing sub-dependency.
See also https://seattle.poly.edu/wiki/BuildInstructions for a description of
the SeattleTestbed build process."

<Usage>
python check_config.py

'''

import os

def read_initconfig(filename):
content =[]
for line in open(filename, 'r'):
if line.startswith('#') or line.strip() == '':
continue
content.append(line.strip())
return content

def read_buildconfig(filename, repo):
content =[]
for line in open(filename, 'r'):
if line.startswith('#') or line.strip() == '' or line.startswith('test'):
continue
if line.startswith("./"):
line = line.replace("./","DEPENDENCIES"+ os.sep + repo + os.sep)
content.append(line.strip())
return content

def main():
# Set current_repo to the name of this repository's base directory. (This should be the repo's name.)
current_repo = os.path.basename(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))

init_dependencies = read_initconfig('config_initialize.txt')
init_dependencies.append('https://github.com/SeattleTestbed/' + current_repo + ' ../DEPENDENCIES/' + current_repo)

init_result = {}
for repo in os.listdir("../DEPENDENCIES"):
if os.path.isdir("../DEPENDENCIES" + os.sep + repo):
for line in read_initconfig("../DEPENDENCIES"+ os.sep + repo + os.sep +"scripts/config_initialize.txt"):
url = line.strip()
if url not in init_dependencies:
try:
init_result[repo].append(url)
except KeyError:
init_result[repo] = [url]

print "Additionally required in config_initialize.txt\n"

for dependency,config in init_result.items():
print "# Additionally required by dependency " + dependency + ":"
for setting in config:
print setting

build_dependencies = read_buildconfig('config_build.txt',current_repo)

build_result = {}
for repo in os.listdir("../DEPENDENCIES"):
if os.path.isdir("../DEPENDENCIES" + os.sep + repo):
for line in read_buildconfig("../DEPENDENCIES"+ os.sep + repo + os.sep +"scripts/config_build.txt",repo):
if line.strip() not in build_dependencies:
try:
build_result[repo].append(line)
except KeyError:
build_result[repo] = [line]

print "\nAdditionally required in config_build.txt\n"

for dependency,config in build_result.items():
print "# Additionally required by dependency " + dependency + ":"
for setting in config:
print setting

if __name__ == '__main__':
main()