アーキテクチャ別の負債タグ検索フィルタリング

アーキテクチャ別の負債タグ検索フィルタリング

私は持っていますmultiarch有効にすると実行時にdebtags search、重複した結果がたくさん表示されます。

$ debtags search 'works-with-format::man' | head
docbook-to-man - converter from DocBook SGML into roff man macros
docbook-to-man:i386 - converter from DocBook SGML into roff man macros
docbook-utils - Convert DocBook files to other formats (HTML, RTF, PS, man, PDF)
docbook2x - Converts DocBook/XML documents into man pages and TeXinfo
docbook2x:i386 - Converts DocBook/XML documents into man pages and TeXinfo
doclifter - Convert troff to DocBook
dwww - Read all on-line documentation with a WWW browser
dwww:i386 - Read all on-line documentation with a WWW browser
ebook-speaker - eBook reader that reads aloud in a synthetic voice
ebook-speaker:i386 - eBook reader that reads aloud in a synthetic voice

回避策がありますgrep。以下を使用してください。

$ debtags search 'works-with-format::man' | grep -v ':i386 - ' | head
docbook-to-man - converter from DocBook SGML into roff man macros
docbook-utils - Convert DocBook files to other formats (HTML, RTF, PS, man, PDF)
docbook2x - Converts DocBook/XML documents into man pages and TeXinfo
doclifter - Convert troff to DocBook
dwww - Read all on-line documentation with a WWW browser
ebook-speaker - eBook reader that reads aloud in a synthetic voice
git-man - fast, scalable, distributed revision control system (manual pages)
gman - small man(1) front-end for X
gmanedit - GTK+ man pages editor
gnulib - GNU Portability Library

これは、文字列が:i386 -パッケージ記述に現れないと仮定します。これは少しハッキングです。もっと良い方法がありますか?

ベストアンサー1

debtags search 'works-with-format::man' | awk 'BEGIN { FS="[: ]" }  ! ($1 in seen) { print; seen[$1]=1 }'

seenこれは、アーキテクチャ(したがってスペースと区切り文字)に関係なく(配列のインデックスから)表示されたパッケージを記憶し、表示された場合は:再印刷しません。したがって、i386 にのみ存在し、デフォルト (amd64) アーキテクチャにはないパッケージも表示されます (たとえば、存在しないとマークされているzsnes:i386(例))。明示的なスキーマのないパッケージが最初に出てくるので(負債タグの事前ソートアルゴリズムで...)必要がない場合は、追加の項目を表示することを心配する必要はありません。hardware::emulationzsneszsnes:amd64:i386

更新:必要に応じて、スタンドアロンスクリプトファイルに同じawkスクリプトを/usr/local/bin/debtagsfilterに入れて、次のものを含めました。

#!/usr/bin/awk -f
BEGIN           {
                        FS="[: ]"
                }
! ($1 in seen)  {
                        print
                        seen[$1]=1
                }

そして()を介して実行可能にします。chmod a+rx /usr/local/bin/filterdebtagsたとえば、次のように使用できます。debtags search 'works-with-format::man' | filterdebtags

または、負債タグの「新しい」バージョンが望ましい場合(したがって呼び出しスクリプト言語/usr/local/bin/debtagswithfilterに置き換えます):sh

#!/bin/sh
debtags "$@" | awk '
BEGIN           {
                        FS="[: ]"
                }
! ($1 in seen)  {
                        print
                        seen[$1]=1
                }
'

比較(おそらく複数のストレージソースのために一般的な二重値が表示されます):

$ debtags search 'hardware::emulation'

[...]

xtrs - emulator for TRS-80 Model I/III/4/4P computers
xtrs:i386 - emulator for TRS-80 Model I/III/4/4P computers
yabause - beautiful and under-rated Saturn emulator
yabause - beautiful and under-rated Saturn emulator
yabause-gtk - beautiful and under-rated Saturn emulator - Gtk port
yabause-gtk - beautiful and under-rated Saturn emulator - Gtk port
yabause-gtk:i386 - beautiful and under-rated Saturn emulator - Gtk port
yabause-gtk:i386 - beautiful and under-rated Saturn emulator - Gtk port
yabause-qt - beautiful and under-rated Saturn emulator - Qt port
yabause-qt - beautiful and under-rated Saturn emulator - Qt port
yabause-qt:i386 - beautiful and under-rated Saturn emulator - Qt port
yabause-qt:i386 - beautiful and under-rated Saturn emulator - Qt port
zsnes:i386 - Emulator of the Super Nintendo Entertainment System

そして:

$ debtagswithfilter search 'hardware::emulation'

[...]

xtrs - emulator for TRS-80 Model I/III/4/4P computers
yabause - beautiful and under-rated Saturn emulator
yabause-gtk - beautiful and under-rated Saturn emulator - Gtk port
yabause-qt - beautiful and under-rated Saturn emulator - Qt port
zsnes:i386 - Emulator of the Super Nintendo Entertainment System

より複雑な検索要求でも機能します。

$ debtagswithfilter search 'works-with-format::tex && interface::text-mode'
asymptote - script-based vector graphics language inspired by MetaPost
auctex - integrated document editing environment for TeX etc.
axiom-tex - General purpose computer algebra system: style file for TeX
bibcursed - Interactive program to edit BibTeX bibliographies
chktex - Finds typographic errors in LaTeX
fweb - literate-programming tool for C/C++/Fortran/Ratfor
groff - GNU troff text-formatting system
vim-latexsuite - view, edit and compile LaTeX documents from within Vim
yatex - Yet Another TeX mode for Emacs

おすすめ記事