コード例 #1
0
 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))
コード例 #2
0
ファイル: spec.py プロジェクト: srowe/planex
 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))
コード例 #3
0
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)
コード例 #4
0
ファイル: mock.py プロジェクト: srowe/planex
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)
コード例 #5
0
 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))
コード例 #6
0
ファイル: spec.py プロジェクト: srowe/planex
 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))
コード例 #7
0
ファイル: blobs.py プロジェクト: herrold/planex
 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)
コード例 #8
0
ファイル: blobs.py プロジェクト: herrold/planex
 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
コード例 #9
0
ファイル: blobs.py プロジェクト: herrold/planex
 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
コード例 #10
0
ファイル: blobs.py プロジェクト: herrold/planex
 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)
コード例 #11
0
ファイル: blobs.py プロジェクト: srowe/planex
 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)
コード例 #12
0
ファイル: blobs.py プロジェクト: srowe/planex
 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
コード例 #13
0
ファイル: blobs.py プロジェクト: srowe/planex
 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
コード例 #14
0
ファイル: blobs.py プロジェクト: srowe/planex
 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)