Skip to content

Commit f62984b

Browse files
authored
Merge pull request #297 from victormlg/generate_release
ENT-13632: Removed generate-release-information command
2 parents f009cf3 + d83058e commit f62984b

File tree

11 files changed

+2
-524
lines changed

11 files changed

+2
-524
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ These commands are intended to be run as part of build systems / deployment pipe
293293
`cfbs set-input` and `cfbs get-input` can be thought of as ways to save and load the input file.
294294
Similar to `cfbs get-input` the JSON contains both the specification (what the module accepts and how it's presented to the user) as well as the user's responses (if present).
295295
Expected usage is to run `cfbs get-input` to get the JSON, and then fill out the response part and run `cfbs set-input`.
296-
- `cfbs generate-release-information`: An internal command used to generate JSON release information files from the [official CFEngine masterfiles](https://github.com/cfengine/masterfiles/).
297296
- `cfbs validate`: Used to validate the [index JSON file](https://github.com/cfengine/build-index/blob/master/cfbs.json).
298297
May be expanded to validate other files and formats in the future.
299298
**Note:** If you use `cfbs validate` as part of your automation, scripts, and build systems, be aware that we might add more strict validation rules in the future, so be prepared to sometimes have it fail after upgrading the version of cfbs.

cfbs/args.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ class ArgsTypesNamespace(argparse.Namespace):
2828
git_commit_message = None # type: Optional[str]
2929
ignore_versions_json = False # type: bool
3030
diffs = None # type: Optional[str]
31-
omit_download = False # type: bool
32-
check_against_git = False # type: bool
33-
minimum_version = None # type: Optional[str]
3431
to_json = None # type: Optional[str]
3532
reference_version = None # type: Optional[str]
3633
masterfiles_dir = None # type: Optional[str]
@@ -169,21 +166,6 @@ def get_arg_parser(whitespace_for_manual=False):
169166
const="diffs.txt",
170167
default=None,
171168
)
172-
parser.add_argument(
173-
"--omit-download",
174-
help="Use existing masterfiles instead of downloading in 'cfbs generate-release-information'",
175-
action="store_true",
176-
)
177-
parser.add_argument(
178-
"--check-against-git",
179-
help="Check whether masterfiles from cfengine.com and github.com match in 'cfbs generate-release-information'",
180-
action="store_true",
181-
)
182-
parser.add_argument(
183-
"--from",
184-
help="Specify minimum version in 'cfbs generate-release-information'",
185-
dest="minimum_version",
186-
)
187169
parser.add_argument(
188170
"--to-json",
189171
help="Output 'cfbs analyze' results to a JSON file; optionally specify the JSON's filename",

cfbs/commands.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def search_command(terms: List[str]):
5959

6060
from cfbs.cfbs_json import CFBSJson
6161
from cfbs.cfbs_types import CFBSCommandExitCode, CFBSCommandGitResult
62-
from cfbs.masterfiles.download import download_single_version
62+
from cfbs.download import download_single_version
6363
from cfbs.updates import ModuleUpdates, update_module
6464
from cfbs.utils import (
6565
CFBSNetworkError,
@@ -123,7 +123,6 @@ def search_command(terms: List[str]):
123123
from cfbs.git_magic import commit_after_command, git_commit_maybe_prompt
124124
from cfbs.prompts import prompt_user, prompt_user_yesno
125125
from cfbs.module import Module, is_module_absolute, is_module_added_manually
126-
from cfbs.masterfiles.generate_release_information import generate_release_information
127126

128127
_MODULES_URL = "https://archive.build.cfengine.com/modules"
129128

@@ -1610,11 +1609,3 @@ def get_input_command(name, outfile):
16101609
log.error("Failed to write json: %s" % e)
16111610
return 1
16121611
return 0
1613-
1614-
1615-
@cfbs_command("generate-release-information")
1616-
def generate_release_information_command(
1617-
omit_download=False, check=False, min_version=None
1618-
):
1619-
generate_release_information(omit_download, check, min_version)
1620-
return 0
Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
import os
22
import shutil
33

4-
from cfbs.utils import (
5-
CFBSNetworkError,
6-
fetch_url,
7-
get_json,
8-
mkdir,
9-
CFBSExitError,
10-
version_is_at_least,
11-
)
4+
from cfbs.utils import CFBSNetworkError, fetch_url, get_json, mkdir, CFBSExitError
125

136
ENTERPRISE_RELEASES_URL = "https://cfengine.com/release-data/enterprise/releases.json"
147

@@ -40,72 +33,6 @@
4033
}
4134

4235

43-
def get_download_urls_enterprise(min_version=None):
44-
download_urls = {}
45-
reported_checksums = {}
46-
47-
print("* gathering download URLs...")
48-
49-
try:
50-
data = get_json(ENTERPRISE_RELEASES_URL)
51-
except CFBSNetworkError:
52-
raise CFBSExitError(
53-
"Downloading CFEngine release data failed - check your Wi-Fi / network settings."
54-
)
55-
56-
for release_data in data["releases"]:
57-
version = release_data["version"]
58-
59-
if not version_is_at_least(version, min_version):
60-
continue
61-
62-
if version in MISSING_DATA_VERSIONS:
63-
download_urls[version] = HARDCODED_URLS[version]
64-
reported_checksums[version] = HARDCODED_CHECKSUMS[version]
65-
continue
66-
67-
release_url = release_data["URL"]
68-
try:
69-
subdata = get_json(release_url)
70-
except CFBSNetworkError:
71-
raise CFBSExitError(
72-
"Downloading CFEngine release data for version %s failed - check your Wi-Fi / network settings."
73-
% version
74-
)
75-
artifacts_data = subdata["artifacts"]
76-
77-
if "Additional Assets" not in artifacts_data:
78-
# happens for 3.9.0b1, 3.8.0b1, 3.6.1, 3.6.0
79-
continue
80-
81-
masterfiles_data = None
82-
for asset in artifacts_data["Additional Assets"]:
83-
if asset["Title"] == "Masterfiles ready-to-install tarball":
84-
masterfiles_data = asset
85-
86-
if masterfiles_data is None:
87-
# happens for 3.9.2, 3.9.0, 3.8.2, 3.8.1, 3.8.0, 3.7.4--3.6.2
88-
# 3.9.2: see above
89-
# 3.9.0 and below: no masterfiles listed, and unlisted analogous URLs seemingly do not exist
90-
continue
91-
92-
download_urls[version] = masterfiles_data["URL"]
93-
reported_checksums[version] = masterfiles_data["SHA256"]
94-
95-
return download_urls, reported_checksums
96-
97-
98-
def get_all_download_urls(min_version=None):
99-
download_urls, reported_checksums = get_download_urls_enterprise(min_version)
100-
101-
for version in COMMUNITY_ONLY_VERSIONS:
102-
if version_is_at_least(version, min_version):
103-
download_urls[version] = HARDCODED_URLS[version]
104-
reported_checksums[version] = HARDCODED_CHECKSUMS[version]
105-
106-
return download_urls, reported_checksums
107-
108-
10936
def get_single_download_url(version):
11037
if version in HARDCODED_VERSIONS:
11138
download_url = HARDCODED_URLS[version]
@@ -177,16 +104,6 @@ def download_versions_from_urls(download_path, download_urls, reported_checksums
177104
return downloaded_versions
178105

179106

180-
def download_all_versions(download_path, min_version=None):
181-
download_urls, reported_checksums = get_all_download_urls(min_version)
182-
183-
downloaded_versions = download_versions_from_urls(
184-
download_path, download_urls, reported_checksums
185-
)
186-
187-
return downloaded_versions
188-
189-
190107
def download_single_version(download_path, version):
191108
download_url, reported_checksum = get_single_download_url(version)
192109

cfbs/main.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,6 @@ def _main() -> int:
9090
% args.command
9191
)
9292

93-
if args.omit_download and args.command != "generate-release-information":
94-
raise CFBSUserError(
95-
"The option --omit-download is only for 'cfbs generate-release-information', not 'cfbs %s'"
96-
% args.command
97-
)
98-
99-
if args.check_against_git and args.command != "generate-release-information":
100-
raise CFBSUserError(
101-
"The option --check-against-git is only for 'cfbs generate-release-information', not 'cfbs %s'"
102-
% args.command
103-
)
104-
105-
if args.minimum_version and args.command != "generate-release-information":
106-
raise CFBSUserError(
107-
"The option --from is only for 'cfbs generate-release-information', not 'cfbs %s'"
108-
% args.command
109-
)
110-
11193
if args.masterfiles_dir and args.command not in ("analyze", "analyse"):
11294
raise CFBSUserError(
11395
"The option --masterfiles-dir is only for 'cfbs analyze', not 'cfbs %s'"
@@ -193,13 +175,6 @@ def _main() -> int:
193175
if args.command == "convert":
194176
return commands.convert_command(args.non_interactive, args.offline)
195177

196-
if args.command == "generate-release-information":
197-
return commands.generate_release_information_command(
198-
omit_download=args.omit_download,
199-
check=args.check_against_git,
200-
min_version=args.minimum_version,
201-
)
202-
203178
# Commands you cannot run outside a cfbs repo:
204179
if not is_cfbs_repo():
205180
raise CFBSExitError("This is not a cfbs repo, to get started, type: cfbs init")

cfbs/masterfiles/__init__.py

Whitespace-only changes.

cfbs/masterfiles/analyze.py

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)