Skip to content

Commit 26bca0e

Browse files
authored
Merge branch 'main' into create-dir
2 parents 7a41686 + 2193be7 commit 26bca0e

File tree

14 files changed

+138
-25
lines changed

14 files changed

+138
-25
lines changed

e2e/common.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ source .tox/e2e/bin/activate
2929
# Set a variable to constrain packages used in the tests
3030
export FROMAGER_CONSTRAINTS_FILE="${SCRIPTDIR}/constraints.txt"
3131

32+
OS=$(uname)
33+
if [ "$OS" = "Darwin" ]; then
34+
NETWORK_ISOLATION=""
35+
# The tag comes back as something like "macosx-10.9-universal2" but the
36+
# filename contains "macosx_10_9_universal2".
37+
WHEEL_PLATFORM_TAG=$(python3 -c 'import sysconfig; print(sysconfig.get_platform().replace("-", "_").replace(".", "_"))')
38+
HAS_ELFDEP="0"
39+
else
40+
NETWORK_ISOLATION="--network-isolation"
41+
WHEEL_PLATFORM_TAG="linux_x86_64"
42+
HAS_ELFDEP="1"
43+
fi
44+
export NETWORK_ISOLATION
45+
export WHEEL_PLATFORM_TAG
46+
export HAS_ELFDEP
47+
3248
# Local web server management
3349
HTTP_SERVER_PID=""
3450
on_exit() {

e2e/test_elfdeps.sh

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,6 @@ source "$SCRIPTDIR/common.sh"
1111
DIST="MarkupSafe"
1212
VERSION="2.1.5"
1313

14-
OS=$(uname)
15-
if [ "$OS" = "Darwin" ]; then
16-
NETWORK_ISOLATION=""
17-
WHEEL_PLATFORM_TAG="macosx_10_13_universal2"
18-
HAS_ELFDEP="0"
19-
else
20-
NETWORK_ISOLATION="--network-isolation"
21-
WHEEL_PLATFORM_TAG="linux_x86_64"
22-
HAS_ELFDEP="1"
23-
fi
24-
2514
# Bootstrap the test project
2615
fromager \
2716
$NETWORK_ISOLATION \

e2e/test_rust_vendor.sh

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ source "$SCRIPTDIR/common.sh"
1212
DIST="maturin"
1313
VERSION="1.6.0"
1414

15-
OS=$(uname)
16-
if [ "$OS" = "Darwin" ]; then
17-
NETWORK_ISOLATION=""
18-
WHEEL_PLATFORM_TAG="macosx_10_9_universal2"
19-
else
20-
NETWORK_ISOLATION="--network-isolation"
21-
WHEEL_PLATFORM_TAG="linux_x86_64"
22-
fi
23-
2415
# Bootstrap the test project
2516
fromager \
2617
$NETWORK_ISOLATION \

src/fromager/__main__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,14 @@ def main(
179179
if error_log_file:
180180
logger.info("logging errors to %s", error_log_file)
181181

182+
logger.info(f"primary settings file: {settings_file}")
183+
logger.info(f"per-package settings dir: {settings_dir}")
184+
logger.info(f"variant: {variant}")
185+
logger.info(f"patches dir: {patches_dir}")
186+
logger.info(f"maximum concurrent jobs: {jobs}")
187+
logger.info(f"constraints file: {constraints_file}")
188+
logger.info(f"wheel server url: {wheel_server_url}")
189+
logger.info(f"network isolation: {network_isolation}")
182190
overrides.log_overrides()
183191

184192
if network_isolation and not SUPPORTS_NETWORK_ISOLATION:
@@ -202,6 +210,7 @@ def main(
202210
variant=variant,
203211
network_isolation=network_isolation,
204212
max_jobs=jobs,
213+
settings_dir=settings_dir,
205214
)
206215
wkctx.setup()
207216
ctx.obj = wkctx

src/fromager/commands/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
canonicalize,
66
download_sequence,
77
graph,
8+
lint,
89
list_overrides,
910
migrate_config,
1011
server,
@@ -17,6 +18,7 @@
1718
build.build_sequence,
1819
build_order.build_order,
1920
graph.graph,
21+
lint.lint,
2022
list_overrides.list_overrides,
2123
migrate_config.migrate_config,
2224
step.step,

src/fromager/commands/bootstrap.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ def bootstrap(
8989
logger.info("bootstrapping %r variant of %s", wkctx.variant, to_build)
9090

9191
if prev_graph_file:
92+
logger.info("reading previous bootstrap data from %s", prev_graph_file)
9293
prev_graph = dependency_graph.DependencyGraph.from_file(prev_graph_file)
9394
else:
95+
logger.info("no previous bootstrap data")
9496
prev_graph = None
9597

9698
pre_built = wkctx.settings.list_pre_built()
@@ -103,6 +105,7 @@ def bootstrap(
103105
# this is to ensure that if we are using an older bootstrap to resolve packages
104106
# we are able to upgrade a package anywhere in the dependency tree if it is mentioned
105107
# in the toplevel without having to fall back to history
108+
logger.info("resolving top-level dependencies before building")
106109
for req in to_build:
107110
pbi = wkctx.package_build_info(req)
108111
if pbi.pre_built:
@@ -112,6 +115,7 @@ def bootstrap(
112115
source_url, version = sources.resolve_source(
113116
wkctx, req, resolver.PYPI_SERVER_URL
114117
)
118+
logger.info("%s resolves to %s", req, version)
115119
wkctx.dependency_graph.add_dependency(
116120
parent_name=None,
117121
parent_version=None,

src/fromager/commands/build.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def build_sequence(
9393
wkctx.wheel_server_url,
9494
)
9595

96+
logger.info("reading build order from %s", build_order_file)
9697
with open(build_order_file, "r") as f:
9798
for entry in progress.progress(json.load(f)):
9899
dist_name = entry["dist"]

src/fromager/commands/download_sequence.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def download_sequence(
5656
else:
5757
wheel_servers = [sdist_server_url]
5858

59+
logger.info("reading build order from %s", build_order_file)
5960
with open(build_order_file, "r") as f:
6061
build_order = json.load(f)
6162

src/fromager/commands/lint.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import logging
2+
3+
import click
4+
5+
from .. import context, overrides
6+
7+
logger = logging.getLogger(__name__)
8+
9+
10+
@click.command()
11+
@click.pass_obj
12+
def lint(
13+
wkctx: context.WorkContext,
14+
) -> None:
15+
"""Review existing settings and overrides for potential configuration errors."""
16+
errors = 0
17+
18+
logger.info(f"Checking patches in {wkctx.settings.patches_dir}...")
19+
for entry in wkctx.settings.patches_dir.glob("*"):
20+
logger.debug(entry)
21+
if "-" in entry.name:
22+
actual_package_name, _, version_str = entry.name.rpartition("-")
23+
expected_package_name = overrides.pkgname_to_override_module(
24+
actual_package_name
25+
)
26+
if actual_package_name != expected_package_name:
27+
errors += 1
28+
logger.error(
29+
f"ERROR: Patch directory {entry.name} should be {expected_package_name}-{version_str}"
30+
)
31+
else:
32+
expected_package_name = overrides.pkgname_to_override_module(entry.name)
33+
if actual_package_name != expected_package_name:
34+
errors += 1
35+
logger.error(
36+
f"ERROR: Patch directory {entry.name} should be {expected_package_name}"
37+
)
38+
39+
if wkctx.settings_dir is not None:
40+
logger.info(f"Checking settings files in {wkctx.settings_dir}...")
41+
for entry in wkctx.settings_dir.glob("*"):
42+
logger.debug(entry)
43+
if entry.suffix != ".yaml":
44+
errors += 1
45+
logger.error(
46+
f"ERROR: settings file {entry.name} should use extension '.yaml'"
47+
)
48+
expected_package_name = overrides.pkgname_to_override_module(entry.stem)
49+
if entry.stem != expected_package_name:
50+
errors += 1
51+
logger.error(
52+
f"ERROR: Settings file {entry.name} should be {expected_package_name}.yaml"
53+
)
54+
55+
logger.info("Checking entry points...")
56+
exts = overrides._get_extensions()
57+
for name in exts.names():
58+
logger.debug(name)
59+
expected_name = overrides.pkgname_to_override_module(name)
60+
if name != expected_name:
61+
errors += 1
62+
logger.error(f"ERROR: plugin name {name} should be {expected_name}")
63+
64+
if errors:
65+
raise SystemExit(f"Found {errors} errors")

src/fromager/context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def __init__(
3737
variant: str = "cpu",
3838
network_isolation: bool = False,
3939
max_jobs: int | None = None,
40+
settings_dir: pathlib.Path | None = None,
4041
):
4142
if active_settings is None:
4243
active_settings = packagesettings.Settings(
@@ -67,6 +68,7 @@ def __init__(
6768
self.cleanup = cleanup
6869
self.variant = variant
6970
self.network_isolation = network_isolation
71+
self.settings_dir = settings_dir
7072

7173
self._build_order_filename = self.work_dir / "build-order.json"
7274
self._constraints_filename = self.work_dir / "constraints.txt"

0 commit comments

Comments
 (0)