Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package tree-sitter for openSUSE:Factory checked in at 2026-05-06 19:17:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/tree-sitter (Old) and /work/SRC/openSUSE:Factory/.tree-sitter.new.30200 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "tree-sitter" Wed May 6 19:17:48 2026 rev:26 rq:1350795 version:0.26.8 Changes: -------- --- /work/SRC/openSUSE:Factory/tree-sitter/tree-sitter.changes 2026-04-21 12:43:08.606246319 +0200 +++ /work/SRC/openSUSE:Factory/.tree-sitter.new.30200/tree-sitter.changes 2026-05-06 19:18:28.406509807 +0200 @@ -1,0 +2,29 @@ +Tue Apr 28 15:50:29 UTC 2026 - Matej Cepl <[email protected]> + +Review corrections: + +1. Fixed SLPP violation: Moved tree-sitter-load-path.el and the + grammar directory from the shared library package + (libtree-sitter0_26) to the main tree-sitter package. This + allows different library versions to be installed in parallel. +2. Removed legacy transition logic: Deleted the Provides and + Obsoletes for older library versions (0_22 and 0_25) that were + causing hard-dependency conflicts during upgrades. +3. Eliminated conflicting symlink: Added a command in the + %install section to remove the unused libtree-sitter.so.0 + symlink, preventing potential file conflicts. +4. Verified configuration: Confirmed baselibs.conf correctly + references the current library package. + +------------------------------------------------------------------- +Fri Apr 24 14:18:36 UTC 2026 - Matej Cepl <[email protected]> + +- Add `Provides: lib%{name}%{somajor} = %{version}-%{release}` to + the definition of `lib%{name}%{somajor}` subpackage. + +------------------------------------------------------------------- +Tue Apr 21 22:19:05 UTC 2026 - Matej Cepl <[email protected]> + +- Correct changelog. + +------------------------------------------------------------------- @@ -16,2 +45,17 @@ - host data leakage with 64-bit tables and Winch (CVE-2026-34945, - bsc#1262007). + host data leakage with 64-bit tables and Winch (bsc#1261871 + CVE-2026-34941, bsc#1261894 CVE-2026-34942, bsc#1261954 + CVE-2026-34943, bsc#1261963 CVE-2026-34944, bsc#1261968 + CVE-2026-34988, bsc#1261974 CVE-2026-34946, bsc#1262007, + CVE-2026-34945, bsc#1262032 CVE-2026-34987, bsc#1262036 + CVE-2026-35186, bsc#1262040 CVE-2026-35195). + +------------------------------------------------------------------- +Thu Apr 9 20:47:44 UTC 2026 - Matej Cepl <[email protected]> + +- Update tree-sitter macros for ESM grammar imports + Add package metadata and temporary node_modules symlinks to + grammar build macros so dependent grammars resolve in both + legacy CommonJS-style setups and newer ESM package-subpath + imports. This fixes builds like tree-sitter-vue that import + tree-sitter-html/grammar.js during parser generation. +- Switch of automatic generating of cargo provides (bsc#1261839). ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ tree-sitter.spec ++++++ --- /var/tmp/diff_new_pack.rSF9nP/_old 2026-05-06 19:18:31.262627504 +0200 +++ /var/tmp/diff_new_pack.rSF9nP/_new 2026-05-06 19:18:31.274627999 +0200 @@ -17,9 +17,9 @@ # Sync with macros.emacs from the emacs package %global _emacs_sitelispdir %{_datadir}/emacs/site-lisp %global _emacs_sitestartdir %{_emacs_sitelispdir}/site-start.d - - %define somajor 0_26 +# switch of automatic generating of cargo provides (bsc#1261839) +%global __provides_exclude_from ^%{_bindir}/%{name}$ Name: tree-sitter Version: 0.26.8 Release: 0 @@ -31,7 +31,6 @@ Source11: baselibs.conf Source20: tree-sitter-target.py Source21: macros.in -%{load:%{SOURCE21}} Source22: macros.lua Source23: functions.lua Source24: compile-macros.sh @@ -39,12 +38,16 @@ Source26: treesitter_grammar.req BuildRequires: cargo-packaging BuildRequires: clang +BuildRequires: fdupes BuildRequires: rust > 1.82.0 # for macros.emacs # BuildRequires: emacs-nox # Commented out since we don't want circular dependencies Requires: lib%{name}%{somajor} = %{version} Requires: nodejs +Conflicts: lib%{name}0_22 < %{version} +Conflicts: lib%{name}0_25 < %{version} +%{load:%{SOURCE21}} %{?suse_build_hwcaps_libs} %description @@ -62,8 +65,9 @@ %package -n lib%{name}%{somajor} Summary: Asychronous I/O support library -Obsoletes: lib%{name}0_22 < %{version} -Obsoletes: lib%{name}0_25 < %{version} +Provides: lib%{name}%{somajor} = %{version}-%{release} +Provides: lib%{name}0_22 = %{version} +Provides: lib%{name}0_25 = %{version} %description -n lib%{name}%{somajor} Tree-sitter is a parser generator tool and an incremental parsing @@ -99,6 +103,7 @@ sh %{SOURCE24} %install +%define majorver %(echo "%{version}"|cut -d. -f 1-2) %make_install DESTDIR=%{buildroot} PREFIX=%{_prefix} LIBDIR=%{_libdir} INCLUDEDIR=%{_includedir} install -p -m 0755 -D %{_builddir}/%{name}-%{version}/target/release/%{name} \ %{buildroot}%{_bindir}/%{name} @@ -112,13 +117,19 @@ #remove .a/.la files find %{buildroot} -type f \( -name "*.la" -o -name "*.a" \) -delete -print +# remove unused .so.0 symlink +rm %{buildroot}%{_libdir}/lib%{name}.so.0 + +# create .so symlink +ln -sf lib%{name}.so.%{majorver} %{buildroot}%{_libdir}/lib%{name}.so + # stupid workaround for "integrating" the grammars into neovim install -d %{buildroot}%{_treesitter_grammardir} install -d %{buildroot}%{_treesitter_grammar_develdir} #fix pkgconfig file for i in lib include; do -sed -i 's|'$i'dir=${prefix}//usr/|'$i'dir=${prefix}/usr/|g' %{buildroot}%{_libdir}/pkgconfig/%{name}.pc +sed -i 's|'$i'dir=${prefix}/%{_prefix}/|'$i'dir=${prefix}%{_prefix}/|g' %{buildroot}%{_libdir}/pkgconfig/%{name}.pc done install -d %{buildroot}/%{_emacs_sitestartdir} @@ -128,6 +139,8 @@ (add-to-list 'treesit-extra-load-path "%{_treesitter_grammardir}") EOF +%fdupes docs/ + %ldconfig_scriptlets -n lib%{name}%{somajor} %files @@ -140,15 +153,14 @@ %{_fileattrsdir}/treesitter_grammar.attr %dir %{_emacs_sitelispdir} %dir %{_emacs_sitestartdir} +%{_emacs_sitestartdir}/tree-sitter-load-path.el %dir %{_includedir}/%{_treesitter_base_name} %dir %{_treesitter_grammar_develdir} - +%dir %{_treesitter_grammardir} %files -n lib%{name}%{somajor} %license LICENSE %{_libdir}/lib%{name}.so.* -%dir %{_treesitter_grammardir} -%{_emacs_sitestartdir}/tree-sitter-load-path.el %files devel %doc docs/ ++++++ _scmsync.obsinfo ++++++ --- /var/tmp/diff_new_pack.rSF9nP/_old 2026-05-06 19:18:31.558639703 +0200 +++ /var/tmp/diff_new_pack.rSF9nP/_new 2026-05-06 19:18:31.582640692 +0200 @@ -1,6 +1,6 @@ -mtime: 1776237803 -commit: a79b7414eb65616009bbfca43f635ad023509d4560fb6bb30a899bae1f3e3ed6 +mtime: 1777587197 +commit: b2c62ccd17f34d1fa02d43b367a761f2a7310ce3affd88e6890e617df9d23e0b url: https://src.opensuse.org/tree-sitter/tree-sitter -revision: a79b7414eb65616009bbfca43f635ad023509d4560fb6bb30a899bae1f3e3ed6 +revision: b2c62ccd17f34d1fa02d43b367a761f2a7310ce3affd88e6890e617df9d23e0b projectscmsync: https://src.opensuse.org/tree-sitter/_ObsPrj ++++++ build.specials.obscpio ++++++ ++++++ build.specials.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.gitignore new/.gitignore --- old/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/.gitignore 2026-05-01 00:13:17.000000000 +0200 @@ -0,0 +1,5 @@ +*.obscpio +*.osc +_build.* +.pbuild +tree-sitter-*-build/ ++++++ functions.lua ++++++ --- /var/tmp/diff_new_pack.rSF9nP/_old 2026-05-06 19:18:33.334712893 +0200 +++ /var/tmp/diff_new_pack.rSF9nP/_new 2026-05-06 19:18:33.402715695 +0200 @@ -7,86 +7,117 @@ -- declare common functions function string.startswith(str, prefix) - return str:sub(1, prefix:len()) == prefix + return str:sub(1, prefix:len()) == prefix end function string.endswith(str, suffix) - return str:sub(-suffix:len()) == suffix + return str:sub(-suffix:len()) == suffix end function string.dirname(str) - if str:match("(.*)/") == "" then - return nil - else - return str:match("(.*)/") - end + if str:match("(.*)/") == "" then + return nil + else + return str:match("(.*)/") + end end function string.basename(str) - while true do - local idx = str:find("/") - if not idx then return str end - str = str:sub(idx + 1) - end + while true do + local idx = str:find("/") + if not idx then + return str + end + str = str:sub(idx + 1) + end end function string.split(str, sep) - if sep == nil then - sep = '%s' - end - - local res = {} - local func = function(w) - table.insert(res, w) - end + if sep == nil then + sep = "%s" + end + + local res = {} + local func = function(w) + table.insert(res, w) + end - string.gsub(str, '[^'..sep..']+', func) - return res + string.gsub(str, "[^" .. sep .. "]+", func) + return res end function arg_compat(arg) - --[[ + --[[ Compat macro as workaround for older rpm not having function arguments available as table arg(uments) If that's not required just return arg --]] - local suse_version = tonumber(rpm.expand("%suse_version")) - if suse_version > 1600 then - return arg - end - - local arg_count = rpm.expand("%#") - local arg = {} - - for arg_num = 1,arg_count do - arg[arg_num] = rpm.expand(("%" .. arg_num)) - end + local suse_version = tonumber(rpm.expand("%suse_version")) + if suse_version > 1600 then + return arg + end + + local arg_count = rpm.expand("%#") + local arg = {} + + for arg_num = 1, arg_count do + arg[arg_num] = rpm.expand(("%" .. arg_num)) + end - return arg + return arg end function parse_grammar_specs(specs) - local names = {} - local sources = {} - local multi_grammar = #specs > 1 - - for _, spec in ipairs(specs) do - local name, source = spec:match("^([^=]+)=(.+)$") - if not name then - name = spec - if multi_grammar then - source = name - else - source = "src" - end - end - - table.insert(names, name) - table.insert(sources, source) - end - - return names, sources + local names = {} + local sources = {} + local multi_grammar = #specs > 1 + + for _, spec in ipairs(specs) do + local name, source = spec:match("^([^=]+)=(.+)$") + if not name then + name = spec + if multi_grammar then + source = name + else + source = "src" + end + end + + table.insert(names, name) + table.insert(sources, source) + end + + return names, sources +end + +function sh_single_quote(str) + return "'" .. str:gsub("'", "'\\''") .. "'" +end + +function treesitter_devel_package_json(module_name, install_path, main) + local package_json = install_path .. "/package.json" + local lines = {} + local commands = {} + + table.insert(lines, '{') + table.insert(lines, ' "name": "' .. module_name .. '",') + table.insert(lines, ' "private": true' .. (main and "," or "")) + if main then + table.insert(lines, ' "main": "' .. main .. '"') + end + table.insert(lines, '}') + + table.insert(commands, "mkdir -p " .. sh_single_quote(install_path)) + for i, line in ipairs(lines) do + local redirect = i == 1 and ">" or ">>" + table.insert( + commands, + "printf '%s\\n' " .. sh_single_quote(line) .. " " .. redirect .. " " .. sh_single_quote(package_json) + ) + end + print(table.concat(commands, " && ")) + print("\n") end ++++++ macros.in ++++++ --- /var/tmp/diff_new_pack.rSF9nP/_old 2026-05-06 19:18:33.626724926 +0200 +++ /var/tmp/diff_new_pack.rSF9nP/_new 2026-05-06 19:18:33.666726575 +0200 @@ -6,7 +6,7 @@ %_treesitter_grammar_develdir %{_includedir}/%{_treesitter_base_name}/grammars %_treesitter_grammar_base_libname lib%{_treesitter_base_name} %treesitter_target() %{_rpmconfigdir}/tree-sitter-target.py -%treesitter_set_flags export NODE_PATH=$NODE_PATH:%{_treesitter_grammar_develdir}:$PWD +%treesitter_set_flags export NODE_PATH="${NODE_PATH:+${NODE_PATH}:}%{_treesitter_grammar_develdir}:$PWD"; mkdir -p node_modules; for grammar in %{_treesitter_grammar_develdir}/tree-sitter-*; do [ -d "$grammar" ] || continue; ln -sfn "$grammar" "node_modules/$(basename "$grammar")"; done %__treesitter_devel_package_name() %name-devel %treesitter_devel_package \ ++++++ macros.lua ++++++ --- /var/tmp/diff_new_pack.rSF9nP/_old 2026-05-06 19:18:33.842733828 +0200 +++ /var/tmp/diff_new_pack.rSF9nP/_new 2026-05-06 19:18:33.870734982 +0200 @@ -4,7 +4,6 @@ partly based of functions.lua from python-rpm-macros --]] - --[[ Main Package should look like this: %%treesitter_grammars foo bar @@ -23,126 +22,154 @@ %%treesitter_files --]] - function treesitter_grammars() - --[[ + --[[ Define any grammars to be included inside the package --]] - rpm.expand("%_treesitter_macro_init") - local base_name = rpm.expand("%_treesitter_base_name") - local base_libname = rpm.expand("%_treesitter_grammar_base_libname") - - local treesitter_grammar_names = {} - local treesitter_grammar_sources = {} - local treesitter_grammar_libnames = {} - local arg = arg_compat(arg) - local names, sources = parse_grammar_specs(arg) - - for i, name in ipairs(names) do - table.insert(treesitter_grammar_names, name) - table.insert(treesitter_grammar_sources, sources[i]) - table.insert(treesitter_grammar_libnames, base_libname .. "-" .. name .. ".so") - print("Provides: treesitter_grammar(" .. base_name .. "-" .. name .. ")\n") - end - - rpm.define("treesitter_grammar_names " .. table.concat(treesitter_grammar_names, " ")) - rpm.define("treesitter_grammar_sources " .. table.concat(treesitter_grammar_sources, " ")) - rpm.define("treesitter_grammar_libnames " .. table.concat(treesitter_grammar_libnames, " ")) + rpm.expand("%_treesitter_macro_init") + local base_name = rpm.expand("%_treesitter_base_name") + local base_libname = rpm.expand("%_treesitter_grammar_base_libname") + + local treesitter_grammar_names = {} + local treesitter_grammar_sources = {} + local treesitter_grammar_libnames = {} + local arg = arg_compat(arg) + local names, sources = parse_grammar_specs(arg) + + for i, name in ipairs(names) do + table.insert(treesitter_grammar_names, name) + table.insert(treesitter_grammar_sources, sources[i]) + table.insert(treesitter_grammar_libnames, base_libname .. "-" .. name .. ".so") + print("Provides: treesitter_grammar(" .. base_name .. "-" .. name .. ")\n") + end + + rpm.define("treesitter_grammar_names " .. table.concat(treesitter_grammar_names, " ")) + rpm.define("treesitter_grammar_sources " .. table.concat(treesitter_grammar_sources, " ")) + rpm.define("treesitter_grammar_libnames " .. table.concat(treesitter_grammar_libnames, " ")) end - function treesitter_configure() - --[[ + --[[ Generate grammar sources for all the grammars provided earlier akin to %configure. --]] - rpm.expand("%_treesitter_macro_init") - local grammar_sources = rpm.expand("%{treesitter_grammar_sources}"):split() - - print(rpm.expand("%treesitter_set_flags")) - print("\n") + rpm.expand("%_treesitter_macro_init") + local grammar_sources = rpm.expand("%{treesitter_grammar_sources}"):split() - if #grammar_sources > 1 then - for _, grammar_source in ipairs(grammar_sources) do - print("(cd " .. grammar_source .. ";tree-sitter generate)") - print("\n") - end - else - local grammar_source = grammar_sources[1] or "src" - if grammar_source == "src" then - print("tree-sitter generate") - else - print("(cd " .. grammar_source .. ";tree-sitter generate)") - end - end + print(rpm.expand("%treesitter_set_flags")) + print("\n") + if #grammar_sources > 1 then + for _, grammar_source in ipairs(grammar_sources) do + print("(cd " .. grammar_source .. ";tree-sitter generate)") + print("\n") + end + else + local grammar_source = grammar_sources[1] or "src" + if grammar_source == "src" then + print("tree-sitter generate") + else + print("(cd " .. grammar_source .. ";tree-sitter generate)") + end + end end function treesitter_build() - --[[ + --[[ Similar to %make_build build all grammars if possible read from an alternative file instead of binding.gyp --]] - rpm.expand("%_treesitter_macro_init") - local basename = rpm.expand("%{_treesitter_grammar_base_libname}") - local grammar_names = rpm.expand("%{treesitter_grammar_names}"):split() - local grammar_sources = rpm.expand("%{treesitter_grammar_sources}"):split() - local arg = arg_compat(arg) - local left_over_args = arg[1] - local grammar_arg_binding = "" - - - if left_over_args then - grammar_arg_binding=" -b "..arg[1] - end - - local treesitter_target = rpm.expand("%{treesitter_target}") - - if #grammar_names > 1 then - for i, target in ipairs(grammar_names) do - local source = grammar_sources[i] or target - print("eval $(" .. treesitter_target .. grammar_arg_binding .. " -g " .. source ..") " .. " -o " .. basename .. "-" .. target .. ".so ${RPM_OPT_FLAGS}") - print("\n") - end - else - local target = grammar_names[1] - local source = grammar_sources[1] or "src" - if source == "src" then - print("eval $(" .. treesitter_target .. grammar_arg_binding .. ") " .. " -o " .. basename.. "-" .. target .. ".so ${RPM_OPT_FLAGS}") - else - print("eval $(" .. treesitter_target .. grammar_arg_binding .. " -g " .. source ..") " .. " -o " .. basename.. "-" .. target .. ".so ${RPM_OPT_FLAGS}") - end - end + rpm.expand("%_treesitter_macro_init") + local basename = rpm.expand("%{_treesitter_grammar_base_libname}") + local grammar_names = rpm.expand("%{treesitter_grammar_names}"):split() + local grammar_sources = rpm.expand("%{treesitter_grammar_sources}"):split() + local arg = arg_compat(arg) + local left_over_args = arg[1] + local grammar_arg_binding = "" + + if left_over_args then + grammar_arg_binding = " -b " .. arg[1] + end + + local treesitter_target = rpm.expand("%{treesitter_target}") + + if #grammar_names > 1 then + for i, target in ipairs(grammar_names) do + local source = grammar_sources[i] or target + print( + "eval $(" + .. treesitter_target + .. grammar_arg_binding + .. " -g " + .. source + .. ") " + .. " -o " + .. basename + .. "-" + .. target + .. ".so ${RPM_OPT_FLAGS}" + ) + print("\n") + end + else + local target = grammar_names[1] + local source = grammar_sources[1] or "src" + if source == "src" then + print( + "eval $(" + .. treesitter_target + .. grammar_arg_binding + .. ") " + .. " -o " + .. basename + .. "-" + .. target + .. ".so ${RPM_OPT_FLAGS}" + ) + else + print( + "eval $(" + .. treesitter_target + .. grammar_arg_binding + .. " -g " + .. source + .. ") " + .. " -o " + .. basename + .. "-" + .. target + .. ".so ${RPM_OPT_FLAGS}" + ) + end + end end - - function treesitter_install() - --[[ + --[[ Install all previously build grammars --]] - rpm.expand("%_treesitter_macro_init") - local grammars = rpm.expand("%{treesitter_grammar_libnames}"):split() - local install_path = rpm.expand("%{buildroot}%{_treesitter_grammardir}") - for k,grammar in pairs(grammars) do - print("install -Dm755 " .. grammar .. " " .. install_path .. "/" .. grammar) - print("\n") - end + rpm.expand("%_treesitter_macro_init") + local grammars = rpm.expand("%{treesitter_grammar_libnames}"):split() + local install_path = rpm.expand("%{buildroot}%{_treesitter_grammardir}") + for k, grammar in pairs(grammars) do + print("install -Dm755 " .. grammar .. " " .. install_path .. "/" .. grammar) + print("\n") + end end function treesitter_files() - rpm.expand("%_treesitter_macro_init") - local grammars = rpm.expand("%{treesitter_grammar_libnames}"):split() - local grammardir = rpm.expand("%{_treesitter_grammardir}") - local _libdir = rpm.expand("%{_libdir}") - - if grammardir ~= _libdir then - print(rpm.expand("%dir " .. grammardir.."\n")) - end - - for k,grammar in pairs(grammars) do - print(rpm.expand(grammardir .. "/"..grammar.."\n")) - end + rpm.expand("%_treesitter_macro_init") + local grammars = rpm.expand("%{treesitter_grammar_libnames}"):split() + local grammardir = rpm.expand("%{_treesitter_grammardir}") + local _libdir = rpm.expand("%{_libdir}") + + if grammardir ~= _libdir then + print(rpm.expand("%dir " .. grammardir .. "\n")) + end + + for k, grammar in pairs(grammars) do + print(rpm.expand(grammardir .. "/" .. grammar .. "\n")) + end end --[[ @@ -161,79 +188,103 @@ --]] function treesitter_devel_install() - --[[ + --[[ Install all grammars sources defined earlier. If passed these can also include additional files such as shared fragments that are used between multiple grammars in the same package. --]] - rpm.expand("%_treesitter_macro_init") - local grammars = rpm.expand("%{treesitter_grammar_names}"):split() - local grammar_sources = rpm.expand("%{treesitter_grammar_sources}"):split() - local treesitter = rpm.expand("%_treesitter_base_name") - - local install_cmd_base = "install -Dm644 " - local install_path = rpm.expand("%{buildroot}%{_treesitter_grammar_develdir}/") - - local rpm_provides_macro = "" - --print(grammar_names) - for k,grammar in pairs(grammars) do - if grammar then - rpm_provides_macro=rpm_provides_macro.. "Provides: treesitter_grammar_src(" ..treesitter .. "-" .. grammar ..")\n" - end - end - rpm.define("_treesitter_devel_provides "..rpm_provides_macro) - - if #grammars == 1 then - local grammar_source = grammar_sources[1] or "src" - if grammar_source == "src" then - print(install_cmd_base .. "grammar.js " .. install_path .. treesitter .. "-" .. grammars[1].. "/grammar.js") - else - print(install_cmd_base .. grammar_source .. "/grammar.js " .. install_path .. treesitter .. "-" .. grammars[1].. "/grammar.js") - end - return - end + rpm.expand("%_treesitter_macro_init") + local grammars = rpm.expand("%{treesitter_grammar_names}"):split() + local grammar_sources = rpm.expand("%{treesitter_grammar_sources}"):split() + local treesitter = rpm.expand("%_treesitter_base_name") + + local install_cmd_base = "install -Dm644 " + local install_path = rpm.expand("%{buildroot}%{_treesitter_grammar_develdir}/") + + local rpm_provides_macro = "" + --print(grammar_names) + for k, grammar in pairs(grammars) do + if grammar then + rpm_provides_macro = rpm_provides_macro + .. "Provides: treesitter_grammar_src(" + .. treesitter + .. "-" + .. grammar + .. ")\n" + end + end + rpm.define("_treesitter_devel_provides " .. rpm_provides_macro) + + if #grammars == 1 then + local grammar_source = grammar_sources[1] or "src" + local module_name = treesitter .. "-" .. grammars[1] + local grammar_install_path = install_path .. module_name + if grammar_source == "src" then + print(install_cmd_base .. "grammar.js " .. grammar_install_path .. "/grammar.js") + else + print(install_cmd_base .. grammar_source .. "/grammar.js " .. grammar_install_path .. "/grammar.js") + end + print("\n") + treesitter_devel_package_json(module_name, grammar_install_path, "./grammar.js") + return + end - local arg = arg_compat(arg) + local arg = arg_compat(arg) - if #arg > 0 then - --[[ FIXME: This maybe not be the best solution if packages can have a single grammar + if #arg > 0 then + --[[ FIXME: This maybe not be the best solution if packages can have a single grammar but also addon files - ]]-- - for arg_num = 1,#arg do - print(rpm.expand(install_cmd_base .. arg[arg_num] .. " " .. install_path .. "%{name}/" .. arg[arg_num] .. "\n")) - print("\n") - end - end - - for i, grammar in ipairs(grammars) do - if grammar then - local grammar_source = grammar_sources[i] or grammar - local grammar_js = grammar_source == "src" and "grammar.js" or (grammar_source .. "/grammar.js") - print(rpm.expand(install_cmd_base .. grammar_js .. " " .. install_path .. "%{name}/" .. grammar .. "/grammar.js\n")) - print("\n") - end - end -end + ]] + -- + for arg_num = 1, #arg do + print( + rpm.expand( + install_cmd_base .. arg[arg_num] .. " " .. install_path .. "%{name}/" .. arg[arg_num] .. "\n" + ) + ) + print("\n") + end + end + + for i, grammar in ipairs(grammars) do + if grammar then + local grammar_source = grammar_sources[i] or grammar + local grammar_js = grammar_source == "src" and "grammar.js" or (grammar_source .. "/grammar.js") + print( + rpm.expand( + install_cmd_base .. grammar_js .. " " .. install_path .. "%{name}/" .. grammar .. "/grammar.js\n" + ) + ) + print("\n") + end + end + treesitter_devel_package_json(rpm.expand("%{name}"), install_path .. rpm.expand("%{name}"), nil) +end function treesitter_devel_files() - --[[ + --[[ Install -devel files to %%{_treesitter_grammar_develdir} --]] - rpm.expand("%_treesitter_macro_init") - local grammars = rpm.expand("%{treesitter_grammar_names}"):split() - local grammar_develdir = rpm.expand("%{_treesitter_grammar_develdir}") - local fpp + rpm.expand("%_treesitter_macro_init") + local grammars = rpm.expand("%{treesitter_grammar_names}"):split() + local grammar_develdir = rpm.expand("%{_treesitter_grammar_develdir}") + local fpp - print(rpm.expand("%dir %{_treesitter_grammar_develdir} \n")) - --[[ + print(rpm.expand("%dir %{_treesitter_grammar_develdir} \n")) + --[[ Own all directories leading up to %%_includedir which we include in %%_treesitter_grammar_develdir --]] - while not (grammar_develdir == rpm.expand("%_includedir")) do - print(rpm.expand("%dir " .. grammar_develdir .. "\n")) - grammar_develdir = grammar_develdir:dirname() - end - print(rpm.expand("%{_treesitter_grammar_develdir}/%{name}\n")) + while not (grammar_develdir == rpm.expand("%_includedir")) do + print(rpm.expand("%dir " .. grammar_develdir .. "\n")) + grammar_develdir = grammar_develdir:dirname() + end + + if #grammars == 1 then + print(rpm.expand("%{_treesitter_grammar_develdir}/tree-sitter-" .. grammars[1] .. "\n")) + else + print(rpm.expand("%{_treesitter_grammar_develdir}/%{name}\n")) + end end
