Prefer: -libqpid-proton10 -python313-urllib3_1
Prefer: -cargo1.58 -cargo1.57 cargo1.89
Prefer: chrony-pool-suse
Prefer: -postgresql17-devel-mini

BuildFlags: excludebuild:python-pandas:test-py313

Macros:
%registry_url %(echo %{vendor} | cut -d '/' -f 3 | sed 's/build/registry/')
:Macros

%if "%{sub %{lower %_project} 1 14}" != "isv:suse:edge:" || "%{sub %_project 15 21}" == "Factory"
    # Here we are in Factory like project so set chart major version to 999
Macros:
%chart_major 999
:Macros
%else
    # Here we are in version branch, so set the image prefix and chart major accordingly
Macros:
%project_branch %(echo %{_project} | cut -d ':' -f 4)
%img_prefix %{project_branch}/
%chart_major %(echo %{project_branch} | awk '{split($1,a,"."); print a[1]*100 + a[2]}')
:Macros
%endif

%if %{sub %_project 1 3} == ISV
Macros:
%img_repo registry.suse.com/edge
%chart_repo oci://registry.suse.com/edge
%chart_prefix charts/
%manifest_repo registry.suse.com/edge
%support_level l3
:Macros
%else
Macros:
%img_repo registry.opensuse.org/isv/suse/edge/containers/images
%manifest_repo registry.opensuse.org/isv/suse/edge/containers/images
%chart_repo oci://registry.opensuse.org/isv/suse/edge/containers/charts
%support_level techpreview
:Macros
%endif

%if "%_repository" == "charts" || "%_repository" == "test_manifest_images"
Macros:
%img_repo %(echo %{registry_url}:%{_project}:images | tr ":" "/" | tr '[:upper:]' '[:lower:]')
%manifest_repo %(echo %{registry_url}:%{_project}:test_manifest_images | tr ":" "/" | tr '[:upper:]' '[:lower:]')
%chart_repo oci://%(echo %{registry_url}:%{_project}:charts | tr ":" "/" | tr '[:upper:]' '[:lower:]')
%chart_prefix %(echo "")
:Macros
%endif

# Only build manifest embedding images here
%if "%_repository" == "test_manifest_images"
BuildFlags: onlybuild:edge-image-builder-image
BuildFlags: onlybuild:release-manifest-image
%else
# Only a subset of stack is arm64 ready exclude what is not ready
  %ifarch aarch64
    # Akri
    BuildFlags: excludebuild:akri
    BuildFlags: excludebuild:akri-agent-image
    BuildFlags: excludebuild:akri-controller-image
    BuildFlags: excludebuild:akri-debug-echo-discovery-handler-image
    BuildFlags: excludebuild:akri-onvif-discovery-handler-image
    BuildFlags: excludebuild:akri-opcua-discovery-handler-image
    BuildFlags: excludebuild:akri-udev-discovery-handler-image
    BuildFlags: excludebuild:akri-webhook-configuration-image
    BuildFlags: excludebuild:cri-tools

    # FRR
    BuildFlags: excludebuild:frr-image
    BuildFlags: excludebuild:frr-k8s
    BuildFlags: excludebuild:frr-k8s-image

    # Upgrade controller
    BuildFlags: excludebuild:upgrade-controller
    BuildFlags: excludebuild:upgrade-controller-image
  %endif
%endif

%if "%_repository" == "images" || "%_repository" == "test_manifest_images"
    Type: docker
    Repotype: none
    Patterntype: none
    BuildEngine: podman
    Prefer: SLES-release
    BuildFlags: dockerarg:SLE_VERSION=16.0

    # Publish multi-arch container images only once all archs have been built
    PublishFlags: archsync
    
    # skopeo and umoci are used by build scripts to list packages
    Substitute: system-packages:podman podman buildah createrepo_c release-compare skopeo umoci
%endif

%if "%_repository" == "images"
    # skopeo and umoci are used by build scripts to list packages
    Substitute: system-packages:podman podman buildah createrepo_c release-compare edge-build-checks skopeo umoci

%endif

%if "%_repository" == "charts" || "%_repository" == "phantomcharts" || "%_repository" == "releasecharts"
    Type: helm
    Repotype: helm
    Patterntype: none
    Required: perl-YAML-LibYAML

    # include edge-build-checks here
    Support: edge-build-checks
%endif

%if "%_repository" == "standard"
    # for build openstack-ironic-image
    BuildFlags: allowrootforbuild

    # ironic-ipa-ramdisk are noarch packages that need to be availble to both archs
    ExportFilter: ^ironic-ipa-ramdisk-.*\.noarch\.rpm$ aarch64 x86_64
    ExportFilter: ^grub2-.*-efi-.*\.noarch\.rpm$ aarch64 x86_64
%endif

%if "%_repository" != "standard"
    BuildFlags: excludebuild:grub-aggregate 
%endif
# Enable reproducible builds
# https://en.opensuse.org/openSUSE:Reproducible_Builds\#With_OBS
Macros:
%source_date_epoch_from_changelog N
%clamp_mtime_to_source_date_epoch Y
%use_source_date_epoch_as_buildtime Y
%_buildhost reproducible
:Macros
