ALBS-1030: Generate Devel section in packages.json #14
@ -14,7 +14,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
import tempfile
|
import tempfile
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from typing import AnyStr, Dict, List, Optional, Any, Iterator
|
from typing import AnyStr, Dict, List, Any, Iterator
|
||||||
|
|
||||||
import binascii
|
import binascii
|
||||||
import createrepo_c as cr
|
import createrepo_c as cr
|
||||||
@ -65,7 +65,7 @@ class RepoInfo:
|
|||||||
# Only layout of specific package (which don't exist
|
# Only layout of specific package (which don't exist
|
||||||
# in a reference repository) will be taken as example
|
# in a reference repository) will be taken as example
|
||||||
is_reference: bool = False
|
is_reference: bool = False
|
||||||
strict_arch: bool = False
|
repo_type: str = 'present'
|
||||||
|
|
||||||
|
|
||||||
class PackagesGenerator:
|
class PackagesGenerator:
|
||||||
@ -262,7 +262,11 @@ class PackagesGenerator:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
all_packages = defaultdict(lambda: {'variants': list()})
|
all_packages = defaultdict(lambda: {'variants': list()})
|
||||||
for repo_info in self.repos:
|
for repo_info in sorted(
|
||||||
|
self.repos,
|
||||||
|
key=lambda i: i.repo_type,
|
||||||
|
reverse=True,
|
||||||
|
):
|
||||||
repomd_records = self._get_repomd_records(
|
repomd_records = self._get_repomd_records(
|
||||||
repo_info=repo_info,
|
repo_info=repo_info,
|
||||||
)
|
)
|
||||||
@ -298,6 +302,8 @@ class PackagesGenerator:
|
|||||||
all_packages[package_key]['arch'] = package_arch
|
all_packages[package_key]['arch'] = package_arch
|
||||||
all_packages[package_key]['package'] = package
|
all_packages[package_key]['package'] = package
|
||||||
all_packages[package_key]['type'] = repo_info.is_reference
|
all_packages[package_key]['type'] = repo_info.is_reference
|
||||||
|
elif repo_info.repo_type == 'absent' and (repo_info.name, repo_info.arch) in all_packages[package_key]['variants']:
|
||||||
|
all_packages[package_key]['variants'].remove((repo_info.name, repo_info.arch))
|
||||||
# replace an older package if it's not reference or
|
# replace an older package if it's not reference or
|
||||||
# a newer package is from reference repo
|
# a newer package is from reference repo
|
||||||
elif (not all_packages[package_key]['type'] or
|
elif (not all_packages[package_key]['type'] or
|
||||||
@ -404,6 +410,14 @@ def create_parser():
|
|||||||
choices=['yes', 'no'],
|
choices=['yes', 'no'],
|
||||||
required=True,
|
required=True,
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--repo-type',
|
||||||
|
action='append',
|
||||||
|
type=str,
|
||||||
|
help='Packages from repository will be removed or added to variant',
|
||||||
|
choices=['present', 'absent'],
|
||||||
|
required=True,
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--excluded-packages',
|
'--excluded-packages',
|
||||||
nargs='+',
|
nargs='+',
|
||||||
@ -436,13 +450,14 @@ def cli_main():
|
|||||||
args = create_parser().parse_args()
|
args = create_parser().parse_args()
|
||||||
repos = []
|
repos = []
|
||||||
for repo_path, repo_folder, repo_name, \
|
for repo_path, repo_folder, repo_name, \
|
||||||
repo_arch, is_remote, is_reference in zip(
|
repo_arch, is_remote, is_reference, repo_type in zip(
|
||||||
args.repo_path,
|
args.repo_path,
|
||||||
args.repo_folder,
|
args.repo_folder,
|
||||||
args.repo_name,
|
args.repo_name,
|
||||||
args.repo_arch,
|
args.repo_arch,
|
||||||
args.is_remote,
|
args.is_remote,
|
||||||
args.is_reference,
|
args.is_reference,
|
||||||
|
args.repo_type,
|
||||||
):
|
):
|
||||||
repos.append(RepoInfo(
|
repos.append(RepoInfo(
|
||||||
path=repo_path,
|
path=repo_path,
|
||||||
@ -450,7 +465,8 @@ def cli_main():
|
|||||||
name=repo_name,
|
name=repo_name,
|
||||||
arch=repo_arch,
|
arch=repo_arch,
|
||||||
is_remote=True if is_remote == 'yes' else False,
|
is_remote=True if is_remote == 'yes' else False,
|
||||||
is_reference=True if is_reference == 'yes' else False
|
is_reference=True if is_reference == 'yes' else False,
|
||||||
|
repo_type=repo_type,
|
||||||
))
|
))
|
||||||
pg = PackagesGenerator(
|
pg = PackagesGenerator(
|
||||||
repos=repos,
|
repos=repos,
|
||||||
|
Loading…
Reference in New Issue
Block a user