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

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top