diff --git a/antlir/antlir2/bzl/feature/clone.bzl b/antlir/antlir2/bzl/feature/clone.bzl index 8a1b0c1126..8ed50e8792 100644 --- a/antlir/antlir2/bzl/feature/clone.bzl +++ b/antlir/antlir2/bzl/feature/clone.bzl @@ -82,7 +82,8 @@ clone_record = record( def clone_analyze( src_path: str, dst_path: str, - deps: dict[str, Dependency]) -> FeatureAnalysis: + deps: dict[str, Dependency], + impl: RunInfo) -> FeatureAnalysis: omit_outer_dir = src_path.endswith("/") pre_existing_dest = dst_path.endswith("/") if omit_outer_dir and not pre_existing_dest: @@ -105,4 +106,5 @@ def clone_analyze( pre_existing_dest = pre_existing_dest, ), required_layers = [src_layer[LayerInfo]], + impl_run_info = impl, ) diff --git a/antlir/antlir2/bzl/feature/dot_meta.bzl b/antlir/antlir2/bzl/feature/dot_meta.bzl index 6aad2109bf..8c335955f1 100644 --- a/antlir/antlir2/bzl/feature/dot_meta.bzl +++ b/antlir/antlir2/bzl/feature/dot_meta.bzl @@ -48,7 +48,7 @@ dot_meta_record = record( def dot_meta_analyze( build_info: [dict[str, typing.Any], None], - impl: [RunInfo, None] = None) -> FeatureAnalysis: + impl: RunInfo) -> FeatureAnalysis: return FeatureAnalysis( feature_type = "dot_meta", data = dot_meta_record( diff --git a/antlir/antlir2/bzl/feature/extract.bzl b/antlir/antlir2/bzl/feature/extract.bzl index f61178aa8d..75f41f5904 100644 --- a/antlir/antlir2/bzl/feature/extract.bzl +++ b/antlir/antlir2/bzl/feature/extract.bzl @@ -97,6 +97,7 @@ extract_record = record( def extract_analyze( ctx: AnalyzeFeatureContext, + impl: RunInfo, source: str, deps: dict[str, Dependency], binaries: list[str] | None = None, @@ -115,6 +116,7 @@ def extract_analyze( buck = None, ), required_layers = [layer[LayerInfo]], + impl_run_info = impl, ) elif source == "buck": src = deps["src"] @@ -145,6 +147,7 @@ def extract_analyze( ), required_artifacts = [src], required_run_infos = [src_runinfo], + impl_run_info = impl, ) else: fail("invalid extract source '{}'".format(source)) diff --git a/antlir/antlir2/bzl/feature/feature.bzl b/antlir/antlir2/bzl/feature/feature.bzl index 20a3e28ca0..8bd87a230a 100644 --- a/antlir/antlir2/bzl/feature/feature.bzl +++ b/antlir/antlir2/bzl/feature/feature.bzl @@ -157,6 +157,7 @@ def _impl(ctx: AnalysisContext) -> list[Provider]: ), label = ctx.label, ) + analyze_kwargs["impl"] = ctx.attrs.inline_features_impls[key][RunInfo] analysis = _analyze_feature[inline["feature_type"]](**analyze_kwargs) for analysis in flatten.flatten(analysis): @@ -168,7 +169,7 @@ def _impl(ctx: AnalysisContext) -> list[Provider]: feature_type = analysis.feature_type, label = ctx.label.raw_target(), analysis = analysis, - run_info = analysis.impl_run_info or ctx.attrs.inline_features_impls[key][RunInfo], + run_info = analysis.impl_run_info, ) inline_features.append(feat) diff --git a/antlir/antlir2/bzl/feature/feature_info.bzl b/antlir/antlir2/bzl/feature/feature_info.bzl index c7e76b2864..d011d8b9d3 100644 --- a/antlir/antlir2/bzl/feature/feature_info.bzl +++ b/antlir/antlir2/bzl/feature/feature_info.bzl @@ -95,7 +95,7 @@ def data_only_feature_analysis_fn( record_type, feature_type: str, build_phase: BuildPhase = BuildPhase("compile")): - def inner(impl: RunInfo | None = None, **kwargs) -> FeatureAnalysis: + def inner(impl: RunInfo, **kwargs) -> FeatureAnalysis: return FeatureAnalysis( feature_type = feature_type, data = record_type(**kwargs), diff --git a/antlir/antlir2/bzl/feature/genrule.bzl b/antlir/antlir2/bzl/feature/genrule.bzl index c62f114ce6..d3b4d30534 100644 --- a/antlir/antlir2/bzl/feature/genrule.bzl +++ b/antlir/antlir2/bzl/feature/genrule.bzl @@ -42,7 +42,8 @@ def genrule_analyze( boot: bool, bind_repo_ro: bool, mount_platform: bool, - args: dict[str, str | ResolvedStringWithMacros]) -> FeatureAnalysis: + args: dict[str, str | ResolvedStringWithMacros], + impl: RunInfo) -> FeatureAnalysis: cmd = {int(key.removeprefix("cmd_")): val for key, val in args.items() if key.startswith("cmd_")} cmd = [val for _key, val in sorted(cmd.items())] return FeatureAnalysis( @@ -56,4 +57,5 @@ def genrule_analyze( mount_platform = mount_platform, ), build_phase = BuildPhase("genrule"), + impl_run_info = impl, ) diff --git a/antlir/antlir2/bzl/feature/install.bzl b/antlir/antlir2/bzl/feature/install.bzl index a9369b4c6a..67f5249f29 100644 --- a/antlir/antlir2/bzl/feature/install.bzl +++ b/antlir/antlir2/bzl/feature/install.bzl @@ -109,7 +109,7 @@ def get_feature_anaylsis_for_install( user: str, skip_debuginfo_split: bool, text: str | None, - impl: RunInfo | None = None): + impl: RunInfo): binary_info = None required_run_infos = [] required_artifacts = [] @@ -182,13 +182,13 @@ def get_feature_anaylsis_for_install( def install_analyze( ctx: AnalyzeFeatureContext, + impl: RunInfo, dst: str, group: str, mode: int | None, user: str, text: str | None, - deps_or_srcs: dict[str, Artifact | Dependency] | None = None, - impl: RunInfo | None = None) -> FeatureAnalysis: + deps_or_srcs: dict[str, Artifact | Dependency] | None = None) -> FeatureAnalysis: src = None if not deps_or_srcs else deps_or_srcs["src"] return get_feature_anaylsis_for_install( ctx, diff --git a/antlir/antlir2/bzl/feature/metakv.bzl b/antlir/antlir2/bzl/feature/metakv.bzl index abf44a9bed..dd1914efeb 100644 --- a/antlir/antlir2/bzl/feature/metakv.bzl +++ b/antlir/antlir2/bzl/feature/metakv.bzl @@ -79,6 +79,8 @@ metakv_record = record( ) def metakv_analyze( + *, + impl: RunInfo, store: dict[str, typing.Any] | None = None, remove: dict[str, typing.Any] | None = None) -> FeatureAnalysis: return FeatureAnalysis( @@ -87,4 +89,5 @@ def metakv_analyze( store = metakv_store_record(**store) if store else None, remove = metakv_remove_record(**remove) if remove else None, ), + impl_run_info = impl, ) diff --git a/antlir/antlir2/bzl/feature/mount.bzl b/antlir/antlir2/bzl/feature/mount.bzl index 6add698868..8e2008a932 100644 --- a/antlir/antlir2/bzl/feature/mount.bzl +++ b/antlir/antlir2/bzl/feature/mount.bzl @@ -113,6 +113,7 @@ def mount_analyze( is_directory: bool | None, host_source: str | None, _implicit_from_antlir1: bool, + impl: RunInfo, deps: dict[str, Dependency] = {}) -> FeatureAnalysis: if source_kind == "layer": source = deps.pop("source") @@ -128,6 +129,7 @@ def mount_analyze( host = None, ), required_layers = [source[LayerInfo]], + impl_run_info = impl, ) elif source_kind == "host": return FeatureAnalysis( @@ -140,6 +142,7 @@ def mount_analyze( ), layer = None, ), + impl_run_info = impl, ) else: fail("invalid source_kind '{}'".format(source_kind)) diff --git a/antlir/antlir2/bzl/feature/rpms.bzl b/antlir/antlir2/bzl/feature/rpms.bzl index 6b8af93347..4ecd88716f 100644 --- a/antlir/antlir2/bzl/feature/rpms.bzl +++ b/antlir/antlir2/bzl/feature/rpms.bzl @@ -143,12 +143,13 @@ rpms_record = record( ) def rpms_analyze( + *, ctx: AnalyzeFeatureContext, + impl: RunInfo, action: str, subjects: list[str], srcs: dict[str, Artifact] = {}, - unnamed_deps_or_srcs: list[Dependency | Artifact] = [], - impl: RunInfo | None = None) -> FeatureAnalysis: + unnamed_deps_or_srcs: list[Dependency | Artifact] = []) -> FeatureAnalysis: rpms = [] for rpm in subjects: rpms.append(rpm_source_record(subject = rpm)) diff --git a/antlir/antlir2/bzl/feature/tarball.bzl b/antlir/antlir2/bzl/feature/tarball.bzl index 8992b629dc..3edb2a8671 100644 --- a/antlir/antlir2/bzl/feature/tarball.bzl +++ b/antlir/antlir2/bzl/feature/tarball.bzl @@ -44,7 +44,8 @@ def tarball_analyze( into_dir: str, user: str, group: str, - srcs: dict[str, Artifact]) -> FeatureAnalysis: + srcs: dict[str, Artifact], + impl: RunInfo) -> FeatureAnalysis: tarball = srcs["source"] if user != "root" or group != "root": @@ -65,6 +66,7 @@ def tarball_analyze( ), feature_type = "install", required_artifacts = [extracted], + impl_run_info = impl, ) def _extract_impl(ctx: AnalysisContext) -> list[Provider]: diff --git a/antlir/antlir2/dnf/BUCK b/antlir/antlir2/dnf/BUCK index a4af141377..5fd83aa8b3 100644 --- a/antlir/antlir2/dnf/BUCK +++ b/antlir/antlir2/dnf/BUCK @@ -41,7 +41,6 @@ feature.new( dst = "/__antlir2__/dnf/versionlock.json", mode = "a+rx", ), - # @oss-disable ], visibility = ["//antlir/antlir2/build_appliance:features"], )