I have a draft change in https://github.com/teknoraver/rpm/tree/libarchive2
Most of the work needed to be done in `rpmuncompress`, I added a `-p` flag
which does the following:
```
$ tar vtf source-singleroot.tar.gz
drwxr-xr-x root/root 0 2024-01-16 19:13 source-xxxxxxxxxx/
-rw-r--r-- root/root 32 2024-01-16 19:13 source-xxxxxxxxxx/file1
-rw-r--r-- root/root 33886 2024-01-16 19:13 source-xxxxxxxxxx/file2
drwxr-xr-x root/root 0 2024-01-16 19:13 source-xxxxxxxxxx/dir1/
-r--r--r-- root/root 210 2024-01-16 19:13 source-xxxxxxxxxx/dir1/file3
$ tar vtf source-noroot.tar.gz
drwxr-xr-x root/root 0 2024-01-16 19:13 dir1/
-r--r--r-- root/root 210 2024-01-16 19:13 dir1/file3
-rw-r--r-- root/root 32 2024-01-16 19:13 file1
-rw-r--r-- root/root 33886 2024-01-16 19:13 file2
$ ll
total 28
-rw-r--r--. 1 teknoraver teknoraver 10324 Jan 16 19:14 source-noroot.tar.gz
-rw-r--r--. 1 teknoraver teknoraver 10520 Jan 16 19:14 source-singleroot.tar.gz
-rw-r--r--. 1 teknoraver teknoraver 649 Jan 15 20:54 test.spec
$ ~/rpm/usr/lib/rpm/rpmuncompress -x -v -p source-1.0.0 source-singleroot.tar.gz
mkdir 'source-1.0.0' ; /usr/bin/gzip -dc 'source-singleroot.tar.gz' |
/usr/bin/tar -xvvof - -C 'source-1.0.0' --strip-components=1
-rw-r--r-- root/root 32 2024-01-16 19:13 source-xxxxxxxxxx/file1
-rw-r--r-- root/root 33886 2024-01-16 19:13 source-xxxxxxxxxx/file2
drwxr-xr-x root/root 0 2024-01-16 19:13 source-xxxxxxxxxx/dir1/
-r--r--r-- root/root 210 2024-01-16 19:13 source-xxxxxxxxxx/dir1/file3
$ find source-1.0.0 -ls
92341 0 drwxr-xr-x 1 teknoraver teknoraver 28 Jan 16 19:16
source-1.0.0
92342 4 -rw-r--r-- 1 teknoraver teknoraver 32 Jan 16 19:13
source-1.0.0/file1
92343 36 -rw-r--r-- 1 teknoraver teknoraver 33886 Jan 16 19:13
source-1.0.0/file2
92344 0 drwxr-xr-x 1 teknoraver teknoraver 10 Jan 16 19:13
source-1.0.0/dir1
92345 4 -r--r--r-- 1 teknoraver teknoraver 210 Jan 16 19:13
source-1.0.0/dir1/file3
$ ~/rpm/usr/lib/rpm/rpmuncompress -x -v -p source-2.0.0 source-noroot.tar.gz
mkdir 'source-2.0.0' ; /usr/bin/gzip -dc 'source-noroot.tar.gz' |
/usr/bin/tar -xvvof - -C 'source-2.0.0'
drwxr-xr-x root/root 0 2024-01-16 19:13 dir1/
-r--r--r-- root/root 210 2024-01-16 19:13 dir1/file3
-rw-r--r-- root/root 32 2024-01-16 19:13 file1
-rw-r--r-- root/root 33886 2024-01-16 19:13 file2
$ find source-2.0.0 -ls
92346 0 drwxr-xr-x 1 teknoraver teknoraver 28 Jan 16 19:17
source-2.0.0
92347 0 drwxr-xr-x 1 teknoraver teknoraver 10 Jan 16 19:13
source-2.0.0/dir1
92348 4 -r--r--r-- 1 teknoraver teknoraver 210 Jan 16 19:13
source-2.0.0/dir1/file3
92349 4 -rw-r--r-- 1 teknoraver teknoraver 32 Jan 16 19:13
source-2.0.0/file1
92350 36 -rw-r--r-- 1 teknoraver teknoraver 33886 Jan 16 19:13
source-2.0.0/file2
```
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2664#issuecomment-1897608268
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/issues/2664/1897608...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint