Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

Commit 856b782

Browse files
nataliejamesonfacebook-github-bot
authored andcommitted
Update release tool for chocolatey
Summary: Add some more documentation that chocolatey requires for packaging. Update a couple of nuspec fields. Reviewed By: styurin fbshipit-source-id: 365490dd23
1 parent d727fb7 commit 856b782

File tree

5 files changed

+69
-6
lines changed

5 files changed

+69
-6
lines changed

tools/release/platforms/chocolatey/BUCK

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
load("//programs:defs.bzl", "get_release_version")
1+
load("//programs:defs.bzl", "get_release_version", "get_release_timestamp")
22

33
version = get_release_version()
44

5+
timestamp = get_release_timestamp()
6+
57
python_library(
68
name = "build-lib",
79
srcs = ["build.py"],
@@ -13,10 +15,11 @@ python_binary(
1315
deps = [":build-lib"],
1416
)
1517

18+
export_file(name = "VERIFICATION.TXT")
19+
1620
genrule(
1721
name = "chocolatey",
1822
srcs = [
19-
"//:LICENSE",
2023
"//:README",
2124
"//programs:buck",
2225
"CHANGELOG.md",
@@ -26,5 +29,19 @@ genrule(
2629
"chocolateyUninstall.ps1",
2730
],
2831
out = "buck.nupkg",
29-
cmd = "$(exe :build) --version {} --output %OUT% --src-dir %SRCDIR%".format(version),
32+
cmd = " ".join([
33+
"$(exe :build)",
34+
"--license-file",
35+
"$(location //:LICENSE)",
36+
"--verification-txt",
37+
"$(location :VERIFICATION.TXT)",
38+
"--version",
39+
version,
40+
"--timestamp",
41+
timestamp,
42+
"--output",
43+
"%OUT%",
44+
"--src-dir",
45+
"%SRCDIR%",
46+
]),
3047
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# This is replaced inside of build containers by buck release scripts. It must be present for the BUCK build rule to be evaluated.
1+
General bug fixes and performance fixes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
VERIFICATION
2+
Verification is intended to assist the Chocolatey moderators and community
3+
in verifying that this package's contents are trustworthy.
4+
5+
To reproduce buck.pex:
6+
7+
- Clone the buck repository (`git clone --branch {release_version} https://github.com/facebook/buck.git buck`)
8+
- Build buck. The README.md included in this package explains how to do this in more detail but the simplified version is to run the following from the buck directory:
9+
-- ant
10+
-- ./bin/buck build -c buck.release_version={release_version} -c buck.release_timestamp={release_timestamp} --output buck.pex buck
11+
- Verify that buck.pex shas match with a tool like Powershell's `Get-Filehash`, or Chocolatey's `checksum.exe`

tools/release/platforms/chocolatey/buck.nuspec

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
<metadata>
55
<id>buck</id>
66
<version>__REPLACE__</version>
7-
<title>buck</title>
7+
<title>Buck</title>
88
<authors>Facebook Inc</authors>
99
<projectUrl>https://buckbuild.com</projectUrl>
1010
<copyright>2012-present Facebook Inc</copyright>
1111
<licenseUrl>https://github.com/facebook/buck/blob/master/LICENSE</licenseUrl>
1212
<requireLicenseAcceptance>true</requireLicenseAcceptance>
1313
<projectSourceUrl>https://github.com/facebook/buck</projectSourceUrl>
14+
<packageSourceUrl>https://github.com/facebook/buck</packageSourceUrl>
1415
<bugTrackerUrl>https://github.com/facebook/buck/issues</bugTrackerUrl>
1516
<tags>buck</tags>
1617
<summary>A fast multi-language build system from Facebook</summary>
@@ -22,7 +23,8 @@
2223
</dependencies>
2324
</metadata>
2425
<files>
25-
<file src="LICENSE" target="LICENSE" />
26+
<file src="LICENSE.txt" target="tools/LICENSE.txt" />
27+
<file src="VERIFICATION.txt" target="tools/VERIFICATION.txt" />
2628
<file src="README.md" target="README.md" />
2729
<file src="buck.bat" target="tools/buck.bat" />
2830
<file src="buck.pex" target="tools/buck.pex" />

tools/release/platforms/chocolatey/build.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,22 @@
1111

1212
def parse_args(args):
1313
parser = argparse.ArgumentParser(description="Build buck's choco package")
14+
parser.add_argument(
15+
"--license-file",
16+
required=True,
17+
help="The original license file that needs a prefix added",
18+
)
19+
parser.add_argument(
20+
"--verification-txt",
21+
required=True,
22+
help="The verification.txt template used when creating the nupkg",
23+
)
1424
parser.add_argument(
1525
"--version", required=True, help="The version that is being built"
1626
)
27+
parser.add_argument(
28+
"--timestamp", required=True, help="The timestamp when the release was made"
29+
)
1730
parser.add_argument(
1831
"--src-dir",
1932
required=True,
@@ -51,9 +64,29 @@ def build(nuspec, output):
5164
os.rename(glob.glob("buck.*.nupkg")[0], output)
5265

5366

67+
def write_license_file(original_license):
68+
dest = "LICENSE.txt"
69+
with open(original_license, "r") as fin, open(dest, "w") as fout:
70+
fout.write("From: https://github.com/facebook/buck/blob/master/LICENSE\n")
71+
fout.write("\n")
72+
fout.write(fin.read())
73+
74+
75+
def write_verification_txt(original_verification_txt, version, timestamp):
76+
dest = "VERIFICATION.txt"
77+
with open(original_verification_txt, "r") as fin, open(dest, "w") as fout:
78+
verification_text = fin.read().decode("utf-8")
79+
verification_text = verification_text.format(
80+
release_version=version, release_timestamp=timestamp
81+
)
82+
fout.write(verification_text)
83+
84+
5485
if __name__ == "__main__":
5586
args = parse_args(sys.argv[1:])
5687
tmp_dir = copy_files(args.src_dir)
5788
os.chdir(tmp_dir)
5889
update_nuspec("buck.nuspec", "CHANGELOG.md", args.version)
90+
write_license_file(args.license_file)
91+
write_verification_txt(args.verification_txt, args.version, args.timestamp)
5992
build("buck.nuspec", args.output)

0 commit comments

Comments
 (0)