File: simple_repository_reading.py

package info (click to toggle)
createrepo-c 1.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,632 kB
  • sloc: ansic: 31,242; python: 4,868; xml: 2,669; sh: 363; makefile: 26; perl: 7
file content (21 lines) | stat: -rw-r--r-- 457 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python

import os
import sys
import createrepo_c as cr

REPO_PATH = "tests/testdata/repo_with_additional_metadata/"


def parse_repository(path):
    reader = cr.RepositoryReader.from_path(path)

    for package in reader.iter_packages():
        print("Package {}".format(package.nevra()))

    for advisory in reader.advisories():
        print("Advisory {}".format(advisory.id))


if __name__ == "__main__":
    parse_repository(REPO_PATH)