Skip to content

Lua function causes syntax errors in OBS build for RHEL9/Rocky9 #1081

@mohamed-rekiba

Description

@mohamed-rekiba

Issue Title:
Firefox spec file Lua function causes syntax errors in OBS build for RHEL9/Rocky9

Issue Content:

The Firefox spec file contains a Lua function dist_to_rhel_minor() that is causing multiple syntax errors during the OBS build process on Rocky Linux 9.

Build Environment:

  • Architecture: x86_64
  • Vendor: redhat
  • Vendor version: 9
  • Distribution suffix: .el9

Problematic Code:

%{lua:
function dist_to_rhel_minor(str, start)
  match = string.match(str, ".module%+el8.%d+")
  if match then
     return string.sub(match, 13)
  end
  match = string.match(str, ".el8_%d+")
  if match then
     return string.sub(match, 6)
  end
  match = string.match(str, ".el8")
  if match then
     return 10
  end
  match = string.match(str, ".module%+el9.%d+")
  if match then
     return string.sub(match, 13)
  end
  match = string.match(str, ".el9_%d+")
  if match then
     return string.sub(match, 6)
  end
  match = string.match(str, ".el9")
  if match then
     return 7
  end
  match = string.match(str, ".el10_%d+")
  if match then
     return string.sub(match, 7)
  end
  match = string.match(str, ".el10")
  if match then
     return 1
  end
  return -1
end}

%global rhel_minor_version %{lua:print(dist_to_rhel_minor(rpm.expand("%dist")))}

%if 0%{?rhel} == 9
  %if %{rhel_minor_version} < 2
    %global bundle_nss        1
    %global system_nss        1
  %endif
  %if %{rhel_minor_version} > 5
    %ifnarch s390x
      %global with_wasi_sdk 1
    %endif
  %endif
%endif

%if %{with_wasi_sdk}
BuildRequires:        lld
BuildRequires:        clang cmake ninja-build
%endif

Build Errors:

spec file parser line 89: syntax error in expression
spec file parser line 93: syntax error in expression
spec file parser line 124: syntax error in expression
spec file parser line 1223: syntax error in expression
spec file parser line 1351: syntax error in expression
spec file parser line 1811: cannot expand %(...)
spec file parser line 1854: cannot expand %(...)
spec file parser line 1855: cannot expand %(...)

[   89s] warning: Macro expanded in comment on line 489: %{gts_version}-gcc-g++ instead fail
[   89s] 
[   89s] setting SOURCE_DATE_EPOCH=1748476800
[   89s] error: Failed build dependencies:
[   89s] 	cmake is needed by firefox-128.11.0-3.1.x86_64
[   89s] 	gcc-toolset-14-gcc-plugin-annobin is needed by firefox-128.11.0-3.1.x86_64
[   89s] 	lld is needed by firefox-128.11.0-3.1.x86_64
[   89s] 	ninja-build is needed by firefox-128.11.0-3.1.x86_64

The Lua function is designed to extract RHEL minor version information from the distribution string (.el9 in this case), but the syntax appears to be incompatible with the OBS RPM parser. The build also shows missing build dependencies (cmake, gcc-toolset-14-gcc-plugin-annobin, lld, ninja-build), but the primary issue is the spec file parsing failure preventing the build from proceeding.

Given the current environment parameters, the function should theoretically match .el9 and return 7 for rhel_minor_version, but the parser errors suggest the Lua syntax needs to be adapted for OBS compatibility.

firefox.spec

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions