简体   繁体   中英

python get file in rpm

In python i want to get file was located in rpm package, can i open this package, get file et save this in a python variable ? (without extract all package in /tmp)

Most solutions are variants of rpm2cpio | cpio which has the disadvantage that the entire cpio ball is unpacked on the file system rather than extracting a single file onto a pipeline that can be read into a python variable. This is largely a limitation on the cpio(1) archive file selection mechanism.

These days GNU tar can/will handle cpio formats, and so a GNU tar (which can extract a single file from an archive) rpm2cpio | tar pipeline might be able to extract a single file without unpacking the entire archive.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM