|
38 | 38 | '--gh-user', default=os.getenv('GH_USER', None))
|
39 | 39 | parser.add_argument(
|
40 | 40 | '--gh-token', default=os.getenv('GH_TOKEN', None))
|
| 41 | +parser.add_argument( |
| 42 | + '--outdir', default=os.getenv('OUTDIR', None)) |
41 | 43 | args = parser.parse_args()
|
42 | 44 |
|
43 | 45 | assert args.repo
|
|
64 | 66 | svn_args = '--non-interactive --username {} --password {}'.format(
|
65 | 67 | args.gh_user, args.gh_token)
|
66 | 68 |
|
| 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 | + |
67 | 76 | revs_data = subprocess.check_output(
|
68 | 77 | "svn list {} {}".format(svn_args, svn_base_url).split()).decode('utf-8')
|
69 | 78 |
|
@@ -132,11 +141,6 @@ def get_sha256sum(rev, full_platform, target, full_cpu, svn_args=svn_args, svn_b
|
132 | 141 | _get_sha256sum_cache[full_path] = data
|
133 | 142 | return data
|
134 | 143 |
|
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 |
| - |
140 | 144 | channels = {}
|
141 | 145 |
|
142 | 146 | # Find the unstable revision
|
@@ -169,14 +173,20 @@ def get_sha256sum(rev, full_platform, target, full_cpu, svn_args=svn_args, svn_b
|
169 | 173 | print()
|
170 | 174 |
|
171 | 175 | # 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) |
173 | 182 | print("Using {}".format(tmpdir))
|
174 | 183 | print()
|
175 | 184 |
|
176 | 185 | os.chdir(tmpdir)
|
177 | 186 | 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()) |
180 | 190 | print("Done.")
|
181 | 191 | print("")
|
182 | 192 | os.chdir("gh-pages")
|
@@ -231,19 +241,22 @@ def get_sha256sum(rev, full_platform, target, full_cpu, svn_args=svn_args, svn_b
|
231 | 241 | changes = subprocess.check_output("svn status -u --depth infinity".split(), stderr=subprocess.STDOUT).decode('utf-8')
|
232 | 242 | print(changes)
|
233 | 243 | subprocess.check_call("svn diff .".split(), stderr=subprocess.STDOUT)
|
| 244 | +print() |
234 | 245 |
|
235 | 246 | if len(changes.splitlines()) == 1:
|
236 |
| - print("Committing changes...") |
| 247 | + print("No changes to commit...") |
237 | 248 | print()
|
238 |
| - sys.exit(0) |
239 |
| - |
240 |
| -print() |
241 |
| -print("Committing changes...") |
| 249 | +else: |
| 250 | + print() |
| 251 | + print("Committing changes...") |
242 | 252 |
|
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() |
246 | 256 |
|
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()) |
248 | 258 |
|
249 | 259 | print()
|
| 260 | +print("-"*75) |
| 261 | +print("Done..") |
| 262 | +print() |
0 commit comments