rpmfile


Namerpmfile JSON
Version 2.0.0 PyPI version JSON
download
home_pagehttps://github.com/srossross/rpmfile
SummaryRead rpm archive files
upload_time2023-11-09 22:50:52
maintainer
docs_urlNone
authorSean Ross-Ross
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # rpmfile

[![Build Status](https://travis-ci.org/srossross/rpmfile.svg?branch=master)](https://travis-ci.org/srossross/rpmfile)
[![Actions Status](https://github.com/srossross/rpmfile/workflows/Tests/badge.svg?branch=master&event=push)](https://github.com/srossross/rpmfile/actions)
[![PyPI version](https://img.shields.io/pypi/v/rpmfile.svg)](https://pypi.org/project/rpmfile)

Tools for inspecting RPM files in python. This module is modeled after the
[tarfile](https://docs.python.org/3/library/tarfile.html) module.

## Install

```console
$ python -m pip install -U rpmfile
```

If you want to use `rpmfile` with `zstd` compressed rpms, you'll need to install
the  [zstandard](https://pypi.org/project/zstandard/) module.

`zstd` also requires that you are using Python >= 3.5

```console
$ python -m pip install -U zstandard
```

## Example

See the [tests](tests/test_extract.py) for more examples.

```python
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

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

Extract files

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

Extract files to directory

```conosle
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)

```conosle
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](https://github.com/psf/black) formater should be used on all files
before submitting a contribution. Version 19.10b0.

```console
$ pip install black==19.10b0
$ black .
```

## Code in this module was borrowed from:

* https://bitbucket.org/krp/cpiofile
* https://github.com/mjvm/pyrpm

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/srossross/rpmfile",
    "name": "rpmfile",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Sean Ross-Ross",
    "author_email": "srossross@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/1e/7a/21711cc95ba2a0209d53e6c62eea8c7f000a093e6cf398e668cb8c0e934e/rpmfile-2.0.0.tar.gz",
    "platform": null,
    "description": "# rpmfile\n\n[![Build Status](https://travis-ci.org/srossross/rpmfile.svg?branch=master)](https://travis-ci.org/srossross/rpmfile)\n[![Actions Status](https://github.com/srossross/rpmfile/workflows/Tests/badge.svg?branch=master&event=push)](https://github.com/srossross/rpmfile/actions)\n[![PyPI version](https://img.shields.io/pypi/v/rpmfile.svg)](https://pypi.org/project/rpmfile)\n\nTools for inspecting RPM files in python. This module is modeled after the\n[tarfile](https://docs.python.org/3/library/tarfile.html) module.\n\n## Install\n\n```console\n$ python -m pip install -U rpmfile\n```\n\nIf you want to use `rpmfile` with `zstd` compressed rpms, you'll need to install\nthe  [zstandard](https://pypi.org/project/zstandard/) module.\n\n`zstd` also requires that you are using Python >= 3.5\n\n```console\n$ python -m pip install -U zstandard\n```\n\n## Example\n\nSee the [tests](tests/test_extract.py) for more examples.\n\n```python\nimport rpmfile\n\nwith rpmfile.open('file.rpm') as rpm:\n\n    # Inspect the RPM headers\n    print(rpm.headers.keys())\n    print(rpm.headers.get('arch', 'noarch'))\n\n    # Extract a fileobject from the archive\n    fd = rpm.extractfile('./usr/bin/script')\n    print(fd.read())\n\n    for member in rpm.getmembers():\n        print(member)\n```\n\n## Command line usage\n\nYou can use `rpmfile` via it's module invocation or via `rpmfile` command if\nyour `PATH` environment variable is configured correctly. Pass `--help` for all\noptions.\n\nList RPM contents\n\n```conosle\ncurl -sfL 'https://example.com/some.rpm.gz' | gzip -d - | python -m rpmfile -l -\n./path/to/file\n```\n\nExtract files\n\n```conosle\ncurl -sfL 'https://example.com/some.rpm.gz' | gzip -d - | rpmfile -xv -\n./path/to/file\n```\n\nExtract files to directory\n\n```conosle\ncurl -sfL 'https://example.com/some.rpm.gz' | gzip -d - | rpmfile -xvC /tmp -\n/tmp/path/to/file\n```\n\nDisplay RPM information (similar to command `rpm -qip` in Linux)\n\n```conosle\ncurl -sfL 'https://example.com/some.rpm.gz' |gzip -d - | rpmfile -i -\nName        : something\nVersion     : 1.02\nRelease     : 1\nArchitecture: noarch\nGroup       : default\nSize        : 1234\nLicense     : BSD\nSignature   : None\nSource RPM  : some.src.rpm\nBuild Date  : Tue Apr  9 08:55:16 2019\nBuild Host  : demo\nURL         : http://example.com/some\nSummary     : Example of something\nDescription : \nThe description of something.\nIt can display more than one line.\n```\n\n\n## Classes\n\n* rpmfile.RPMFile: The RPMFile object provides an interface to a RPM archive\n* rpmfile.RPMInfo: An RPMInfo object represents one member in a RPMFile.\n\n## Contributing\n\nThe [black](https://github.com/psf/black) formater should be used on all files\nbefore submitting a contribution. Version 19.10b0.\n\n```console\n$ pip install black==19.10b0\n$ black .\n```\n\n## Code in this module was borrowed from:\n\n* https://bitbucket.org/krp/cpiofile\n* https://github.com/mjvm/pyrpm\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Read rpm archive files",
    "version": "2.0.0",
    "project_urls": {
        "Homepage": "https://github.com/srossross/rpmfile"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e17320fd06143be10189fa0831182e25338bd1bd17cb9f6d3993f3e58c499054",
                "md5": "9e7bce835266cb57ce70fb267145e3b4",
                "sha256": "931b925d0cab925d7d9332cdef7241dd1eec9fe6b258ffcb7cf7e939a6a92f7f"
            },
            "downloads": -1,
            "filename": "rpmfile-2.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9e7bce835266cb57ce70fb267145e3b4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 17145,
            "upload_time": "2023-11-09T22:50:51",
            "upload_time_iso_8601": "2023-11-09T22:50:51.178174Z",
            "url": "https://files.pythonhosted.org/packages/e1/73/20fd06143be10189fa0831182e25338bd1bd17cb9f6d3993f3e58c499054/rpmfile-2.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1e7a21711cc95ba2a0209d53e6c62eea8c7f000a093e6cf398e668cb8c0e934e",
                "md5": "7e74ae6d537a21aeefd445be94867429",
                "sha256": "b4b0dd553ad99711a4fa86267829bfe172c03f1ea1ce4ced24ffa55ed88385be"
            },
            "downloads": -1,
            "filename": "rpmfile-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7e74ae6d537a21aeefd445be94867429",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 20641,
            "upload_time": "2023-11-09T22:50:52",
            "upload_time_iso_8601": "2023-11-09T22:50:52.710336Z",
            "url": "https://files.pythonhosted.org/packages/1e/7a/21711cc95ba2a0209d53e6c62eea8c7f000a093e6cf398e668cb8c0e934e/rpmfile-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-09 22:50:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "srossross",
    "github_project": "rpmfile",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "lcname": "rpmfile"
}
        
Elapsed time: 0.34839s