简体   繁体   English

python以rpm获取文件

[英]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 ? 在python中,我想获取文件位于rpm包中,我可以打开此包,获取文件并将其保存在python变量中吗? (without extract all package in /tmp) (不解压缩/ tmp中的所有软件包)

Most solutions are variants of rpm2cpio | 大多数解决方案都是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. cpio的缺点是,整个cpio球都在文件系统上解压缩,而不是将单个文件提取到可以读入python变量的管道中。 This is largely a limitation on the cpio(1) archive file selection mechanism. 这在很大程度上限制了cpio(1)归档文件选择机制。

These days GNU tar can/will handle cpio formats, and so a GNU tar (which can extract a single file from an archive) rpm2cpio | 如今,GNU tar可以/将处理cpio格式,因此GNU tar(可以从存档中提取单个文件) tar pipeline might be able to extract a single file without unpacking the entire archive. tar管道可能能够提取单个文件而无需解压缩整个存档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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