Skip to content

Commit a795aab

Browse files
jessp01chrisbra
authored andcommitted
runtime(spec): Add support for more tags and distributions
- specMacroIdentifier: support macros starting with '?'; the most common example is `%{?dist}` - specPreAmble: added some missing tags from: https://rpm.org/docs/4.19.x/manual/spec.html - Added support for: `fedora`, `rhel`, `rocky`, `rhl`, `centos`, `el\d` and `fc\d`, see https://docs.fedoraproject.org/en-US/packaging-guidelines/DistTag closes: #18703 Signed-off-by: Jesse Portnoy <jesse.portnoy@perforce.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 59f0ea5 commit a795aab

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

runtime/syntax/spec.vim

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
" Last Change: 2020 May 25
77
" 2024 Sep 10 by Vim Project: add file triggers support, #15569
88
" 2025 May 05 by Vim Project: update for rpm 4.2 #17258
9+
" 2025 Nov 09 by Vim Project: support for more distributions and tags #18703
910

1011
" quit when a syntax file was already loaded
1112
if exists("b:current_syntax")
@@ -22,7 +23,7 @@ syn match specVariables contained '\$\h\w*' contains=specSpecialVariablesNames
2223
syn match specVariables contained '\${\w*}' contains=specSpecialVariablesNames,specSpecialChar
2324

2425
syn match specMacroIdentifier contained '%\h\w*' contains=specMacroNameLocal,specMacroNameOther,specPercent
25-
syn match specMacroIdentifier contained '%{\w*}' contains=specMacroNameLocal,specMacroNameOther,specPercent,specSpecialChar
26+
syn match specMacroIdentifier contained '%{?\?\w*}' contains=specMacroNameLocal,specMacroNameOther,specPercent,specSpecialChar
2627

2728
syn match specSpecialVariables contained '\$[0-9]\|\${[0-9]}'
2829
syn match specCommandOpts contained '\s\(-\w\+\|--\w[a-zA-Z_-]\+\)'ms=s+1
@@ -60,17 +61,17 @@ syn cluster specListedFiles contains=specListedFilesBin,specListedFilesLib,specL
6061

6162
"specCommands
6263
syn match specConfigure contained '\./configure'
63-
syn match specTarCommand contained '\<tar\s\+[cxvpzIf]\{,5}\s*'
64+
syn match specTarCommand contained '\<tar\s\+[cxvpzIjf]\{,5}\s*'
6465
syn keyword specCommandSpecial contained root
65-
syn keyword specCommand contained make xmkmf mkdir chmod ln find sed rm strip moc echo grep ls rm mv mkdir install cp pwd cat tail then else elif cd gzip rmdir ln eval export touch
66+
syn keyword specCommand contained make xmkmf mkdir chmod ln find sed rm strip moc echo grep ls rm mv mkdir install cp pwd cat tail then else elif cd gzip rmdir ln eval export touch bzip2 bunzip2 gunzip
6667
syn cluster specCommands contains=specCommand,specTarCommand,specConfigure,specCommandSpecial
6768

6869
"frequently used rpm env vars
6970
syn keyword specSpecialVariablesNames contained RPM_BUILD_ROOT RPM_BUILD_DIR RPM_SOURCE_DIR RPM_OPT_FLAGS LDFLAGS CC CC_FLAGS CPPNAME CFLAGS CXX CXXFLAGS CPPFLAGS
7071

7172
"valid macro names from /usr/lib/rpm/macros
72-
syn keyword specMacroNameOther contained buildroot buildsubdir distribution disturl ix86 name nil optflags perl_sitearch release requires_eq vendor version
73-
syn match specMacroNameOther contained '\<\(PATCH\|SOURCE\)\d*\>'
73+
syn keyword specMacroNameOther contained buildroot buildsubdir distribution disturl ix86 name nil optflags perl_sitearch release requires_eq vendor version dist fedora rhel rocky rhl centos
74+
syn match specMacroNameOther contained '\<\(PATCH\|SOURCE\|el\|fc\)\d*\>'
7475

7576
"valid _macro names from /usr/lib/rpm/macros
7677
syn keyword specMacroNameLocal contained _arch _binary_payload _bindir _build _build_alias _build_cpu _build_os _build_vendor _builddir _buildshell _buildsubdir _bzip2bin _datadir _dbpath _dbpath_rebuild _defaultdocdir _defaultlicensedir _docdir _excludedocs _exec_prefix _fixgroup _fixowner _fixperms _ftpport _ftpproxy _gpg_path _group_path _gzipbin _host _host_alias _host_cpu _host_os _host_vendor _httpport _httpproxy _iconsdir _includedir _infodir _install_langs _install_script_path _instchangelog _keyring _keyringpath _langpatt _lib _libdir _libexecdir _localstatedir _mandir _netsharedpath _oldincludedir _os _passwd_path _pgp_path _pgpbin _preScriptEnvironment _prefix _provides _rpmconfigdir _rpmdir _rpmfilename _rpmformat _rpmluadir _rpmmacrodir _sbindir _sharedstatedir _signature _source_payload _sourcedir _specdir _srcrpmdir _sysconfdir _sysusersdir _target _target_alias _target_cpu _target_os _target_platform _target_vendor _timecheck _tmppath _topdir _unitdir _usr _usrsrc _var _vendor
@@ -104,7 +105,7 @@ syn case ignore
104105
"%% PreAmble Section %%
105106
"Copyright and Serial were deprecated by License and Epoch
106107
syn region specPreAmbleDeprecated oneline matchgroup=specError start='^\(Copyright\|Serial\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier
107-
syn region specPreAmble oneline matchgroup=specCommand start='^\(Prereq\|Summary\|Name\|Version\|Packager\|Requires\|Recommends\|Suggests\|Supplements\|Enhances\|Icon\|URL\|SourceLicense\|Source\d*\|Patch\d*\|Prefix\|Packager\|Group\|License\|Release\|BuildRoot\|Distribution\|Vendor\|Provides\|ExclusiveArch\|ExcludeArch\|ExclusiveOS\|Obsoletes\|BuildArch\|BuildArchitectures\|BuildRequires\|BuildConflicts\|BuildPreReq\|Conflicts\|AutoRequires\|AutoReq\|AutoReqProv\|AutoProv\|Epoch\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier
108+
syn region specPreAmble oneline matchgroup=specCommand start='^\(Prereq\|Summary\|Name\|Version\|Packager\|Requires\|Recommends\|Suggests\|Supplements\|Enhances\|Icon\|URL\|SourceLicense\|Source\d*\|Patch\d*\|Prefix\|Packager\|Group\|License\|Release\|BuildRoot\|Distribution\|DistTag\|Vendor\|Provides\|ExclusiveArch\|ExcludeArch\|ExclusiveOS\|Obsoletes\|BuildArch\|BuildArchitectures\|BuildRequires\|BuildConflicts\|BuildPreReq\|Conflicts\|AutoRequires\|AutoReq\|AutoReqProv\|AutoProv\|Epoch\|ModularityLabel\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier
108109

109110
"%% Description Section %%
110111
syn region specDescriptionArea matchgroup=specSection start='^%description' end='^%'me=e-1 contains=specDescriptionOpts,specEmail,specURL,specNumber,specMacroIdentifier,specComment

0 commit comments

Comments
 (0)