mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-02 15:21:25 -07:00
Add yum integration tests using fake repo (#31646)
This commit is contained in:
parent
567e989581
commit
e2fc61c554
5 changed files with 547 additions and 7 deletions
41
test/integration/targets/yum/files/create-repo.py
Normal file
41
test/integration/targets/yum/files/create-repo.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/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()
|
Loading…
Add table
Add a link
Reference in a new issue