def rpm_name_from_header(hdr): """ Return the name of the binary package file which will be built from hdr """ with rpm_macros(self.macros, nevra(hdr)): rpmname = hdr.sprintf(rpm.expandMacro("%{_build_name_fmt}")) return rpm.expandMacro(os.path.join('%_rpmdir', rpmname))
def main(argv=None): """ Entry point """ args = parse_args_or_exit(argv) tmpdir = tempfile.mkdtemp(prefix="px-mock-") config = clone_mock_config(args.configdir, tmpdir) try: if args.init: mock(args, config, "--init") else: config_in_path = os.path.join(args.configdir, args.root + ".cfg") config_out_path = os.path.join(config, args.root + ".cfg") insert_loopback_repo( config_in_path, config_out_path, tmpdir, args.loopback_config_extra) with rpm_macros(dict(args.define)): rpmdir = os.path.abspath(rpm.expandMacro("%_rpmdir")) createrepo(rpmdir, tmpdir, args.quiet) mock(args, config, "--rebuild", *args.srpms) except subprocess.CalledProcessError as cpe: sys.exit(cpe.returncode) finally: if args.keeptmp: print("Working directory retained at %s" % tmpdir) else: shutil.rmtree(tmpdir)
def source_package_path(self): """ Return the path of the source package which building this spec will produce """ # There doesn't seem to be a macro for the name of the source rpm # but we can construct one using the 'NVR' RPM tag which returns the # package's name-version-release string. Naming is not critically # important as these source RPMs are only used internally - mock # will write a new source RPM along with the binary RPMS. srpmname = self.spec.sourceHeader['nvr'] + ".src.rpm" return rpm.expandMacro(os.path.join('%_srcrpmdir', srpmname))
def __init__(self, spec, url, defined_by, prefix, commitish): with rpm_macros(spec.macros, nevra(spec.spec.sourceHeader)): super(GitPatchqueue, self).__init__(spec, url, defined_by, prefix) self._prefix = rpm.expandMacro(prefix) self._commitish = rpm.expandMacro(commitish)
def __init__(self, spec, url, defined_by): with rpm_macros(spec.macros, nevra(spec.spec.sourceHeader)): self._spec = spec self._url = rpm.expandMacro(url) self._defined_by = defined_by
def __init__(self, spec, url, defined_by, prefix): with rpm_macros(spec.macros, nevra(spec.spec.sourceHeader)): super(Archive, self).__init__(spec, url, defined_by) self._prefix = rpm.expandMacro(prefix) self._names = None
def __init__(self, spec, url, defined_by, prefix, commitish): with rpm_macros(spec.macros, nevra(spec.spec.sourceHeader)): super(GitBlob, self).__init__(spec, url, defined_by) self._prefix = rpm.expandMacro(prefix) if prefix is not None \ else rpm.expandMacro("%{name}-%{version}") self._commitish = rpm.expandMacro(commitish)