ansible/test/integration/targets/setup_rpm_repo/files/create-repo.py
Martin Krizek 3c1fb9b547
Use custom rpm repo script for dnf testing (#32737)
* Use custom rpm repo script for dnf testing

* Switch to a jinja2 test
2017-11-21 09:40:58 +01:00

41 lines
710 B
Python

#!/usr/bin/env python
import sys
from collections import namedtuple
import rpmfluff
RPM = namedtuple('RPM', ['name', 'version', 'release', 'epoch'])
SPECS = [
RPM('foo', '1.0', '1', None),
RPM('foo', '1.0', '2', '1'),
RPM('foo', '1.1', '1', '1'),
]
def main():
try:
arch = sys.argv[1]
except IndexError:
arch = 'x86_64'
pkgs = []
for spec in SPECS:
pkg = rpmfluff.SimpleRpmBuild(spec.name, spec.version, spec.release, [arch])
pkg.epoch = spec.epoch
pkgs.append(pkg)
repo = rpmfluff.YumRepoBuild(pkgs)
repo.make(arch)
for pkg in pkgs:
pkg.clean()
print(repo.repoDir)
if __name__ == "__main__":
main()