示例#1
0
def main():
    args = parse_cmdline()
    specs = {}

    pkgs_to_ignore = args.ignore
    for ignore_from in args.ignore_from:
        with open(ignore_from) as f:
            for name in f.readlines():
                pkgs_to_ignore.append(name.strip())
    for i in pkgs_to_ignore:
        print "# Will ignore: %s" % i

    for spec_path in args.specs:
        try:
            if build_type() == "deb":
                os_type = platform.linux_distribution(
                    full_distribution_name=False)[1].lower()
                map_name_fn = lambda name: mappkgname.map_package(
                    name, os_type)
                spec = pkg.Spec(spec_path, target="deb", map_name=map_name_fn)
            else:
                spec = pkg.Spec(spec_path, target="rpm", dist=args.dist)
            pkg_name = spec.name()
            if pkg_name in pkgs_to_ignore:
                continue

            specs[os.path.basename(spec_path)] = spec

        except pkg.SpecNameMismatch as exn:
            sys.stderr.write("error: %s\n" % exn.message)
            sys.exit(1)

    provides_to_rpm = package_to_rpm_map(specs.values())

    for spec in specs.itervalues():
        build_srpm_from_spec(spec)
        download_rpm_sources(spec)
        build_rpm_from_srpm(spec)
        buildrequires_for_rpm(spec, provides_to_rpm)
        print ""

    # Generate targets to build all srpms and all rpms
    all_rpms = []
    all_srpms = []
    for spec in specs.itervalues():
        rpm_path = spec.binary_package_paths()[0]
        all_rpms.append(rpm_path)
        all_srpms.append(spec.source_package_path())
        print "%s: %s" % (spec.name(), rpm_path)
    print ""

    print "rpms: " + " \\\n\t".join(all_rpms)
    print ""
    print "srpms: " + " \\\n\t".join(all_srpms)
    print ""
    print "install: all"
    print "\t. scripts/%s/install.sh" % build_type()
示例#2
0
    def test_buildrequires_for_rpm(self):
        spec_paths = glob.glob(os.path.join("./SPECS", "*.spec"))
        specs = [pkg.Spec(spec_path, dist='.el6') for spec_path in spec_paths]

        specdep.buildrequires_for_rpm(self.spec,
                                      specdep.package_to_rpm_map(specs))

        self.assertEqual(
            sys.stdout.getvalue(),
            "./RPMS/x86_64/ocaml-cohttp-0.9.8-1.el6.x86_64.rpm: "
            "./RPMS/x86_64/ocaml-uri-devel-1.3.8-1.el6.x86_64.rpm\n"
            "./RPMS/x86_64/ocaml-cohttp-0.9.8-1.el6.x86_64.rpm: "
            "./RPMS/x86_64/ocaml-cstruct-devel-0.7.1-2.el6.x86_64.rpm\n"
            "./RPMS/x86_64/ocaml-cohttp-0.9.8-1.el6.x86_64.rpm: "
            "./RPMS/x86_64/ocaml-ounit-devel-1.1.2-3.el6.x86_64.rpm\n"
            "./RPMS/x86_64/ocaml-cohttp-0.9.8-1.el6.x86_64.rpm: "
            "./RPMS/x86_64/ocaml-re-devel-1.2.1-1.el6.x86_64.rpm\n"
            "./RPMS/x86_64/ocaml-cohttp-0.9.8-1.el6.x86_64.rpm: "
            "./RPMS/x86_64/ocaml-lwt-devel-2.4.3-1.el6.x86_64.rpm\n"
            "./RPMS/x86_64/ocaml-cohttp-devel-0.9.8-1.el6.x86_64.rpm: "
            "./RPMS/x86_64/ocaml-uri-devel-1.3.8-1.el6.x86_64.rpm\n"
            "./RPMS/x86_64/ocaml-cohttp-devel-0.9.8-1.el6.x86_64.rpm: "
            "./RPMS/x86_64/ocaml-cstruct-devel-0.7.1-2.el6.x86_64.rpm\n"
            "./RPMS/x86_64/ocaml-cohttp-devel-0.9.8-1.el6.x86_64.rpm: "
            "./RPMS/x86_64/ocaml-ounit-devel-1.1.2-3.el6.x86_64.rpm\n"
            "./RPMS/x86_64/ocaml-cohttp-devel-0.9.8-1.el6.x86_64.rpm: "
            "./RPMS/x86_64/ocaml-re-devel-1.2.1-1.el6.x86_64.rpm\n"
            "./RPMS/x86_64/ocaml-cohttp-devel-0.9.8-1.el6.x86_64.rpm: "
            "./RPMS/x86_64/ocaml-lwt-devel-2.4.3-1.el6.x86_64.rpm\n")
