Skip to content

Commit d11f5b8

Browse files
committedFeb 9, 2018
travis: Small output fixes to prebuilt list script.
1 parent 31d5c60 commit d11f5b8

File tree

1 file changed

+30
-17
lines changed

1 file changed

+30
-17
lines changed
 

‎.travis/generate-prebuilt-list.py

+30-17
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
'--gh-user', default=os.getenv('GH_USER', None))
3939
parser.add_argument(
4040
'--gh-token', default=os.getenv('GH_TOKEN', None))
41+
parser.add_argument(
42+
'--outdir', default=os.getenv('OUTDIR', None))
4143
args = parser.parse_args()
4244

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

69+
print()
70+
print("Looking at cpu '{}' in target '{}' for platform '{}' from '{}/{}'".format(
71+
args.full_cpu, args.target, args.full_platform, args.owner, args.repo))
72+
print()
73+
print("-"*75)
74+
print()
75+
6776
revs_data = subprocess.check_output(
6877
"svn list {} {}".format(svn_args, svn_base_url).split()).decode('utf-8')
6978

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

135-
print()
136-
print("Looking at cpu '{}' in target '{}' for platform '{}' from '{}/{}'".format(
137-
args.full_cpu, args.target, args.full_platform, args.owner, args.repo))
138-
print()
139-
140144
channels = {}
141145

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

171175
# Download the gh-pages branch of the HDMI2USB-firmware-prebuilt repo
172-
tmpdir = tempfile.mkdtemp()
176+
if args.outdir is None:
177+
tmpdir = tempfile.mkdtemp()
178+
else:
179+
tmpdir = args.outdir
180+
181+
os.makedirs(tmpdir, exist_ok=True)
173182
print("Using {}".format(tmpdir))
174183
print()
175184

176185
os.chdir(tmpdir)
177186
print("Download github pages repo...")
178-
subprocess.check_call(
179-
"svn checkout {} -q {}".format(svn_args, pre_base_url).split())
187+
if not os.path.exists("gh-pages"):
188+
subprocess.check_call(
189+
"svn checkout {} -q {}".format(svn_args, pre_base_url).split())
180190
print("Done.")
181191
print("")
182192
os.chdir("gh-pages")
@@ -231,19 +241,22 @@ def get_sha256sum(rev, full_platform, target, full_cpu, svn_args=svn_args, svn_b
231241
changes = subprocess.check_output("svn status -u --depth infinity".split(), stderr=subprocess.STDOUT).decode('utf-8')
232242
print(changes)
233243
subprocess.check_call("svn diff .".split(), stderr=subprocess.STDOUT)
244+
print()
234245

235246
if len(changes.splitlines()) == 1:
236-
print("Committing changes...")
247+
print("No changes to commit...")
237248
print()
238-
sys.exit(0)
239-
240-
print()
241-
print("Committing changes...")
249+
else:
250+
print()
251+
print("Committing changes...")
242252

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

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

249259
print()
260+
print("-"*75)
261+
print("Done..")
262+
print()

0 commit comments

Comments
 (0)
Please sign in to comment.