Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37735087
en ru br
Репозитории ALT
S:5.9-alt2
5.1: 4.3.10-alt2
4.1: 4.3.6-alt1
4.0: 4.3.4-alt3
+updates:4.3.4-alt3
3.0: 4.3.0-alt0.2
+backports:4.3.2-alt0.0.M30.1
www.altlinux.org/Changes

Группа :: Интерпретаторы команд
Пакет: zsh

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: alt-rpm-0002-_rpm-optionally-complete-rpm-ba-and-similar.patch
Скачать


From 41e680b1b078f114c7b160fc020395c2063c5e74 Mon Sep 17 00:00:00 2001
From: Arseny Maslennikov <arseny@altlinux.org>
Date: Wed, 26 Apr 2023 16:06:28 +0300
Subject: [PATCH] _rpm: optionally complete `rpm -ba` and similar
For historical reasons many old users of RPM who build packages have
rpmbuild aliased to rpm and type "rpm -ba", etc. We now complete build
mode options for `rpm` if e. g. the following zstyle is set to true:
    % zstyle ':completion::complete:rpm:*:options' build-modes true
Not sure at the moment if this makes sense in upstream, though.
---
 Completion/Redhat/Command/_rpm | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/Completion/Redhat/Command/_rpm b/Completion/Redhat/Command/_rpm
index 1edbae9f0..825bfc932 100644
--- a/Completion/Redhat/Command/_rpm
+++ b/Completion/Redhat/Command/_rpm
@@ -52,6 +52,7 @@ _rpm () {
   typeset -A opt_args
   local ret
   local -a tmp expl opts commonopts selectopts fileopts pathopts buildopts queryopts
+  local -a alt_buildmode_opts
 
   commonopts=(
     '(-v --verbose)--quiet[print as little as possible]'
@@ -110,6 +111,14 @@ _rpm () {
     '--dbpath=[specify rpm database path]:path:_directories'
   )
 
+  # We'd like these to be optionally completable if service is "rpm".
+  alt_buildmode_opts=(
+    '(-r -t)-b+[build mode (spec file)]:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages s\:build\ source\ package\ only r\:build\ source\ package\ only\ -\ calculate\ build\ requires)):*:build:->build_b'
+    '(-b -t)-r+[build mode (source package)]:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages s\:build\ source\ package\ only r\:build\ source\ package\ only\ -\ calculate\ build\ requires)):*:build:->build_r'
+    '(-b -r)-t+[build mode (tar file)]:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages s\:build\ source\ package\ only r\:build\ source\ package\ only\ -\ calculate\ build\ requires)):*:build:->build_t'
+    --{rebuild,recompile}':*:source rpm file:->build_r'
+  )
+
   buildopts=(
     '--rpmfcdebug[debug dependencies generation]'
     '--buildroot=[override the build root]:build root directory:_directories'
@@ -170,14 +179,14 @@ _rpm () {
         '--setcaps[set capabilities of files in the given package]:*:package:->setattrs'
         '--restore[restore owner, group, permissions and capabilities of files in the given package]:*:package:->setattrs'
       )
+      if zstyle -t ":completion:${curcontext}:options" build-modes; then
+        opts+=( $alt_buildmode_opts )
+      fi
     ;;
     rpmbuild)
       [[ -prefix -r ]] && pathopts[1]=
       opts+=( $buildopts
-        '(-r -t)-b+[build mode (spec file)]:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages s\:build\ source\ package\ only r\:build\ source\ package\ only\ -\ calculate\ build\ requires)):*:build:->build_b'
-        '(-b -t)-r+[build mode (source package)]:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages s\:build\ source\ package\ only r\:build\ source\ package\ only\ -\ calculate\ build\ requires)):*:build:->build_b'
-        '(-b -r)-t+[build mode (tar file)]:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages s\:build\ source\ package\ only r\:build\ source\ package\ only\ -\ calculate\ build\ requires)):*:build:->build_t'
-        --{rebuild,recompile}':*:source rpm file:->build_r'
+        $alt_buildmode_opts
       )
     ;;
     rpmspec)
-- 
2.33.7
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin