[scalaz/f20] initial import

William Benton willb at fedoraproject.org
Thu Feb 27 14:46:30 UTC 2014


commit e85643b0de066b89b153d7eadef36695063003a8
Author: William Benton <willb at redhat.com>
Date:   Thu Feb 27 08:47:22 2014 -0600

    initial import

 .gitignore               |    1 +
 climbing-nemesis.py      |  244 ++++++++++++++++++++++++++++++++++++++++++++++
 scalaz-7.0.0-build.patch |  239 +++++++++++++++++++++++++++++++++++++++++++++
 scalaz.spec              |  135 +++++++++++++++++++++++++
 sources                  |    1 +
 5 files changed, 620 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..52547a7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/scalaz-v7.0.0.tar.gz
diff --git a/climbing-nemesis.py b/climbing-nemesis.py
new file mode 100644
index 0000000..4bdd5ca
--- /dev/null
+++ b/climbing-nemesis.py
@@ -0,0 +1,244 @@
+#!/usr/bin/env python
+
+# Copyright 2013, 2014 Red Hat, Inc., and William C. Benton
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import xml.etree.ElementTree as ET
+import argparse
+import StringIO
+import re
+import subprocess
+import logging
+
+from os.path import exists as pathexists
+from os.path import realpath
+from os.path import join as pathjoin
+from os import makedirs
+from os import symlink
+from os import remove as rmfile
+from shutil import copyfile
+
+class Artifact(object):
+    def __init__(self, a, g, v):
+        self.artifact = a
+        self.group = g
+        self.version = v
+    
+    @classmethod
+    def fromCoords(k, coords):
+        g,a,v = coords.split(":")
+        return k(a, g, v)
+    
+    @classmethod
+    def fromSubtree(k, t, ns):
+        a = t.find("./%sartifactId" % ns).text
+        g = t.find("./%sgroupId" % ns).text
+        v = t.find("./%sversion" % ns).text
+        return k(a, g, v)
+    
+    def contains(self, substrings):
+        for s in substrings:
+            if s in self.artifact or s in self.group:
+                cn_debug("ignoring %r because it contains %s" % (self, s))
+                return True
+        if len(substrings) > 0:
+            cn_debug("not ignoring %r; looked for %r" % (self, substrings))
+        return False
+    
+    def __repr__(self):
+        return "%s:%s:%s" % (self.group, self.artifact, self.version)
+
+class DummyPOM(object):
+    def __init__(self, groupID=None, artifactID=None, version=None):
+        self.groupID = groupID
+        self.artifactID = artifactID
+        self.version = version
+        self.deps = []
+
+def interestingDep(dt, namespace):
+    if len(dt.findall("./%soptional" % namespace)) != 0:
+        cn_debug("ignoring optional dep %r" % Artifact.fromSubtree(dt, namespace))
+        return False
+    if [e for e in dt.findall("./%sscope" % namespace) if e.text == "test"] != []:
+        cn_debug("ignoring test dep %r" % Artifact.fromSubtree(dt, namespace))
+        return False
+    return True
+
+class POM(object):
+    def __init__(self, filename, suppliedGroupID=None, suppliedArtifactID=None, ignored_deps=[], override=None, extra_deps=[]):
+        self.filename = filename
+        self.sGroupID = suppliedGroupID
+        self.sArtifactID = suppliedArtifactID
+        self.logger = logging.getLogger("com.freevariable.climbing-nemesis")
+        self.deps = []
+        self.ignored_deps = ignored_deps
+        self.extra_deps = extra_deps
+        cn_debug("POM:  extra_deps is %r" % extra_deps)
+        self._parsePom()
+        self.claimedGroup, self.claimedArtifact  = override is not None and override or (self.groupID, self.artifactID)
+    
+    def _parsePom(self):
+        tree = ET.parse(self.filename)
+        project = tree.getroot()
+        self.logger.info("parsing POM %s", self.filename)
+        self.logger.debug("project tag is '%s'", project.tag)
+        tagmatch = re.match("[{](.*)[}].*", project.tag)
+        namespace = tagmatch and "{%s}" % tagmatch.groups()[0] or ""
+        self.logger.debug("looking for '%s'", ("./%sgroupId" % namespace))
+        groupIDtag = project.find("./%sgroupId" % namespace) 
+        if groupIDtag is None:
+            groupIDtag = project.find("./%sparent/%sgroupId" % (namespace,namespace))
+        
+        versiontag = project.find("./%sversion" % namespace)
+        if versiontag is None:
+            versiontag = project.find("./%sparent/%sversion" % (namespace,namespace))
+        self.logger.debug("group ID tag is '%s'", groupIDtag)
+        self.groupID = groupIDtag.text
+        self.artifactID = project.find("./%sartifactId" % namespace).text
+        self.version = versiontag.text
+        depTrees = project.findall(".//%sdependencies/%sdependency" % (namespace, namespace))
+        alldeps = [Artifact.fromSubtree(depTree, namespace) for depTree in depTrees if interestingDep(depTree, namespace)]
+        alldeps = [dep for dep in alldeps if not (dep.group == self.groupID and dep.artifact == self.artifactID)]
+        self.deps = [dep for dep in alldeps if not dep.contains(self.ignored_deps)] + [Artifact.fromCoords(xtra) for xtra in self.extra_deps]
+        jarmatch = re.match(".*JPP-(.*).pom", self.filename)
+        self.jarname = (jarmatch and jarmatch.groups()[0] or None)
+
+def cn_debug(*args):
+    logging.getLogger("com.freevariable.climbing-nemesis").debug(*args)
+
+def cn_info(*args):
+    logging.getLogger("com.freevariable.climbing-nemesis").info(*args)
+
+def resolveArtifact(group, artifact, pomfile=None, kind="jar", ignored_deps=[], override=None, extra_deps=[]):
+    # XXX: some error checking would be the responsible thing to do here
+    cn_debug("rA:  extra_deps is %r" % extra_deps)
+    if pomfile is None:
+        try:
+            if getFedoraRelease() > 19:
+                [pom] = subprocess.check_output(["xmvn-resolve", "%s:%s:pom:%s" % (group, artifact, kind)]).split()
+            else:
+                [pom] = subprocess.check_output(["xmvn-resolve", "%s:%s:%s" % (group, artifact, kind)]).split()
+            return POM(pom, ignored_deps=ignored_deps, override=override, extra_deps=extra_deps)
+        except:
+            return DummyPOM(group, artifact)
+    else:
+        return POM(pomfile, ignored_deps=ignored_deps, override=override, extra_deps=extra_deps)
+
+def resolveArtifacts(identifiers):
+    coords = ["%s:%s:jar" % (group, artifact) for (group, artifact) in identifiers]
+    poms =  subprocess.check_output(["xmvn-resolve"] + coords).split()
+    return [POM(pom) for pom in poms]
+
+def resolveJar(group, artifact):
+    [jar] = subprocess.check_output(["xmvn-resolve", "%s:%s:jar:jar" % (group, artifact)]).split()
+    return jar
+
+def makeIvyXmlTree(org, module, revision, status="release", meta={}, deps=[]):
+    ivy_module = ET.Element("ivy-module", {"version":"1.0", "xmlns:e":"http://ant.apache.org/ivy/extra"})
+    info = ET.SubElement(ivy_module, "info", dict({"organisation":org, "module":module, "revision":revision, "status":status}.items() + meta.items()))
+    info.text = " " # ensure a close tag
+    confs = ET.SubElement(ivy_module, "configurations")
+    for conf in ["default", "provided", "test"]:
+        ET.SubElement(confs, "conf", {"name":conf})
+    pubs = ET.SubElement(ivy_module, "publications")
+    ET.SubElement(pubs, "artifact", {"name":module, "type":"jar"})
+    if len(deps) > 0:
+        deptree = ET.SubElement(ivy_module, "dependencies")
+        for dep in deps:
+            ET.SubElement(deptree, "dependency", {"org":dep.group, "name":dep.artifact, "rev":dep.version})
+    return ET.ElementTree(ivy_module)
+
+def writeIvyXml(org, module, revision, status="release", fileobj=None, meta={}, deps=[]):
+    # XXX: handle deps!
+    if fileobj is None:
+        fileobj = StringIO.StringIO()
+    tree = makeIvyXmlTree(org, module, revision, status, meta=meta, deps=deps)
+    tree.write(fileobj, xml_declaration=True)
+    return fileobj
+
+def ivyXmlAsString(org, module, revision, status, meta={}, deps=[]):
+    return writeIvyXml(org, module, revision, status, meta=meta, deps=deps).getvalue()
+
+def placeArtifact(artifact_file, repo_dirname, org, module, revision, status="release", meta={}, deps=[], supplied_ivy_file=None, scala=None, override=None, override_dir_only=False):
+    if scala is not None:
+        module = module + "_%s" % scala
+    jarmodule = module
+    if override is not None:
+        org, module = override
+        if not override_dir_only:
+            jarmodule = module
+    repo_dir = realpath(repo_dirname)
+    artifact_dir = pathjoin(*[repo_dir] + [org] + [module, revision])
+    ivyxml_path = pathjoin(artifact_dir, "ivy.xml")
+    artifact_repo_path = pathjoin(artifact_dir, "%s-%s.jar" % (jarmodule, revision))
+    
+    if not pathexists(artifact_dir):
+        makedirs(artifact_dir)
+    
+    ivyxml_file = open(ivyxml_path, "w")
+    if supplied_ivy_file is None:
+        writeIvyXml(org, module, revision, status, ivyxml_file, meta=meta, deps=deps)
+    else:
+        copyfile(supplied_ivy_file, ivyxml_path)
+    
+    if pathexists(artifact_repo_path):
+        rmfile(artifact_repo_path)
+    
+    symlink(artifact_file, artifact_repo_path)
+
+def getFedoraRelease():
+    cmd = "rpm -q --qf %{version} fedora-release"
+    return int(subprocess.check_output(cmd.split()))
+
+def main():
+    parser = argparse.ArgumentParser(description="Place a locally-installed artifact in a custom local Ivy repository; get metadata from Maven")
+    parser.add_argument("group", metavar="GROUP", type=str, help="name of group")
+    parser.add_argument("artifact", metavar="ARTIFACT", type=str, help="name of artifact")
+    parser.add_argument("repodir", metavar="REPO", type=str, help="location for local repo")
+    parser.add_argument("--version", metavar="VERSION", type=str, help="version to advertise this artifact as, overriding Maven metadata")
+    parser.add_argument("--meta", metavar="K=V", type=str, help="extra metadata to store in ivy.xml", action='append')
+    parser.add_argument("--jarfile", metavar="JAR", type=str, help="local jar file (use instead of POM metadata")
+    parser.add_argument("--pomfile", metavar="POM", type=str, help="local pom file (use instead of xmvn-resolved one")
+    parser.add_argument("--log", metavar="LEVEL", type=str, help="logging level")
+    parser.add_argument("--ivyfile", metavar="IVY", type=str, help="supplied Ivy file (use instead of POM metadata)")
+    parser.add_argument("--scala", metavar="VERSION", type=str, help="encode given scala version in artifact name")
+    parser.add_argument("--ignore", metavar="STR", type=str, help="ignore dependencies whose artifact or group contains str", action='append')
+    parser.add_argument("--override", metavar="ORG:NAME", type=str, help="override organization and/or artifact name")
+    parser.add_argument("--override-dir-only", action='store_true', help="override organization and/or artifact name")
+    parser.add_argument("--extra-dep", metavar="ORG:NAME:VERSION", action='append', help="add the given dependencya")
+    args = parser.parse_args()
+    
+    if args.log is not None:
+        logging.basicConfig(level=getattr(logging, args.log.upper()))
+    
+    override = args.override and args.override.split(":") or None
+    cn_debug("cl: args.extra_dep is %r" % args.extra_dep)
+    extra_deps = args.extra_dep is not None and args.extra_dep or []
+    
+    pom = resolveArtifact(args.group, args.artifact, args.pomfile, "jar", ignored_deps=(args.ignore or []), override=((not args.override_dir_only) and override or None), extra_deps=extra_deps)
+    
+    if args.jarfile is None:
+        jarfile = resolveJar(pom.groupID or args.group, pom.artifactID or args.artifact)
+    else:
+        jarfile = args.jarfile
+    
+    version = (args.version or pom.version)
+    
+    meta = dict([kv.split("=") for kv in (args.meta or [])])
+    cn_debug("meta is %r" % meta)
+    
+    placeArtifact(jarfile, args.repodir, pom.groupID, pom.artifactID, version, meta=meta, deps=pom.deps, supplied_ivy_file=args.ivyfile, scala=args.scala, override=override, override_dir_only=args.override_dir_only)
+
+if __name__ == "__main__":
+    main()
diff --git a/scalaz-7.0.0-build.patch b/scalaz-7.0.0-build.patch
new file mode 100644
index 0000000..024d0e2
--- /dev/null
+++ b/scalaz-7.0.0-build.patch
@@ -0,0 +1,239 @@
+diff --git a/project/build.properties b/project/build.properties
+index 66ad72c..18297d2 100644
+--- a/project/build.properties
++++ b/project/build.properties
+@@ -1,1 +1,1 @@
+-sbt.version=0.12.2
++sbt.version=0.13.1
+diff --git a/project/build.scala b/project/build.scala
+index 493f34a..df88528 100644
+--- a/project/build.scala
++++ b/project/build.scala
+@@ -8,45 +8,14 @@ import java.awt.Desktop
+ 
+ import scala.collection.immutable.IndexedSeq
+ 
+-import sbtrelease._
+-import sbtrelease.ReleasePlugin._
+-import sbtrelease.ReleasePlugin.ReleaseKeys._
+-import sbtrelease.ReleaseStateTransformations._
+-import sbtrelease.Utilities._
+-
+-import com.typesafe.sbt.pgp.PgpKeys._
+-
+-import com.typesafe.sbtosgi.OsgiPlugin._
+-
+-import sbtbuildinfo.Plugin._
+-
+-import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
+-import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact
+-
+ object build extends Build {
+   type Sett = Project.Setting[_]
+ 
+-  lazy val publishSignedArtifacts = ReleaseStep(
+-    action = st => {
+-      val extracted = st.extract
+-      val ref = extracted.get(thisProjectRef)
+-      extracted.runAggregated(publishSigned in Global in ref, st)
+-    },
+-    check = st => {
+-      // getPublishTo fails if no publish repository is set up.
+-      val ex = st.extract
+-      val ref = ex.get(thisProjectRef)
+-      Classpaths.getPublishTo(ex.get(publishTo in Global in ref))
+-      st
+-    },
+-    enableCrossBuild = true
+-  )
+-
+-  lazy val standardSettings: Seq[Sett] = Defaults.defaultSettings ++ sbtrelease.ReleasePlugin.releaseSettings ++ Seq[Sett](
++  lazy val standardSettings: Seq[Sett] = Defaults.defaultSettings ++ Seq[Sett](
+     organization := "org.scalaz",
+ 
+-    scalaVersion := "2.9.2",
+-    crossScalaVersions := Seq("2.9.2", "2.9.3", "2.10.0"),
++    scalaVersion := "2.10.3",
++    crossScalaVersions := Seq(),
+     resolvers += Resolver.sonatypeRepo("releases"),
+ 
+     scalacOptions <++= (scalaVersion) map { sv =>
+@@ -99,21 +68,6 @@ object build extends Build {
+     publishSetting,
+     publishArtifact in Test := false,
+ 
+-    // adapted from sbt-release defaults
+-    // (performs `publish-signed` instead of `publish`)
+-    releaseProcess := Seq[ReleaseStep](
+-      checkSnapshotDependencies,
+-      inquireVersions,
+-      runTest,
+-      setReleaseVersion,
+-      commitReleaseVersion,
+-      tagRelease,
+-      publishSignedArtifacts,
+-      setNextVersion,
+-      commitNextVersion,
+-      pushChanges
+-    ),
+-
+     pomIncludeRepository := {
+       x => false
+     },
+@@ -154,10 +108,6 @@ object build extends Build {
+         }
+         </developers>
+       )
+-  ) ++ osgiSettings ++ Seq[Sett](
+-    OsgiKeys.additionalHeaders := Map("-removeheaders" -> "Include-Resource,Private-Package")
+-  ) ++ mimaDefaultSettings ++ Seq[Sett](
+-    previousArtifact <<= (organization, name, scalaBinaryVersion) { (o, n, sbv) => Some(o % (n + "_" + sbv) % "7.0.0-RC2") }
+   )
+ 
+   lazy val scalaz = Project(
+@@ -166,7 +116,6 @@ object build extends Build {
+     settings = standardSettings ++ Unidoc.settings ++ Seq[Sett](
+       // <https://github.com/scalaz/scalaz/issues/261>
+       Unidoc.unidocExclude += "typelevel",
+-      previousArtifact := None,
+       publishArtifact := false
+     ),
+     aggregate = Seq(core, concurrent, effect, example, iterv, iteratee, scalacheckBinding, tests, typelevel, xml)
+@@ -175,17 +124,12 @@ object build extends Build {
+   lazy val core = Project(
+     id = "core",
+     base = file("core"),
+-    settings = standardSettings ++ buildInfoSettings ++ Seq[Sett](
++    settings = standardSettings ++ Seq[Sett](
+       name := "scalaz-core",
+       typeClasses := TypeClass.core,
+       sourceGenerators in Compile <+= (sourceManaged in Compile) map {
+         dir => Seq(generateTupleW(dir))
+-      },
+-      sourceGenerators in Compile <+= buildInfo,
+-      buildInfoKeys := Seq[BuildInfoKey](version, scalaVersion),
+-      buildInfoPackage := "scalaz",
+-      osgiExport("scalaz"),
+-      OsgiKeys.importPackage := Seq("javax.swing;resolution:=optional", "*")
++      }
+     )
+   )
+ 
+@@ -194,9 +138,7 @@ object build extends Build {
+     base = file("concurrent"),
+     settings = standardSettings ++ Seq[Sett](
+       name := "scalaz-concurrent",
+-      typeClasses := TypeClass.concurrent,
+-      osgiExport("scalaz.concurrent"),
+-      OsgiKeys.importPackage := Seq("javax.swing;resolution:=optional", "*")
++      typeClasses := TypeClass.concurrent
+     ),
+     dependencies = Seq(core, effect)
+   )
+@@ -206,8 +148,7 @@ object build extends Build {
+     base = file("effect"),
+     settings = standardSettings ++ Seq[Sett](
+       name := "scalaz-effect",
+-      typeClasses := TypeClass.effect,
+-      osgiExport("scalaz.effect", "scalaz.std.effect", "scalaz.syntax.effect")
++      typeClasses := TypeClass.effect
+     ),
+     dependencies = Seq(core)
+   )
+@@ -216,8 +157,7 @@ object build extends Build {
+     id = "iteratee",
+     base = file("iteratee"),
+     settings = standardSettings ++ Seq[Sett](
+-      name := "scalaz-iteratee",
+-      osgiExport("scalaz.iteratee")
++      name := "scalaz-iteratee"
+     ),
+     dependencies = Seq(effect)
+   )
+@@ -226,9 +166,7 @@ object build extends Build {
+     id = "iterv",
+     base = file("iterv"),
+     settings = standardSettings ++ Seq[Sett](
+-      name := "scalaz-iterv",
+-      OsgiKeys.fragmentHost := Some("org.scalaz.core"),
+-      OsgiKeys.exportPackage := Seq("scalaz;version=${Bundle-Version};-split-package:=first")
++      name := "scalaz-iterv"
+     ),
+     dependencies = Seq(effect)
+   )
+@@ -237,8 +175,7 @@ object build extends Build {
+     id = "typelevel",
+     base = file("typelevel"),
+     settings = standardSettings ++ Seq[Sett](
+-      name := "scalaz-typelevel",
+-      osgiExport("scalaz.typelevel", "scalaz.syntax.typelevel")
++      name := "scalaz-typelevel"
+     ),
+     dependencies = Seq(core)
+   )
+@@ -248,8 +185,7 @@ object build extends Build {
+     base = file("xml"),
+     settings = standardSettings ++ Seq[Sett](
+       name := "scalaz-xml",
+-      typeClasses := TypeClass.xml,
+-      osgiExport("scalaz.xml")
++      typeClasses := TypeClass.xml
+     ),
+     dependencies = Seq(core)
+   )
+@@ -260,7 +196,6 @@ object build extends Build {
+     dependencies = Seq(core, iteratee, concurrent, typelevel, xml),
+     settings = standardSettings ++ Seq[Sett](
+       name := "scalaz-example",
+-      previousArtifact := None,
+       publishArtifact := false
+     )
+   )
+@@ -271,8 +206,7 @@ object build extends Build {
+     dependencies = Seq(core, concurrent, typelevel, xml),
+     settings     = standardSettings ++ Seq[Sett](
+       name := "scalaz-scalacheck-binding",
+-      libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.10.0",
+-      osgiExport("scalaz.scalacheck")
++      libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.10.0"
+     )
+   )
+ 
+@@ -283,7 +217,6 @@ object build extends Build {
+     settings = standardSettings ++Seq[Sett](
+       name := "scalaz-tests",
+       publishArtifact := false,
+-      previousArtifact := None,
+       libraryDependencies <++= (scalaVersion) { sv => Seq(
+         "org.specs2" %% "specs2" % Dependencies.specs2(sv) % "test",
+         "org.scalacheck" %% "scalacheck" % "1.10.0" % "test"
+@@ -392,7 +325,6 @@ object build extends Build {
+     writeFileScalazPackage("TupleOps.scala", source)
+   }
+ 
+-  def osgiExport(packs: String*) = OsgiKeys.exportPackage := packs.map(_ + ".*;version=${Bundle-Version}")
+ }
+ 
+ // vim: expandtab:ts=2:sw=2
+diff --git a/project/plugins.sbt b/project/plugins.sbt
+index e83215b..8901d19 100644
+--- a/project/plugins.sbt
++++ b/project/plugins.sbt
+@@ -1,11 +1,11 @@
+-resolvers += Resolver.url("scalasbt", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
++// resolvers += Resolver.url("scalasbt", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
+ 
+-addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8")
++// addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8")
+ 
+-addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.7")
++// addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.7")
+ 
+-addSbtPlugin("com.typesafe.sbtosgi" % "sbtosgi" % "0.3.0")
++// addSbtPlugin("com.typesafe.sbtosgi" % "sbtosgi" % "0.3.0")
+ 
+-addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.2.2")
++// addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.2.2")
+ 
+-addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.4")
++// addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.4")
diff --git a/scalaz.spec b/scalaz.spec
new file mode 100644
index 0000000..e04c0c4
--- /dev/null
+++ b/scalaz.spec
@@ -0,0 +1,135 @@
+%global scalaz_version 7.0.0
+%global scala_short_version 2.10
+
+# set this to 1 once scalacheck is available in Fedora (currently:
+# yes) and scalaz's scalacheck support compiles (currently: no)
+
+%global have_scalacheck 0
+
+# set this to 1 once sbt is available in Fedora
+%global have_native_sbt 1
+
+Name:		scalaz
+Version:	%{scalaz_version}
+Release:	2%{?dist}
+Summary:	extension to the core Scala library for functional programming
+
+License:	BSD
+URL:		http://typelevel.org
+Source0:	https://github.com/scalaz/scalaz/archive/v%{scalaz_version}.tar.gz#/%{name}-v%{version}.tar.gz
+Source1:	https://raw.github.com/willb/climbing-nemesis/master/climbing-nemesis.py
+
+Patch0:		scalaz-7.0.0-build.patch
+
+BuildArch:	noarch
+
+BuildRequires:	mvn(org.scalacheck:scalacheck_%{scala_short_version})
+BuildRequires:	scala
+%if %{have_native_sbt}
+BuildRequires:	sbt
+%endif
+
+BuildRequires:	javapackages-tools
+Requires:	javapackages-tools
+
+Requires:       scala
+Requires:	jansi
+
+%description
+
+Scalaz is a Scala library for functional programming.  It provides
+purely functional data structures to complement those from the Scala
+standard library. It defines a set of foundational type classes
+(e.g. Functor, Monad) and corresponding instances for a large number
+of data structures.
+
+%package javadoc
+Summary:	Javadoc for %{name}
+
+%description javadoc
+This package contains javadoc for %{name}.
+
+%prep
+%setup -q
+%patch0 -p1
+
+%if %{have_native_sbt}
+rm ./sbt
+%endif
+
+cp %{SOURCE1} .
+chmod 755 climbing-nemesis.py
+
+sed -i -e 's/1[.]10[.]0/1.11.0/g' project/build.scala
+
+%if 0%{have_scalacheck} == 0
+sed -i -e 's/scalacheckBinding, tests,//g' project/build.scala
+%else
+sed -i -e 's/ tests,//g' project/build.scala
+./climbing-nemesis.py org.scalacheck scalacheck_%{scala_short_version} ivy-local
+%endif
+
+cp etc/LICENCE LICENCE
+
+%build
+
+%if %{have_native_sbt}
+cp -r /usr/share/sbt/ivy-local .
+mkdir boot
+
+export SBT_BOOT_DIR=boot
+export SBT_IVY_DIR=ivy-local
+
+sbt package makePom doc
+%else
+./sbt package makePom doc
+%endif
+
+%install
+mkdir -p %{buildroot}/%{_javadir}/%{name}/
+mkdir -p %{buildroot}/%{_mavenpomdir}
+mkdir -p %{buildroot}/%{_javadocdir}/%{name}
+
+for jar in $(find . -wholename \*/scala-%{scala_short_version}/%{name}-\*.jar); do 
+    echo $jar
+    shortname=$(echo $jar | sed -e 's/^.*[/]\([a-z-]\+\)_%{scala_short_version}-%{scalaz_version}.jar$/\1/g')
+    cp -p $jar %{buildroot}/%{_javadir}/scalaz/${shortname}.jar
+done
+
+for apidir in $(find . -name api -type d | grep -v ivy-local); do
+    module=$(echo $apidir | cut -f2 -d/)
+    mkdir %{buildroot}/%{_javadocdir}/%{name}/$module
+    cp -rp $apidir/* %{buildroot}/%{_javadocdir}/%{name}/$module
+done
+
+for pom in $(find . -name %{name}-\*.pom ) ; do 
+    shortname=$(echo $pom | sed -e 's/^.*[/]\([a-z-]\+\)_%{scala_short_version}-%{scalaz_version}.pom$/\1/g')
+    echo installing POM $pom to %{_mavenpomdir}/JPP.%{name}-${shortname}.pom
+    cp -p $pom %{buildroot}/%{_mavenpomdir}/JPP.%{name}-${shortname}.pom
+    echo %{_mavenpomdir}/JPP.%{name}-${shortname}.pom >> .rpm_pomfiles
+    shortnames=( "${shortnames[@]}" $shortname )
+done
+
+echo shortnames are ${shortnames[@]}
+
+for sub in ${shortnames[@]} ; do
+    echo running add_maven_depmap JPP.%{name}-${sub}.pom %{name}/${sub}.jar
+    %add_maven_depmap JPP.%{name}-${sub}.pom %{name}/${sub}.jar
+done
+
+%files -f .mfiles
+%dir %{_javadir}/%{name}/
+%doc README.md LICENCE
+
+%files javadoc
+%{_javadocdir}/%{name}/
+%doc LICENCE
+
+%changelog
+* Wed Feb 26 2014 William Benton <willb at redhat.com> - 7.0.0-2
+- updated paths for released sbt
+- install POM files now
+- generate javadocs
+
+* Tue Nov 26 2013 William Benton <willb at redhat.com> - 7.0.0-1
+- initial package
diff --git a/sources b/sources
index e69de29..df3309d 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+2e05e27d9481f4e55f2ae5ca5274136f  scalaz-v7.0.0.tar.gz


More information about the scm-commits mailing list