launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25059
[Merge] ~cjwatson/turnip:publish-swift-build-label into turnip:master
Colin Watson has proposed merging ~cjwatson/turnip:publish-swift-build-label into turnip:master.
Commit message:
Publish last-successful-build-label.txt to Swift
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/turnip/+git/turnip/+merge/387744
This makes it easier for the Mojo spec to find the most recently-built revision, since it can't necessarily enumerate files in the Swift container.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/turnip:publish-swift-build-label into turnip:master.
diff --git a/Makefile b/Makefile
index d10a9b2..7ad822e 100644
--- a/Makefile
+++ b/Makefile
@@ -125,7 +125,7 @@ publish-tarball: build-tarball
[ ! -e ~/.config/swift/turnip ] || . ~/.config/swift/turnip; \
./publish-to-swift --debug \
$(SWIFT_CONTAINER_NAME) $(SWIFT_OBJECT_PATH) \
- $(TARBALL_BUILD_PATH)
+ $(TARBALL_BUILD_PATH) turnip=$(TARBALL_BUILD_LABEL)
.PHONY: build check clean dist lint run-api run-pack test
.PHONY: build-tarball publish-tarball
diff --git a/publish-to-swift b/publish-to-swift
index e5cfd59..5a86fe7 100755
--- a/publish-to-swift
+++ b/publish-to-swift
@@ -7,6 +7,7 @@ import os
import re
import subprocess
import sys
+import tempfile
def ensure_container_privs(container_name):
@@ -75,6 +76,7 @@ def main():
parser.add_argument("container_name")
parser.add_argument("swift_object_path")
parser.add_argument("local_path")
+ parser.add_argument("build_label")
args = parser.parse_args()
if args.debug:
@@ -118,6 +120,14 @@ def main():
args.container_name, args.swift_object_path, args.local_path,
overwrite=overwrite)
+ with tempfile.TemporaryDirectory() as tmpdir:
+ filename = "last-successful-build-label.txt"
+ with open(os.path.join(tmpdir, filename), "w") as f:
+ f.write(args.build_label)
+ publish_file_to_swift(
+ args.container_name, filename, os.path.join(tmpdir, filename),
+ overwrite=True)
+
if __name__ == "__main__":
main()