summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2018-02-12 14:57:09 +0100
committerRemi Collet <remi@remirepo.net>2018-02-12 14:57:09 +0100
commitbdf446bca89cd818aa14f845d912fd619c78295f (patch)
tree97a0b5955021347581eac86072ceed5442c9b842
parent702d21b778b6e3a0d962b64a86735f824e9252c5 (diff)
files list retrieval (examples)
-rw-r--r--examples/librpm.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/examples/librpm.php b/examples/librpm.php
index b012e54..f1ea7e9 100644
--- a/examples/librpm.php
+++ b/examples/librpm.php
@@ -29,6 +29,14 @@ abstract class Common {
return $ret;
}
+ protected function _files() {
+ $ret = [];
+ for ($i=0 ; $i<count($this->info['Basenames']) ; $i++) {
+ $ret[] = $this->info['Dirnames'][$this->info['Dirindexes'][$i]] . $this->info['Basenames'][$i];
+ }
+ return $ret;
+ }
+
public function __get($name) {
switch ($name) {
case 'EVR':
@@ -63,6 +71,10 @@ abstract class Common {
if (isset($this->info['Providename'])) {
return $this->_dep($this->info['Providename'], $this->info['Provideflags'], $this->info['Provideversion']);
}
+ case 'Files':
+ if (isset($this->info['Basenames'])) {
+ return $this->_files();
+ }
default:
if (isset($this->info[$name])) {
return $this->info[$name];
@@ -115,11 +127,9 @@ class Package extends Common {
}
+
/*
$a = new File(dirname(__DIR__).'/tests/bidon.rpm');
-echo "Requires: "; print_r($a->Requires);
-echo "Provides: "; print_r($a->Provides);
-echo "Conflicts: "; print_r($a->Conflicts);
-echo "Obsoletes: "; print_r($a->Obsoletes);
+$a = new Package('php-cli');
+print_r($a->Files);
*/
-