示例#3
0
def main():
    params = parse_cmdline()
    specs = {}

    for spec_path in params['specs']:
        try:
            if build_type() == "deb":
                spec = pkg.Spec(spec_path,
                                target="deb",
                                map_name=map_package_name_deb)
            else:
                spec = pkg.Spec(spec_path, target="rpm", dist=params['dist'])
            pkg_name = spec.name()
            if pkg_name in params['ignore']:
                continue

            specs[os.path.basename(spec_path)] = spec

        except pkg.SpecNameMismatch as e:
            sys.stderr.write("error: %s\n" % e.message)
            sys.exit(1)

    provides_to_rpm = package_to_rpm_map(specs.values())

    for spec in specs.itervalues():
        build_srpm_from_spec(spec)
        download_rpm_sources(spec)
        build_rpm_from_srpm(spec)
        buildrequires_for_rpm(spec, provides_to_rpm)
        print ""

    # Generate targets to build all srpms and all rpms
    all_rpms = []
    all_srpms = []
    for spec in specs.itervalues():
        rpm_path = spec.binary_package_paths()[0]
        all_rpms.append(rpm_path)
        all_srpms.append(spec.source_package_path())
        print "%s: %s" % (spec.name(), rpm_path)
    print ""

    print "rpms: " + " \\\n\t".join(all_rpms)
    print ""
    print "srpms: " + " \\\n\t".join(all_srpms)
    print ""
    print "install: all"
    print "\t. scripts/%s/install.sh" % build_type()
示例#4
0
    def test_buildrequires_for_rpm(self):
        spec_paths = glob.glob(os.path.join("./SPECS", "*.spec"))
        specs = [pkg.Spec(spec_path, dist='.el6') for spec_path in spec_paths]

        specdep.buildrequires_for_rpm(self.spec,
                                      specdep.package_to_rpm_map(specs))
        assert sys.stdout.getvalue() == \
"""./RPMS/x86_64/ocaml-cohttp-0.9.8-1.el6.x86_64.rpm: ./RPMS/x86_64/ocaml-uri-devel-1.3.8-1.el6.x86_64.rpm
示例#5
0
    def setUp(self):
        def map_rpm_to_deb(name):
            mapping = {
                "ocaml-cohttp": ["libcohttp-ocaml"],
                "ocaml-cohttp-devel": ["libcohttp-ocaml-dev"],
                "ocaml": ["ocaml-nox", "ocaml-native-compilers"],
                "ocaml-findlib": ["ocaml-findlib"],
                "ocaml-re-devel": ["libre-ocaml-dev"],
                "ocaml-uri-devel": ["liburi-ocaml-dev"],
                "ocaml-cstruct-devel": ["libcstruct-ocaml-dev"],
                "ocaml-lwt-devel": ["liblwt-ocaml-dev"],
                "ocaml-ounit-devel": ["libounit-ocaml-dev"],
                "ocaml-ocamldoc": ["ocaml-nox"],
                "ocaml-camlp4-devel": ["camlp4", "camlp4-extra"],
                "openssl": ["libssl1.0.0"],
                "openssl-devel": ["libssl-dev"]
            }
            return mapping[name]

        self.spec = pkg.Spec("SPECS/ocaml-cohttp.spec",
                             target="deb",
                             map_name=map_rpm_to_deb)
示例#6
0
    def setUp(self):
        # 'setUp' breaks Pylint's naming rules
        # pylint: disable=C0103
        def map_rpm_to_deb(name):
            mapping = {
                "ocaml-cohttp": ["libcohttp-ocaml"],
                "ocaml-cohttp-devel": ["libcohttp-ocaml-dev"],
                "ocaml": ["ocaml-nox", "ocaml-native-compilers"],
                "ocaml-findlib": ["ocaml-findlib"],
                "ocaml-re-devel": ["libre-ocaml-dev"],
                "ocaml-uri-devel": ["liburi-ocaml-dev"],
                "ocaml-cstruct-devel": ["libcstruct-ocaml-dev"],
                "ocaml-lwt-devel": ["liblwt-ocaml-dev"],
                "ocaml-ounit-devel": ["libounit-ocaml-dev"],
                "ocaml-ocamldoc": ["ocaml-nox"],
                "ocaml-camlp4-devel": ["camlp4", "camlp4-extra"],
                "openssl": ["libssl1.0.0"],
                "openssl-devel": ["libssl-dev"]
            }
            return mapping[name]

        self.spec = pkg.Spec("./tests/data/ocaml-cohttp.spec",
                             target="deb",
                             map_name=map_rpm_to_deb)
示例#7
0
 def test_good_filename_preprocessor(self):
     pkg.Spec("tests/data/ocaml-cohttp.spec.in")
示例#8
0
 def setUp(self):
     # 'setUp' breaks Pylint's naming rules
     # pylint: disable=C0103
     self.spec = pkg.Spec("tests/data/ocaml-cohttp.spec", dist=".el6")
示例#9
0
 def setUp(self):
     self.spec = pkg.Spec("tests/SPECS/ocaml-cohttp.spec", dist=".el6")