Skip to content

Commit

Permalink
travis: Small output fixes to prebuilt list script.
Browse files Browse the repository at this point in the history
  • Loading branch information
mithro committed Feb 9, 2018
1 parent 31d5c60 commit d11f5b8
Showing 1 changed file with 30 additions and 17 deletions.
47 changes: 30 additions & 17 deletions .travis/generate-prebuilt-list.py
Expand Up @@ -38,6 +38,8 @@
'--gh-user', default=os.getenv('GH_USER', None))
parser.add_argument(
'--gh-token', default=os.getenv('GH_TOKEN', None))
parser.add_argument(
'--outdir', default=os.getenv('OUTDIR', None))
args = parser.parse_args()

assert args.repo
Expand All @@ -64,6 +66,13 @@
svn_args = '--non-interactive --username {} --password {}'.format(
args.gh_user, args.gh_token)

print()
print("Looking at cpu '{}' in target '{}' for platform '{}' from '{}/{}'".format(
args.full_cpu, args.target, args.full_platform, args.owner, args.repo))
print()
print("-"*75)
print()

revs_data = subprocess.check_output(
"svn list {} {}".format(svn_args, svn_base_url).split()).decode('utf-8')

Expand Down Expand Up @@ -132,11 +141,6 @@ def get_sha256sum(rev, full_platform, target, full_cpu, svn_args=svn_args, svn_b
_get_sha256sum_cache[full_path] = data
return data

print()
print("Looking at cpu '{}' in target '{}' for platform '{}' from '{}/{}'".format(
args.full_cpu, args.target, args.full_platform, args.owner, args.repo))
print()

channels = {}

# Find the unstable revision
Expand Down Expand Up @@ -169,14 +173,20 @@ def get_sha256sum(rev, full_platform, target, full_cpu, svn_args=svn_args, svn_b
print()

# Download the gh-pages branch of the HDMI2USB-firmware-prebuilt repo
tmpdir = tempfile.mkdtemp()
if args.outdir is None:
tmpdir = tempfile.mkdtemp()
else:
tmpdir = args.outdir

os.makedirs(tmpdir, exist_ok=True)
print("Using {}".format(tmpdir))
print()

os.chdir(tmpdir)
print("Download github pages repo...")
subprocess.check_call(
"svn checkout {} -q {}".format(svn_args, pre_base_url).split())
if not os.path.exists("gh-pages"):
subprocess.check_call(
"svn checkout {} -q {}".format(svn_args, pre_base_url).split())
print("Done.")
print("")
os.chdir("gh-pages")
Expand Down Expand Up @@ -231,19 +241,22 @@ def get_sha256sum(rev, full_platform, target, full_cpu, svn_args=svn_args, svn_b
changes = subprocess.check_output("svn status -u --depth infinity".split(), stderr=subprocess.STDOUT).decode('utf-8')
print(changes)
subprocess.check_call("svn diff .".split(), stderr=subprocess.STDOUT)
print()

if len(changes.splitlines()) == 1:
print("Committing changes...")
print("No changes to commit...")
print()
sys.exit(0)

print()
print("Committing changes...")
else:
print()
print("Committing changes...")

with tempfile.NamedTemporaryFile() as f:
f.write("Updating channels (in Travis build {})\n".format(os.getenv("TRAVIS_BUILD_NUMBER", "None")).encode('utf-8'))
f.flush()
with tempfile.NamedTemporaryFile() as f:
f.write("Updating channels (in Travis build {})\n".format(os.getenv("TRAVIS_BUILD_NUMBER", "None")).encode('utf-8'))
f.flush()

subprocess.check_call("svn commit {} --file {}".format(svn_args, f.name).split())
subprocess.check_call("svn commit {} --file {}".format(svn_args, f.name).split())

print()
print("-"*75)
print("Done..")
print()

0 comments on commit d11f5b8

Please sign in to comment.