Skip to content

Commit

Permalink
Translate new rmpinfo functions (#1970)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fan2Shrek authored Dec 23, 2024
1 parent 8198a95 commit cffa894
Show file tree
Hide file tree
Showing 3 changed files with 304 additions and 0 deletions.
109 changes: 109 additions & 0 deletions reference/rpminfo/functions/rpmdefine.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: fda48b4083fd591a243f85c432e0cc2cb5ecfe20 Maintainer: Fan2Shrek Status: ready -->
<!-- Reviewed: yes -->
<refentry xml:id="function.rpmdefine" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>rpmdefine</refname>
<refpurpose>Définit ou change la valeur d'une macro RPM</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>rpmdefine</methodname>
<methodparam><type>string</type><parameter>text</parameter></methodparam>
</methodsynopsis>
<para>
Définit ou change la valeur d'une macro RPM.
</para>
<para>
Cela peut être utilisé pour sélectionner le chemin de la base de données et le "backend" à utiliser
au lieu de celui par défaut du système.
</para>

</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>text</parameter></term>
<listitem>
<para>
Le nom de la macro, les options, le corps.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Un exemple de <function>rpmdefine</function></title>
<programlisting role="php">
<![CDATA[
<?php
// utilise une ancienne base de données (bdb) d'un chroot EL-8
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"]);
// utilise une nouvelle base de données (sqlite) d'un chroot Fedora-41
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"]);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
AlmaLinux release file
Fedora release files
]]>
</screen>
</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>rpmexpand</function></member>
<member><function>rpmdbinfo</function></member>
</simplelist>
</para>
</refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
96 changes: 96 additions & 0 deletions reference/rpminfo/functions/rpmexpand.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: fda48b4083fd591a243f85c432e0cc2cb5ecfe20 Maintainer: Fan2Shrek Status: ready -->
<!-- Reviewed: yes -->
<refentry xml:id="function.rpmexpand" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>rpmexpand</refname>
<refpurpose>Récupère la valeur étendue d'un macro RPM</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>rpmexpand</methodname>
<methodparam><type>string</type><parameter>text</parameter></methodparam>
</methodsynopsis>
<para>
Récupère la valeur étendue d'un macro RPM.
</para>

</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>text</parameter></term>
<listitem>
<para>
Le texte avec les macros RPM à étendre.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Un <type>string</type> avec les macro(s) étendue(s) concaténée(s).
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Un exemple de <function>rpmexpand</function></title>
<programlisting role="php">
<![CDATA[
<?php
$distro = rpmexpand("%{?fedora:Fedora %{fedora}}%{?rhel:Enterprise Linux %{rhel}}");
print_r($distro);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Fedora 41
]]>
</screen>
</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>rpmexpandnumeric</function></member>
</simplelist>
</para>
</refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
99 changes: 99 additions & 0 deletions reference/rpminfo/functions/rpmexpandnumeric.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: fda48b4083fd591a243f85c432e0cc2cb5ecfe20 Maintainer: Fan2Shrek Status: ready -->
<!-- Reviewed: yes -->
<refentry xml:id="function.rpmexpandnumeric" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>rpmexpandnumeric</refname>
<refpurpose>Récupère la valeur numérique d'un macro RPM</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>rpmexpandnumeric</methodname>
<methodparam><type>string</type><parameter>text</parameter></methodparam>
</methodsynopsis>
<para>
Récupère la valeur numérique d'un macro RPM.
</para>

</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>text</parameter></term>
<listitem>
<para>
Le texte avec les macros RPM à étendre.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
L'expansion de la macro en tant que <type>int</type>.
Les valeurs booléennes (<literal>Y</literal> ou <literal>y</literal> retourne 1,
<literal>N</literal> ou <literal>n</literal> retourne <literal>0</literal>)
sont également permises. Une macro non définie retourne <literal>0</literal>.
</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Un exemple <function>rpmexpandnumeric</function></title>
<programlisting role="php">
<![CDATA[
<?php
$bits = rpmexpandnumeric("%__isa_bits");
print_r($bits);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
64
]]>
</screen>
</example>
</para>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>rpmexpand</function></member>
</simplelist>
</para>
</refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

0 comments on commit cffa894

Please sign in to comment.