forked from cfengine/cfengine-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_release_information.py
More file actions
54 lines (44 loc) · 1.97 KB
/
generate_release_information.py
File metadata and controls
54 lines (44 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from cfengine_cli.masterfiles.download import download_all_versions
from cfengine_cli.masterfiles.generate_vcf_download import generate_vcf_download
from cfengine_cli.masterfiles.generate_vcf_git_checkout import generate_vcf_git_checkout
from cfengine_cli.masterfiles.check_download_matches_git import (
check_download_matches_git,
)
from cfbs.utils import immediate_subdirectories, version_is_at_least
DOWNLOAD_PATH = "downloaded_masterfiles"
def generate_release_information_impl(
omit_download=False, check=False, min_version=None
):
if not omit_download:
print("Downloading masterfiles...")
downloaded_versions = download_all_versions(DOWNLOAD_PATH, min_version)
print("Download finished. Every reported checksum matches.")
else:
downloaded_versions = immediate_subdirectories(DOWNLOAD_PATH)
downloaded_versions = list(
filter(
lambda v: version_is_at_least(v, min_version),
downloaded_versions,
)
)
print(
"Downloading releases of masterfiles from cfengine.com and generating release information..."
)
generate_vcf_download(DOWNLOAD_PATH, downloaded_versions)
if check:
print(
"Downloading releases of masterfiles from git (github.com) and generating "
+ "additional release information for comparison..."
)
generate_vcf_git_checkout(downloaded_versions)
print("Candidate release information generated.")
print("Comparing files from cfengine.com and github.com...")
check_download_matches_git(downloaded_versions)
print("The masterfiles downloaded from github.com and cfengine.com match.")
else:
print("Release information successfully generated.")
print("See the results in ./masterfiles/")
print(
"(Run again with --check-against-git to download and compare with files "
+ "from git, and generate -git.json files)"
)