PHP 8.4.2 Released!

rpmdefine

(PECL rpminfo >= 1.2.0)

rpmdefineDefine or change a RPM macro value

说明

rpmdefine(string $text): bool

Define or change a RPM macro value.

This can be used to select the database path and backend to use instead of system default one.

参数

text

Macro name, options, body.

返回值

成功时返回 true, 或者在失败时返回 false

示例

示例 #1 A rpmdefine() example

<?php
// use an old database (bdb) from an EL-8 chroot
rpmdefine("_dbpath /var/lib/mock/almalinux-8-x86_64/root/var/lib/rpm");
rpmdefine("_db_backend bdb_ro");
print_r(rpmdbinfo("almalinux-release")[0]["Summary"]);

// use a new database (sqlite) from a Fedora-41 chroot
rpmdefine("_dbpath /var/lib/mock/fedora-41-x86_64/root/usr/lib/sysimage/rpm");
rpmdefine("_db_backend sqlite");
print_r(rpmdbinfo("fedora-release")[0]["Summary"]);
?>

以上示例会输出:

AlmaLinux release file
Fedora release files

参见

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top