arch-expac

1. DESCRIPTION 描述
2. OPTIONS 选项
3. Formatting 格式字段列表
4. EXAMPLES 举例

1. DESCRIPTION 描述

expac是用于alpm数据库的数据提取工具。
它具有类似于printf的灵活性,旨在用作不与该库链接的其他基于pacman的实用程序的简单工具。它使用pacman.conf作为配置文件来查找和加载本地数据库和同步数据库。调用expac包括提供一个格式字符串,通常由一对多的格式标记(请参阅FORMATTING部分),任何相关选项以及从零到多个目标来描述。格式字符串必须是第一个非选项参数。目标可以是简单的程序包名称,查询字符串(对于搜索而言),或者在提供-sync选项时使用repo/package语法。
简单的说, 该命令可以获取pacman -Si或-Qi的所有字段的信息, 按照想要的格式输出. 当然会比-Si更好用, 更灵活.

2. OPTIONS 选项

-Q, --query Search the local database for provided targets. This is the default behavior. 在本地数据库中搜索提供的目标。这是默认行为。
-S, --sync Search the sync databases for provided targets. 在同步数据库中搜索提供的目标。
-s, --search Search for packages matching the strings specified by targets. This is a boolean AND query and regex is allowed. 搜索与目标指定的字符串匹配的软件包。这是布尔AND查询,并且允许使用正则表达式。
-g, --group Return packages matching the specified targets as package groups. 将与指定目标匹配的软件包作为软件包组返回。
--config <file> Read from file for alpm initialization instead of /etc/pacman.conf. 从文件读取进行alpm初始化,而不是/etc/pacman.conf。
-H, --humansize <size> Format package sizes in SI units according to size. Valid options are: B, K, M, G, T, P, E, Z, Y 根据尺寸以SI单位格式化包装尺寸。有效选项包括: B,K,M,G,T,P,E,Z,Y
-1, --readone Stop searching after the first result. This only has an effect on -S operations without -s. 在第一个结果之后停止搜索。这仅对不带-s的-S操作有影响。
-d, --delim <string> Separate each package with the specified string. The default value is a newline character. 用指定的字符串分隔每个程序包。默认值为换行符。
-l, --listdelim <string> Separate each list item with the specified string. Lists are any interpreted sequence specified with a capital letter. The 用指定的字符串分隔每个列表项。列表是用大写字母指定的任何解释序列。的
-p, --file Interpret targets as paths to local files. 将目标解释为本地文件的路径。
-t, --timefmt <format> Output time described by the specified format. This string is passed directly to strftime(3). The default format is %c. 输出时间以指定格式描述。该字符串直接传递到strftime(3)。默认格式为%c。
-v, --verbose Output more. `Package not found' errors will be shown, and empty field values will display as 'None'. 输出更多。将显示“未找到软件包”错误,空白字段值将显示为“无”。
-V, --version Display version information and quit. 显示版本信息并退出。
-h, --help Display the help message and quit. 显示帮助消息并退出。

  -t, --timefmt <format>
$ man strftime
  %F - Equivalent to %Y-%m-%d (the ISO 8601 date format). (C99)
  '%Y-%m-%d %H:%M'
https://linux.die.net/man/3/strftime
https://apidock.com/ruby/DateTime/strftime
Combination:
  %c - date and time (%a %b %e %T %Y)
  %D - Date (%m/%d/%y)
  %F - The ISO 8601 date format (%Y-%m-%d)
  %v - VMS date (%e-%b-%Y)
  %x - Same as %D
  %X - Same as %T
  %r - 12-hour time (%I:%M:%S %p)
  %R - 24-hour time (%H:%M)
  %T - 24-hour time (%H:%M:%S)
  %+ - date(1) (%a %b %e %H:%M:%S %Z %Y)

3. Formatting 格式字段列表

-Si -Qi Item... 内容举例: gedit expac Item… field ( ) format参数允许以下解释的序列:
Repository extra repo %r (-S)Q 仓库名
Name gedit package name %n   包裹名字
Version 3.36.2-1 version %v  
Description GNOME Text Editor description %d   描述
Architecture x86_64 architecture %a   建筑
URL https://wiki.gnome.org/Apps/Gedit project URL %u   项目网址
Licenses GPL licenses %L   执照
Groups gnome groups %G  
Provides None *.so provides %P   提供
%S no ver
Depends On Gtksourceview4 … depends on %D   依赖于
%E no ver
Optional Deps gedit-plugins: Additional features optional deps %O   可选的依赖项
%o no des  
Required By None required by %N (-Q) 需求
Optional For None        
Conflicts With Gedit-code-assistance… conflicts with %H   与...发生冲突
%C no ver
Replaces None replaces %T   取代
%R no ver
Download Size 2.21 MiB download size %k (-S) 下载大小(仅适用于-S)
Installed Size 14.31 MiB install size %m   安装尺寸
Packager Jan Alexander Steffens (heftig)… packager name %p   包装名称
Build Date 2020-04-26T03:11:37 CST build date %b   建立日期
Install Date 2020-07-31T08:11:54 CST install date %l (-Q) 安装日期(仅适用于-Q)
Install Reason Explicitly installed install reason %w (-Q) 安装原因(仅适用于-Q)
Install Script No has install scriptlet %i (-Q) 已安装脚本(仅与-Q一起使用)
Validated By MD5 Sum SHA-256 Sum Signature
Signature
package validation method %V   包验证方法
  gedit package base %e   包装基础
    backup files %B   备份文件
    modified backup files %M (-Q) 修改后的备份文件(仅与-Q一起使用)
  *.pkg.tar.zst filename %f (-S) 文件名(仅用于-S)
  -Ql files %F (-Q) 文件(仅与-Q一起使用)
  base64 encoded PGP signature %g (-S) base64编码的PGP签名(仅适用于-S)
  sha256sum %h   sha256sum
  md5sum %s   md5sum
  0 result number %!   结果编号(自动递增的计数器,从0开始)
  % literal % %%   文字%

4. EXAMPLES 举例

$ expac -Q '%n%v%d%a%u%L%G%S%E%o%N%C%R%m%p%b%l%w%i%V' -l ' ' -H M -t "%F" > temp.txt
$ expac -Q '%n %v %d %a %u %L %G %S %E %o %N %C %R %m %p %b %l %w %i %V' -H M -t "%F" > temp.txt
$ expac -Q '%n %v %d %a %u %L %G %S %E %o %N %C %R %m %p %b %l %w %i %V' -H M -t '%Y-%m-%d %H:%M' > temp.txt
一次列出所有软件包的主要20个字段信息写入temp.txt文件, 打开全选, 复制到xls表格文件.
注: 最有一列[可选], 提供更详细的内容.

field Item 中文描述 可选
%n Name 包名  
%v Version  
%d Description 描述  
%a Architecture 建筑  
%u URL 项目网址  
%L Licenses 执照  
%G Groups  
%S Provides 提供(无版本) %P
%E Depends On 依赖于(无版本) %D
%o Optional Deps 可选的依赖项(无描述) %O
%N Required By 需求  
%C Conflicts With 与...发生冲突(无版本) %H
%R Replaces 替换(无版本字符串) %T
%m Installed Size 安装尺寸  
%p Packager 包装名称  
%b Build Date 建立日期  
%l Install Date 安装日期(仅适用于-Q)  
%w Install Reason 安装原因(仅适用于-Q)  
%i Install Script 已安装脚本(仅适用于-Q)  
%V Validated By 包验证方法  
 
原文地址:https://www.cnblogs.com/sztom/p/13422996.html