Skip to main content

rpmfile

Tests PyPI version

Tools for inspecting RPM files in python. This module is modeled after the tarfile module.

Install

$ python -m pip install -U rpmfile

If you want to use rpmfile with zstd compressed rpms, you'll need to install the zstandard module.

zstd also requires that you are using Python >= 3.5

$ python -m pip install -U zstandard

Example

See the tests for more examples.

import rpmfile

with rpmfile.open('file.rpm') as rpm:

    # Inspect the RPM headers
    print(rpm.headers.keys())
    print(rpm.headers.get('arch', 'noarch'))

    # Extract a fileobject from the archive
    fd = rpm.extractfile('./usr/bin/script')
    print(fd.read())

    for member in rpm.getmembers():
        print(member)

Command line usage

You can use rpmfile via it's module invocation or via rpmfile command if your PATH environment variable is configured correctly. Pass --help for all options.

List RPM contents

curl -sfL 'https://example.com/some.rpm.gz' | gzip -d - | python -m rpmfile -l -
./path/to/file

Extract files

curl -sfL 'https://example.com/some.rpm.gz' | gzip -d - | rpmfile -xv -
./path/to/file

Extract files to directory

curl -sfL 'https://example.com/some.rpm.gz' | gzip -d - | rpmfile -xvC /tmp -
/tmp/path/to/file

Display RPM information (similar to command rpm -qip in Linux)

curl -sfL 'https://example.com/some.rpm.gz' |gzip -d - | rpmfile -i -
Name        : something
Version     : 1.02
Release     : 1
Architecture: noarch
Group       : default
Size        : 1234
License     : BSD
Signature   : None
Source RPM  : some.src.rpm
Build Date  : Tue Apr  9 08:55:16 2019
Build Host  : demo
URL         : http://example.com/some
Summary     : Example of something
Description : 
The description of something.
It can display more than one line.

Classes

  • rpmfile.RPMFile: The RPMFile object provides an interface to a RPM archive
  • rpmfile.RPMInfo: An RPMInfo object represents one member in a RPMFile.

Contributing

The black formater should be used on all files before submitting a contribution. Version 19.10b0.

$ pip install black==26.3.1
$ black .

Code in this module was borrowed from:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rpmfile-2.2.1.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rpmfile-2.2.1-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file rpmfile-2.2.1.tar.gz.

File metadata

  • Download URL: rpmfile-2.2.1.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rpmfile-2.2.1.tar.gz
Algorithm Hash digest
SHA256 8ffc44d15f8d2b6cad1ea885b09e1ca5f1744532c24710554f3fe4873506e9da
MD5 9e4f7da1e1daa75ac76936fed6ff7a35
BLAKE2b-256 5fe9a9befd2823e8a52630fc35af5167c806c1d65899eeeda0833e7b8c21765e

See more details on using hashes here.

Provenance

The following attestation bundles were made for rpmfile-2.2.1.tar.gz:

Publisher: release.yml on srossross/rpmfile

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rpmfile-2.2.1-py3-none-any.whl.

File metadata

  • Download URL: rpmfile-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rpmfile-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf2a4c488702638a95b85c4852891390bb8e54d174569c217fb21f591ead19c3
MD5 ca70d305e657c5749db37a7a81bc1bdd
BLAKE2b-256 b8d42500c7778e14d7b98209fc5da575bea8c4c9c24edd7fb8be509e02de53d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for rpmfile-2.2.1-py3-none-any.whl:

Publisher: release.yml on srossross/rpmfile

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

2.2.1 This release

2 files

2.2.0

2 files

2.1.0

2 files

2.0.0

2 files

1.1.1

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

1 file

1.0.4

1 file

1.0.3

1 file

1.0.2

1 file

1.0.1

1 file

1.0.0

2 files

0.1.6

1 file

0.1.4

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

0.1

1 file

0.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page