From ba8ff7f35e870a10bb0bd68b3ba0ec9ab43b8576 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 19 Oct 2023 12:29:15 +0200 Subject: add symlink --- rpminfo.c | 4 ++-- tests/003-rpminfo.phpt | 2 +- tests/005-rpminfo-full.phpt | 4 +++- tests/014-stream.phpt | 27 ++++++++++++++++++++------- tests/bidon.rpm | Bin 7492 -> 7599 bytes tests/bidon.spec | 9 +++++++-- 6 files changed, 33 insertions(+), 13 deletions(-) diff --git a/rpminfo.c b/rpminfo.c index adc7629..ab2ebf1 100644 --- a/rpminfo.c +++ b/rpminfo.c @@ -705,10 +705,10 @@ static struct php_rpm_stream_data_t *php_stream_rpm_finder(const char *path, int while((rc = rpmfiNext(fi)) >=0) { const char *fn = rpmfiFN(fi); /* - printf("Name=%s, Size=%d, N=%d, mode=%d, reg=%d, content=%d, rdev=%d, inode=%d\n", fn, + printf("Name=%s, Size=%d, N=%d, mode=%d, reg=%d, content=%d, rdev=%d, inode=%d link=%s\n", fn, (int)rpmfiFSize(fi), (int)rpmfiFNlink(fi), (int)rpmfiFMode(fi), (int)S_ISREG(rpmfiFMode(fi)), (int)rpmfiArchiveHasContent(fi), - (int)rpmfiFRdev(fi), (int)rpmfiFInode(fi)); + (int)rpmfiFRdev(fi), (int)rpmfiFInode(fi), rpmfiFLink(fi)); */ if (!strcmp(fn, fragment)) { if (want_content && S_ISREG(rpmfiFMode(fi)) && !rpmfiArchiveHasContent(fi)) { diff --git a/tests/003-rpminfo.phpt b/tests/003-rpminfo.phpt index c1c5d2a..919bcc9 100644 --- a/tests/003-rpminfo.phpt +++ b/tests/003-rpminfo.phpt @@ -14,7 +14,7 @@ array(5) { ["Version"]=> string(1) "1" ["Release"]=> - string(11) "2.fc37.remi" + string(1) "3" ["Summary"]=> string(5) "Bidon" ["Arch"]=> diff --git a/tests/005-rpminfo-full.phpt b/tests/005-rpminfo-full.phpt index 90080da..15c158d 100644 --- a/tests/005-rpminfo-full.phpt +++ b/tests/005-rpminfo-full.phpt @@ -24,8 +24,10 @@ Done --- bidon.rpm --- string(5) "bidon" string(15) "A dummy package" -array(1) { +array(2) { [0]=> + string(14) "- add symlinks" + [1]=> string(20) "- add some hardlinks" } bool(false) diff --git a/tests/014-stream.phpt b/tests/014-stream.phpt index 37b41dd..95f815e 100644 --- a/tests/014-stream.phpt +++ b/tests/014-stream.phpt @@ -12,17 +12,21 @@ $n = "rpm://" . __DIR__ . "/bidon.rpm#/usr/share/doc/bidon/README"; $x = "rpm://" . __DIR__ . "/bidon.rpm#/usr/share/doc/bidon/MISSING"; $foo = "rpm://" . __DIR__ . "/bidon.rpm#/etc/foo.conf"; $bar = "rpm://" . __DIR__ . "/bidon.rpm#/etc/bar.conf"; +$toto = "rpm://" . __DIR__ . "/bidon.rpm#/etc/toto.conf"; echo "+ wrapper\n"; var_dump(in_array('rpm', stream_get_wrappers())); echo "+ stat\n"; $s = stat($d); // S_ISDIR -var_dump($s['size'], $s['mode'] , $s['mode'] & 0040000 ? "OK" : "KO"); -var_dump(file_exists($d), is_dir($d), is_file($d)); +var_dump($s['size'], $s['mode'] , ($s['mode'] & 0170000) == 0040000 ? "OK" : "KO"); +var_dump(file_exists($d), is_dir($d), is_file($d), is_link($n)); $s = stat($n); // S_ISREG -var_dump($s['size'], $s['mode'] , $s['mode'] & 0100000 ? "OK" : "KO"); -var_dump(file_exists($n), is_dir($n), is_file($n)); +var_dump($s['size'], $s['mode'] , ($s['mode'] & 0170000) == 0100000 ? "OK" : "KO"); +var_dump(file_exists($n), is_dir($n), is_file($n), is_link($n)); +$s = stat($toto); // S_ISLNK +var_dump($s['size'], $s['mode'] , ($s['mode'] & 0170000) == 0120000 ? "OK" : "KO"); +var_dump(file_exists($toto), is_dir($toto), is_file($toto), is_link($toto)); echo "+ file\n"; var_dump($f = fopen($n, "r")); @@ -51,22 +55,31 @@ string(2) "OK" bool(true) bool(true) bool(false) +bool(false) int(30) int(33188) string(2) "OK" bool(true) bool(false) bool(true) +bool(false) +int(8) +int(41471) +string(2) "OK" +bool(true) +bool(false) +bool(false) +bool(true) + file resource(%d) of type (stream) int(30) int(33188) -string(10) "Fri Oct 13" +string(10) "Thu Oct 19" bool(false) -string(18) "12:24:27 CEST 2023" +string(18) "12:01:02 CEST 2023" bool(true) + stream -string(29) "Fri Oct 13 12:24:27 CEST 2023" +string(29) "Thu Oct 19 12:01:02 CEST 2023" string(7) "content" string(7) "content" diff --git a/tests/bidon.rpm b/tests/bidon.rpm index 75ed242..d8efb06 100644 Binary files a/tests/bidon.rpm and b/tests/bidon.rpm differ diff --git a/tests/bidon.spec b/tests/bidon.spec index 07c61a5..b3ad790 100644 --- a/tests/bidon.spec +++ b/tests/bidon.spec @@ -2,7 +2,7 @@ Name: bidon Version: %{ver} -Release: 2%{?dist} +Release: 3 Summary: Bidon License: Public Domain URL: https://rpms.remirepo.net/ @@ -22,7 +22,9 @@ echo "content" >conf %install install -Dpm644 conf %{buildroot}%{_sysconfdir}/foo.conf -ln %{buildroot}%{_sysconfdir}/foo.conf %{buildroot}%{_sysconfdir}/bar.conf +cd %{buildroot}%{_sysconfdir} +ln foo.conf bar.conf +ln -s foo.conf toto.conf %files %doc README @@ -30,6 +32,9 @@ ln %{buildroot}%{_sysconfdir}/foo.conf %{buildroot}%{_sysconfdir}/bar.conf %changelog +* Thu Oct 19 2023 Remi Collet - 1-3 +- add symlinks + * Fri Oct 13 2023 Remi Collet - 1-2 - add some hardlinks -- cgit