Ref/rpminfo-Phpdoc专题
rpmaddtag
Add tag retrieved in query
说明
bool rpmaddtag
( int $tag
)
Add an additional retrieved tag in subsequent queries.
参数
tag
One of RPMTAG_* constant, see the
rpminfo constants
page.
返回值
成功时返回 true, 或者在失败时返回 false。
参见
- rpminfo
- rpmdbinfo
- rpmdbsearch
rpmdbinfo
Get information from installed RPM
说明
array <span
class="methodname">rpmdbinfo ( <span
class="type">string $nevr [, <span
class="methodparam">bool $full<span
class="initializer"> = false ] )
Retrieve information about an installed package, from the system RPM database.
参数
nevr
Name with optional epoch, version and release.
full
If true all information headers for the file are retrieved, else
only a minimal set.
返回值
An array of array of information or NULL on error.
参见
- rpmaddtag
范例
示例 #1 A rpmdbinfo example
<?php
rpmaddtag(RPMTAG_INSTALLTIME);
$info = rpmdbinfo("php-pecl-rpminfo");
print_r($info);
?>
以上例程会输出:
Array
(
[0] => Array
(
[Name] => php-pecl-rpminfo
[Version] => 0.4.2
[Release] => 1.fc31
[Summary] => RPM information
[Installtime] => 1586244687
[Arch] => x86_64
)
)
rpmdbsearch
Search RPM packages
说明
array <span
class="methodname">rpmdbsearch ( <span
class="type">string $pattern [, <span
class="methodparam">int $rpmtag<span
class="initializer"> = RPMTAG_NAME [, <span
class="methodparam">int $rpmmire<span
class="initializer"> = -1 [, <span
class="methodparam">bool $full<span
class="initializer"> = false ]]] )
Search packages in the system RPM database.
参数
pattern
Value to search for.
rpmtag
Search criterion, one of RPMTAG_* constant, see the
rpminfo constants
page.
rpmmire
Pattern type, one of RPMMIRE_* constant, see the
rpminfo constants
page. When \< 0 the criterion must equals the value, and database index
is used if possible.
full
If true all information headers for the file are retrieved, else
only a minimal set.
返回值
An array of array of information or NULL on error.
参见
- rpmaddtag
范例
示例 #1 Searching for the package owning a file
<?php
$info = rpmdbsearch("/usr/bin/php", RPMTAG_INSTFILENAMES);
print_r($info);
?>
以上例程会输出:
Array
(
[0] => Array
(
[Name] => php-cli
[Version] => 7.4.4
[Release] => 1.fc32
[Summary] => Command-line interface for PHP
[Arch] => x86_64
)
)
rpminfo
Get information from a RPM file
说明
array rpminfo
( string
$path [, <span
class="type">bool $full =
false [, <span
class="type">string &$error ]] )
Retrieve information about a local file, a RPM package.
参数
path
Path of the RPM file.
full
If true all information headers for the file are retrieved, else
only a minimal set.
error
If provided, will receive the possible error message, and will avoid a
runtime warning.
返回值
An array of information or NULL on error.
参见
- rpmaddtag
范例
示例 #1 A rpminfo example
<?php
rpmaddtag(RPMTAG_BUILDTIME);
$info = rpminfo("./php-pecl-rpminfo-0.4.2-1.el8.remi.7.4.x86_64.rpm");
print_r($info);
?>
以上例程会输出:
Array
(
[Name] => php-pecl-rpminfo
[Version] => 0.4.2
[Release] => 1.el8
[Summary] => RPM information
[Buildtime] => 1586244821
[Arch] => x86_64
)
rpmvercmp
RPM version comparison
说明
int rpmvercmp
( string
$evr1 , <span
class="type">string $evr2 )
Compare 2 RPM versions.
参数
evr1
First epoch:version-release string
evr2
Second epoch:version-release string
返回值
Returns \< 0 if evr1 is less than evr2, > 0 if evr1 is greater than evr2, and 0 if they are equal.
目录
- rpmaddtag — Add tag retrieved in query
- rpmdbinfo — Get information from installed RPM
- rpmdbsearch — Search RPM packages
- rpminfo — Get information from a RPM file
- rpmvercmp — RPM version comparison