File tree Expand file tree Collapse file tree 2 files changed +40
-2
lines changed Expand file tree Collapse file tree 2 files changed +40
-2
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env python3
2+
3+ import logging
4+ import sys
5+ import tempfile
6+
7+ import repoquery
8+
9+ ARCH = "x86_64"
10+ XCP_VERSION = "8.3"
11+
12+ # Use `dnf` on xs8 and xcpng8.3 repos
13+ def main () -> int :
14+ logging .basicConfig (format = '[%(levelname)s] %(message)s' , level = logging .INFO )
15+
16+ args = sys .argv [1 :]
17+
18+ with (tempfile .NamedTemporaryFile () as dnfconf ,
19+ tempfile .TemporaryDirectory () as yumrepod ):
20+
21+ repoquery .setup_xcpng_yum_repos (yum_repo_d = yumrepod ,
22+ sections = ['base' , 'updates' ],
23+ bin_arch = ARCH ,
24+ version = XCP_VERSION )
25+ repoquery .setup_xs8_yum_repos (yum_repo_d = yumrepod ,
26+ sections = ['base' , 'normal' , 'earlyaccess' ],
27+ )
28+ repoquery .dnf_setup (dnf_conf = dnfconf .name , yum_repo_d = yumrepod )
29+
30+ print (repoquery .run_dnf (args , split = False ))
31+
32+ return 0
33+
34+ if __name__ == "__main__" :
35+ sys .exit (main ())
Original file line number Diff line number Diff line change @@ -95,14 +95,17 @@ def rpm_source_package(rpmname: str, **kwargs) -> str:
9595 return BINRPM_SOURCE_CACHE .get (rpmname , kwargs ['default' ])
9696 return BINRPM_SOURCE_CACHE [rpmname ]
9797
98- def run_repoquery (args : list [str ], split : bool = True ) -> str | Sequence [str ]:
98+ def run_dnf (args : list [str ], split : bool = True ) -> str | Sequence [str ]:
9999 assert DNF_BASE_CMD is not None
100- cmd = DNF_BASE_CMD + [ 'repoquery' ] + args
100+ cmd = DNF_BASE_CMD + args
101101 logging .debug ('$ %s' , ' ' .join (cmd ))
102102 output = subprocess .check_output (cmd , universal_newlines = True ).strip ()
103103 logging .debug ('> %s' , output )
104104 return output .split () if split else output
105105
106+ def run_repoquery (args : list [str ], split : bool = True ) -> str | Sequence [str ]:
107+ return run_dnf (['repoquery' ] + args , split )
108+
106109SRPM_BINRPMS_CACHE : dict [str , set [str ]] = {} # binrpm-nevr -> srpm-nevr
107110def fill_srpm_binrpms_cache () -> None :
108111 # HACK: get nevr for what dnf outputs as %{sourcerpm}
You can’t perform that action at this time.
0 commit comments