summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yaml43
-rw-r--r--CHANGELOG.md114
-rw-r--r--README.md2
-rw-r--r--composer.json1
-rw-r--r--package.xml25
-rw-r--r--php_rpminfo.h2
-rw-r--r--rpminfo.c16
-rw-r--r--tests/004-constants.phpt2
-rw-r--r--tests/008-rpmdbsearch.phpt11
9 files changed, 194 insertions, 22 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 1663d4a..792341d 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -11,7 +11,7 @@ jobs:
matrix:
distro: ['rockylinux']
el: [8]
- php: ['8.0', '8.2', 'remi-8.0', 'remi-8.1', 'remi-8.2', 'remi-8.3', 'remi-8.4']
+ php: ['8.0', '8.2', 'remi-8.0', 'remi-8.1', 'remi-8.2', 'remi-8.3', 'remi-8.4', 'remi-8.5']
container:
image: ${{ matrix.distro }}:${{ matrix.el }}
steps:
@@ -43,7 +43,7 @@ jobs:
matrix:
distro: ['rockylinux']
el: [9]
- php: [0, '8.1', '8.2', 'remi-8.0', 'remi-8.1', 'remi-8.2', 'remi-8.3', 'remi-8.4']
+ php: [0, '8.2', '8.3', 'remi-8.0', 'remi-8.1', 'remi-8.2', 'remi-8.3', 'remi-8.4', 'remi-8.5']
container:
image: ${{ matrix.distro }}:${{ matrix.el }}
steps:
@@ -69,12 +69,47 @@ jobs:
TEST_PHP_ARGS: '-q --show-diff'
run: |
make test
+ Linux_EL10:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ distro: ['almalinux']
+ el: [10]
+ php: [0, 'remi-8.0', 'remi-8.1', 'remi-8.2', 'remi-8.3', 'remi-8.4', 'remi-8.5']
+ container:
+ image: ${{ matrix.distro }}:${{ matrix.el }}
+ steps:
+ - name: Install gzip
+ run: |
+ dnf install -y "gzip"
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Setup PHP module
+ if: ${{ matrix.php }}
+ run: |
+ dnf install -y "https://rpms.remirepo.net/enterprise/remi-release-${{ matrix.el }}.rpm"
+ dnf module enable -y "php:${{ matrix.php }}"
+ - name: Install PHP
+ run: |
+ dnf install -y "php" "php-devel" "rpm-devel"
+ - name: Show PHP version
+ run: php -v
+ - name: Make php-rpminfo
+ run: |
+ phpize
+ ./configure
+ make -j"$(nproc)"
+ - name: Test php-rpminfo
+ env:
+ TEST_PHP_ARGS: '-q --show-diff'
+ run: |
+ make test
Linux_Fedora:
runs-on: ubuntu-latest
strategy:
matrix:
- fedora: [40, 41]
- php: [0, 'remi-8.0', 'remi-8.1', 'remi-8.2', 'remi-8.3', 'remi-8.4']
+ fedora: [42, 43]
+ php: [0, 'remi-8.0', 'remi-8.1', 'remi-8.2', 'remi-8.3', 'remi-8.4', 'remi-8.5']
container:
image: fedora:${{ matrix.fedora }}
steps:
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..676cb3d
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,114 @@
+# Unreleased
+
+-
+
+# Version 1.2.1 - 2025-09-25
+
+- use `RPMTAG_SIGMD5` instead of `RPMTAG_PKGID` removed in RPM 6
+- use `RPMTAG_SHA1HEADER` instead of `RPMTAG_HDRID` removed in RPM 6
+
+# Version 1.2.0 - 2024-12-19
+
+- add `rpmexpand`, `rpmexpandnumeric` to retrieve rpm macro value
+- add `rpmdefine` to set rpm macro value
+
+# Version 1.1.1 - 2024-09-03
+
+- display author and license in phpinfo
+- drop support for librpm < 4.13
+
+# Version 1.1.0 - 2023-11-10
+
+- check open_basedir restriction
+- new function: `rpmgetsymlink(string $path, string $name): ?string`
+
+# Version 1.0.1 - 2023-10-13
+
+- fix stack smashing on 32-bit
+- allow retrieval of hardlink content
+
+# Version 1.0.0 - 2023-10-12
+
+- implement rpm stream wrapper with librpm >= 4.13
+
+# Version 0.7.0 - 2023-09-26
+
+- add optional operator to `rpmcmpver` for consistency with version_compare
+- drop support for PHP 7
+
+# Version 0.6.0 - 2021-06-18
+
+- generate arginfo from stub and add missing default values
+- raise dependency on PHP 7.2
+- raise exception on bad parameter value with PHP 8
+
+# Version 0.5.1 - 2020-09-23
+
+- split tests for PHP 7/8
+- improve librpm example
+
+# Version 0.5.0 - 2020-04-07
+
+- add `rpmaddtag()` function
+
+# Version 0.4.2 - 2020-03-25
+
+- improve reflection with better parameter names
+- speed optimization: open DB only once per request
+
+# Version 0.4.1 - 2020-03-18
+
+- fix build with RPM 4.12 (Fedora 21-22 only)
+- add type hinting in reflection
+- return `NULL` instead of `FALSE` on failure
+
+# Version 0.4.0 - 2020-03-13
+
+- improve search logic, use index when exists and no search mode
+- add 'full' parameter to `rpmdbsearch`
+- allow `rpmdbinfo` to search on NEVR (instead of name only)
+- first "stable" release
+
+# Version 0.3.1 - 2020-03-12
+
+- allow search by Pkgid, Hdrid, Installtid with specific input
+- fix search with various other tags (Version, ...)
+
+# Version 0.3.0 - 2020-03-12
+
+- add `rpmdbsearch` function to search packages using
+ name, installed files, requires, provides...
+
+# Version 0.2.3 - 2020-03-11
+
+- fix gh#2 free allocated iterators to avoid "DB2053 Freeing read locks..." messages
+
+# Version 0.2.2 - 2020-03-11
+
+- Fix gh#1 `rpmvercmp()` incorrect comparison result
+
+# Version 0.2.1 - 2018-02-12
+
+- add summary in minimal information set
+- retrieve array from metadata
+- add `RPMSENSE_*` macros
+
+# Version 0.2.0 - 2018-02-08
+
+- new function:
+ `array rpmdbinfo(string name [, bool full]);`
+
+# Version 0.1.3 - 2018-02-08
+
+- first pecl release
+- `rpminfo()`: add option to retrieve error message instead of raising a warning
+
+# Version 0.1.1 - 2018-01-26
+
+- fix segfault in ZTS mode
+- define `RPMVERSION` constant
+
+# Version 0.1.0 - 2018-01-26
+- first release with 2 functions:
+ `int rpmvercmp(string evr1, string evr2);`
+ `array rpminfo(string path [, bool full]);`
diff --git a/README.md b/README.md
index 6efd10c..9d19947 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+[![CI](https://github.com/remicollet/rpminfo/actions/workflows/ci.yaml/badge.svg)](https://github.com/remicollet/rpminfo/actions/workflows/ci.yaml)
+
# RPM information extension for PHP
Retrieve RPM information from PHP code using librpm.
diff --git a/composer.json b/composer.json
index a76d2b7..e7e64cc 100644
--- a/composer.json
+++ b/composer.json
@@ -8,6 +8,7 @@
},
"php-ext": {
"extension-name": "rpminfo",
+ "os-families": "linux",
"configure-options": []
}
}
diff --git a/package.xml b/package.xml
index cc52b72..58b197e 100644
--- a/package.xml
+++ b/package.xml
@@ -13,9 +13,9 @@ Documentation: https://www.php.net/rpminfo
<email>remi@php.net</email>
<active>yes</active>
</lead>
- <date>2024-12-19</date>
+ <date>2025-09-25</date>
<version>
- <release>1.2.0</release>
+ <release>1.2.1</release>
<api>1.2.0</api>
</version>
<stability>
@@ -24,8 +24,8 @@ Documentation: https://www.php.net/rpminfo
</stability>
<license uri="https://www.php.net/license/3_01.txt" filesource="LICENSE">PHP-3.01</license>
<notes><![CDATA[
-- add rpmexpand, rpmexpandnumeric to retrieve rpm macro value
-- add rpmdefine to set rpm macro value
+- use RPMTAG_SIGMD5 instead of RPMTAG_PKGID removed in RPM 6
+- use RPMTAG_SHA1HEADER instead of RPMTAG_HDRID removed in RPM 6
]]></notes>
<contents>
<dir name="/">
@@ -39,6 +39,7 @@ Documentation: https://www.php.net/rpminfo
<file name="CREDITS" role="doc"/>
<file name="LICENSE" role="doc"/>
<file name="README.md" role="doc"/>
+ <file name="CHANGELOG.md" role="doc"/>
<dir name ="examples">
<file name="repomanage.php" role="doc"/>
<file name="rpmvercmp.php" role="doc"/>
@@ -78,6 +79,22 @@ Documentation: https://www.php.net/rpminfo
<extsrcrelease/>
<changelog>
<release>
+ <date>2024-12-19</date>
+ <version>
+ <release>1.2.0</release>
+ <api>1.2.0</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
+ <license uri="https://www.php.net/license/3_01.txt" filesource="LICENSE">PHP-3.01</license>
+ <notes><![CDATA[
+- add rpmexpand, rpmexpandnumeric to retrieve rpm macro value
+- add rpmdefine to set rpm macro value
+ ]]></notes>
+ </release>
+ <release>
<date>2024-09-03</date>
<version>
<release>1.1.1</release>
diff --git a/php_rpminfo.h b/php_rpminfo.h
index aca0f52..68a8694 100644
--- a/php_rpminfo.h
+++ b/php_rpminfo.h
@@ -22,7 +22,7 @@
extern zend_module_entry rpminfo_module_entry;
#define phpext_rpminfo_ptr &rpminfo_module_entry
-#define PHP_RPMINFO_VERSION "1.2.0"
+#define PHP_RPMINFO_VERSION "1.2.1"
#define PHP_RPMINFO_AUTHOR "Remi Collet"
#define PHP_RPMINFO_LICENSE "PHP-3.01"
diff --git a/rpminfo.c b/rpminfo.c
index ae8b8e7..a32a45a 100644
--- a/rpminfo.c
+++ b/rpminfo.c
@@ -399,22 +399,22 @@ PHP_FUNCTION(rpmdbsearch)
RETURN_THROWS();
}
- if (crit == RPMTAG_PKGID) {
+ if (crit == RPMTAG_INSTALLTID) {
+ tid = atol(name);
+ name = (char *)&tid;
+ len = sizeof(tid);
+ } else if (crit == RPMTAG_SIGMD5) {
if (len != 32) {
- zend_argument_value_error(1, "Bad length for PKGID, 32 expected");
+ zend_argument_value_error(1, "Bad length for PKGID/SIGMD5, 32 expected");
RETURN_THROWS();
}
len = hex2bin(name, MD5, len);
name = MD5;
- } else if (crit == RPMTAG_HDRID) {
+ } else if (crit == RPMTAG_SHA1HEADER) {
if (len != 40) {
- zend_argument_value_error(1, "Bad length for HDRID, 40 expected");
+ zend_argument_value_error(1, "Bad length for HDRID/SHA1HEADER, 40 expected");
RETURN_THROWS();
}
- } else if (crit == RPMTAG_INSTALLTID) {
- tid = atol(name);
- name = (char *)&tid;
- len = sizeof(tid);
} else if (crit == RPMTAG_INSTFILENAMES) {
/* use input parameters */
} else {
diff --git a/tests/004-constants.phpt b/tests/004-constants.phpt
index 397c97f..18104cc 100644
--- a/tests/004-constants.phpt
+++ b/tests/004-constants.phpt
@@ -8,5 +8,5 @@ var_dump(RPMVERSION);
?>
Done
--EXPECTF--
-string(%d) "4.%s"
+string(%d) "%s"
Done
diff --git a/tests/008-rpmdbsearch.phpt b/tests/008-rpmdbsearch.phpt
index f348b92..6e0e402 100644
--- a/tests/008-rpmdbsearch.phpt
+++ b/tests/008-rpmdbsearch.phpt
@@ -1,7 +1,10 @@
--TEST--
Check for rpmdbinfo function
--SKIPIF--
-<?php if (!extension_loaded("rpminfo")) print "skip"; ?>
+<?php
+if (!extension_loaded("rpminfo")) print "skip";
+?>
+
--FILE--
<?php
echo "Name / glob\n";
@@ -20,16 +23,16 @@ $phprpm = $a[0]['Name'];
$p = rpmdbinfo($phprpm, 1);
echo "Pkgid\n";
-$a = rpmdbsearch($p[0]['Sigmd5'], RPMTAG_PKGID);
+$a = rpmdbsearch($p[0]['Sigmd5'], RPMTAG_SIGMD5);
var_dump($a[0]['Name'] == $phprpm);
echo "Hdrid\n";
-$a = rpmdbsearch($p[0]['Sha1header'], RPMTAG_HDRID);
+$a = rpmdbsearch($p[0]['Sha1header'], RPMTAG_SHA1HEADER);
var_dump($a[0]['Name'] == $phprpm);
var_dump(count($a[0]) < 10);
echo "Hdrid (full)\n";
-$a = rpmdbsearch($p[0]['Sha1header'], RPMTAG_HDRID, -1, true);
+$a = rpmdbsearch($p[0]['Sha1header'], RPMTAG_SHA1HEADER, -1, true);
var_dump($a[0]['Name'] == $phprpm);
var_dump($a[0]['Sha1header'] == $p[0]['Sha1header']);
var_dump(count($a[0]) > 20);