https://github.com/carlwgeorge/repomd
Python library for parsing dnf/yum repositories
https://github.com/carlwgeorge/repomd
dnf rpm yum
Last synced: about 1 year ago
JSON representation
Python library for parsing dnf/yum repositories
- Host: GitHub
- URL: https://github.com/carlwgeorge/repomd
- Owner: carlwgeorge
- License: mit
- Created: 2017-11-05T15:26:42.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-06-19T06:12:13.000Z (about 4 years ago)
- Last Synced: 2025-04-03T02:22:10.237Z (over 1 year ago)
- Topics: dnf, rpm, yum
- Language: Python
- Homepage:
- Size: 46.9 KB
- Stars: 18
- Watchers: 2
- Forks: 14
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# repomd
[](https://cirrus-ci.com/github/carlwgeorge/repomd/master)
[](https://pypi.org/project/repomd/)
[](https://src.fedoraproject.org/rpms/python-repomd)
This library provides an object-oriented interface to get information out of dnf/yum repositories.
## Usage
```python
>>> import repomd
>>> repo = repomd.load('https://mirror.rackspace.com/centos/7/updates/x86_64/')
>>> repo
```
The length of the `Repo` object indicates the number of packages in the repository.
```python
>>> len(repo)
1602
```
Find a package by name.
```python
>>> repo.find('systemd')
```
Find all packages of a given name.
```python
>>> repo.findall('systemd')
[, ]
```
A `Package` instance has many useful properties.
```python
>>> package = repo.find('systemd')
>>> package.name
'systemd'
>>> package.version
'219'
>>> package.build_time
datetime.datetime(2018, 9, 26, 14, 11, 37)
>>> package.nevr
'systemd-219-57.el7_5.3'
```
Iterate through packages in the repository.
```python
>>> for package in repo:
... print(package.nvr)
389-ds-base-1.3.7.5-19.el7_5
389-ds-base-1.3.7.5-21.el7_5
389-ds-base-1.3.7.5-24.el7_5
(and so on)
```