def test_package_mappings(self):
        xc = XMvnConfig()
        a = Artifact('gId', 'aId')
        xc.add_package_mapping(a, 'package')

        et = self._read_current_conf()
        root = et.getroot()
        rule = self.__find(root, "xmvn:artifactManagement/xmvn:rule")

        aglob = self.__find(rule, "xmvn:artifactGlob")
        self.assertEqual(self.__find(aglob, "xmvn:groupId").text.strip(), "gId")
        self.assertEqual(self.__find(aglob, "xmvn:artifactId").text.strip(), "aId")

        self.assertEqual(self.__find(rule, "xmvn:targetPackage").text.strip(),
                         "package")
Exemple #2
0
    def test_package_mappings(self):
        xc = XMvnConfig()
        a = Artifact('gId', 'aId')
        xc.add_package_mapping(a, 'package')

        et = self._read_current_conf()
        root = et.getroot()
        rule = self.__find(root, "xmvn:artifactManagement/xmvn:rule")

        aglob = self.__find(rule, "xmvn:artifactGlob")
        self.assertEqual(
            self.__find(aglob, "xmvn:groupId").text.strip(), "gId")
        self.assertEqual(
            self.__find(aglob, "xmvn:artifactId").text.strip(), "aId")

        self.assertEqual(
            self.__find(rule, "xmvn:targetPackage").text.strip(), "package")
            mvn_args.append("org.fedoraproject.xmvn:xmvn-mojo:javadoc")
        else:
            mvn_args.append(
                "org.apache.maven.plugins:maven-javadoc-plugin:aggregate")

    if not options.gradle:
        # Build dependency generation for Gradle is not yet implemented in XMvn
        mvn_args.append("org.fedoraproject.xmvn:xmvn-mojo:builddep")

    if options.goal_after:
        mvn_args.extend(options.goal_after)

    if options.singleton:
        # make sure we don't install artifacts with non-empty classifiers
        xc.add_package_mapping(Artifact.from_mvn_str(":::*?:"),
                               "__noinstall",
                               optional=True)
        xc.add_package_mapping(Artifact.from_mvn_str(":{*}"), "@1")

    print("Executing:", " ".join(mvn_args), file=sys.stderr)
    print(mvn_args, file=sys.stderr)
    sys.stderr.flush()
    p = subprocess.Popen(" ".join(mvn_args), shell=True, env=os.environ)
    p.wait()

    subprocess.Popen("""
        if [ -f .xmvn-builddep ]; then
            echo -----BEGIN MAVEN BUILD DEPENDENCIES-----
            gzip -9nc <.xmvn-builddep | base64
            echo -----END MAVEN BUILD DEPENDENCIES-----
        fi
Exemple #4
0
            pass
        elif options.xmvn_javadoc:
            mvn_args.append("org.fedoraproject.xmvn:xmvn-mojo:javadoc")
        else:
            mvn_args.append("org.apache.maven.plugins:maven-javadoc-plugin:aggregate")

    if not options.gradle:
        # Build dependency generation for Gradle is not yet implemented in XMvn
        mvn_args.append("org.fedoraproject.xmvn:xmvn-mojo:builddep")

    if options.goal_after:
        mvn_args.extend(options.goal_after)

    if options.singleton:
        # make sure we don't install artifacts with non-empty classifiers
        xc.add_package_mapping(Artifact.from_mvn_str(":::*?:"), "__noinstall",
                               optional=True)
        xc.add_package_mapping(Artifact.from_mvn_str(":{*}"), "@1")

    print("Executing:", " ".join(mvn_args), file=sys.stderr)
    print(mvn_args, file=sys.stderr)
    sys.stderr.flush()
    p = subprocess.Popen(" ".join(mvn_args), shell=True, env=os.environ)
    p.wait()

    subprocess.Popen("""
        if [ -f .xmvn-builddep ]; then
            echo -----BEGIN MAVEN BUILD DEPENDENCIES-----
            gzip -9nc <.xmvn-builddep | base64
            echo -----END MAVEN BUILD DEPENDENCIES-----
        fi
        """, shell=True, env=os.environ).wait()