From bd802733209d979a05b7b884500310ed9f3bdf33af6b1d4a2a017c4ecfdf4aa3 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Tue, 24 Sep 2024 13:37:48 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/Java:packages/scala-ant?expand=0&rev=5 --- .gitattributes | 23 +++++ .gitignore | 1 + 0001-no-pack200.patch | 204 ++++++++++++++++++++++++++++++++++++++++ _service | 14 +++ scala-ant-2.13.1.tar.xz | 3 + scala-ant.changes | 15 +++ scala-ant.spec | 67 +++++++++++++ scala.ant.d | 1 + 8 files changed, 328 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 0001-no-pack200.patch create mode 100644 _service create mode 100644 scala-ant-2.13.1.tar.xz create mode 100644 scala-ant.changes create mode 100644 scala-ant.spec create mode 100644 scala.ant.d diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/0001-no-pack200.patch b/0001-no-pack200.patch new file mode 100644 index 0000000..2bf4677 --- /dev/null +++ b/0001-no-pack200.patch @@ -0,0 +1,204 @@ +From 5c585eb8ce8d91a64430ecc88f7c78d6a7b2e907 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Fridrich=20=C5=A0trba?= +Date: Sat, 30 Sep 2023 14:29:38 +0200 +Subject: [PATCH] no-pack200 + +--- + src/main/resources/scala/tools/ant/antlib.xml | 2 - + .../scala/scala/tools/ant/Pack200Task.scala | 173 ------------------ + 2 files changed, 175 deletions(-) + delete mode 100644 src/main/scala/scala/tools/ant/Pack200Task.scala + +diff --git a/src/main/resources/scala/tools/ant/antlib.xml b/src/main/resources/scala/tools/ant/antlib.xml +index 7885534..e3c3e37 100644 +--- a/src/main/resources/scala/tools/ant/antlib.xml ++++ b/src/main/resources/scala/tools/ant/antlib.xml +@@ -11,6 +11,4 @@ + classname="scala.tools.ant.Scaladoc"/> + +- + +diff --git a/src/main/scala/scala/tools/ant/Pack200Task.scala b/src/main/scala/scala/tools/ant/Pack200Task.scala +deleted file mode 100644 +index fa41bc1..0000000 +--- a/src/main/scala/scala/tools/ant/Pack200Task.scala ++++ /dev/null +@@ -1,173 +0,0 @@ +-/* +- * Scala (https://www.scala-lang.org) +- * +- * Copyright EPFL and Lightbend, Inc. +- * +- * Licensed under Apache License 2.0 +- * (http://www.apache.org/licenses/LICENSE-2.0). +- * +- * See the NOTICE file distributed with this work for +- * additional information regarding copyright ownership. +- */ +- +-package scala.tools.ant +- +-import java.io.{BufferedOutputStream, File, FileOutputStream} +-import java.util.jar.{JarFile, JarOutputStream, Pack200} +-import java.util.jar.Pack200.Packer._ +- +-/** An [[http://ant.apache.org Ant]] task that applies the pack200 encoding +- * to a JAR file. +- * +- * - `destdir` (mandatory), +- * - `dir` (defaults to project's basedir), +- * - `effort` (default 9), +- * - `keepFileOrder` (default `'''false'''`), +- * - `keepModificationTime` (default `'''false'''`), +- * - `repack` (default false), +- * - `segmentLimit` (default `-1` for no limit), +- * - `suffix` (default ".pack") +- * +- * @author James Matlik +- */ +-class Pack200Task extends ScalaMatchingTask { +- +-/*============================================================================*\ +-** Ant user-properties ** +-\*============================================================================*/ +- +- var destdir: Option[File] = None +- var srcdir: Option[File] = None +- +- var effort = 9 +- var keepFileOrder = false +- var keepModificationTime = false +- var repack = false +- var segmentLimit: Int = -1 +- +- var packFileSuffix = ".pack" +- +- +-/*============================================================================*\ +-** Properties setters ** +-\*============================================================================*/ +- +- def setDir(dir: File): Unit = { +- if (dir.exists && dir.isDirectory) srcdir = Some(dir) +- else buildError("Please specify a valid directory with Jar files for packing.") +- } +- +- /** A level from 0 (none) to 9 (max) of effort for applying Pack200 */ +- def setEffort(x: Int): Unit = { +- if (effort < 10 && effort > -1) effort = x +- else buildError("The effort level must be a value from 0 to 9") +- } +- +- /** Set the flag to specify if file reordering should be performed. Reordering +- * is used to remove empty packages and improve pack200 optimization. +- * @param x +- * `'''true'''` to retain file ordering. +- * `'''false'''` to optimize directory structure (DEFAULT). */ +- def setKeepFileOrder(x: Boolean): Unit = { keepFileOrder = x } +- +- /** If false, a single modification time is used for all contained files */ +- def setKeepModificationTime(x: Boolean): Unit = { keepModificationTime = x } +- +- /** A flag that tells the task to pack and then unpack the source JAR file +- * into another JAR file. This resulting JAR file can then be signed, +- * packed again, compressed and distributed for securely distributed code. +- */ +- def setRepack(r: Boolean): Unit = { repack = r } +- +- +- def setSegmentLimit(size: Int): Unit = { segmentLimit = size } +- +- /** Set the output directory */ +- def setDestdir(file: File): Unit = { +- if (file != null && file.exists && file.isDirectory) destdir = Some(file) +- else buildError("The destination directory is invalid: " + file.getAbsolutePath) +- } +- +- def setSuffix(s: String): Unit = { packFileSuffix = s } +- +-/*============================================================================*\ +-** Properties getters ** +-\*============================================================================*/ +- +- /** Gets the list of individual JAR files for processing. +- * @return The list of JAR files */ +- private def getFileList: List[File] = { +- var files: List[File] = Nil +- val fs = getImplicitFileSet +- val ds = fs.getDirectoryScanner(getProject) +- val dir = fs.getDir(getProject) +- for (filename <- ds.getIncludedFiles +- if filename.toLowerCase.endsWith(".jar")) { +- val file = new File(dir, filename) +- if(!files.exists(file.equals(_))) files = file :: files +- } +- files.reverse +- } +- +-/*============================================================================*\ +-** Compilation and support methods ** +-\*============================================================================*/ +- +- private def makeJarOutputStream(file: File) = +- new JarOutputStream(makeOutputStream(file)) +- +- private def makeOutputStream(file: File) = +- new BufferedOutputStream(new FileOutputStream(file)) +- +-/*============================================================================*\ +-** The big execute method ** +-\*============================================================================*/ +- +- /** Performs the tool creation. */ +- override def execute(): Unit = { +- // Audits +- val packDir = destdir.getOrElse(buildError("No output directory specified")) +- +- // Setup the inherited fileset for further processing +- fileset.setDir(srcdir.getOrElse(getProject.getBaseDir)) +- +- val files = getFileList +- if (files.isEmpty) buildError("No JAR files were selected for packing.") +- +- // Setup the packer +- val packer = Pack200.newPacker +- val p = packer.properties +- p.put(EFFORT, effort.toString) +- p.put(SEGMENT_LIMIT, segmentLimit.toString) +- p.put(KEEP_FILE_ORDER, if(keepFileOrder) TRUE else FALSE) +- p.put(MODIFICATION_TIME, if(keepModificationTime) LATEST else KEEP) +- +- for (file <- files) { +- if (repack) { +- val repackedFile = new File(packDir, file.getName) +- if (file.lastModified > repackedFile.lastModified) { +- println("Repacking " + file.toString + " to " + repackedFile.toString) +- val tmpFile = new File(packDir, file.getName + ".tmp") +- val os = makeOutputStream(tmpFile) +- packer.pack(new JarFile(file), os) +- os.close() +- val jos = makeJarOutputStream(repackedFile) +- Pack200.newUnpacker.unpack(tmpFile, jos) +- jos.close() +- tmpFile.delete() +- } +- } +- else { +- val packFile: File = { +- val name = file.getName.substring(0, file.getName.lastIndexOf(".")) +- new File(packDir, name + packFileSuffix) +- } +- if(file.lastModified > packFile.lastModified) { +- println("Packing " + file.toString + " to " + packFile.toString) +- val os = makeOutputStream(packFile) +- packer.pack(new JarFile(file), os) +- } +- } +- } +- } +-} +-- +2.42.0 + diff --git a/_service b/_service new file mode 100644 index 0000000..398fd8b --- /dev/null +++ b/_service @@ -0,0 +1,14 @@ + + + git + https://github.com/cigaly/scala-ant.git + 8137805062b98a7c201392542f4e29cefac03103 + 2.13.1 + *gradle* + + + *.tar + xz + + + diff --git a/scala-ant-2.13.1.tar.xz b/scala-ant-2.13.1.tar.xz new file mode 100644 index 0000000..1b60596 --- /dev/null +++ b/scala-ant-2.13.1.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2edcec91f8b05b8870c7c7d9837618209ef2a616a0d0088bf2efeadeb26a57d8 +size 26576 diff --git a/scala-ant.changes b/scala-ant.changes new file mode 100644 index 0000000..445ba06 --- /dev/null +++ b/scala-ant.changes @@ -0,0 +1,15 @@ +------------------------------------------------------------------- +Tue Sep 24 13:37:40 UTC 2024 - Fridrich Strba + +- Use SOURCE_DATE_EPOCH for reproducible jar mtime + +------------------------------------------------------------------- +Wed Feb 21 20:51:04 UTC 2024 - Fridrich Strba + +- Use %patch -P N instead of deprecated %patchN. + +------------------------------------------------------------------- +Sat Sep 30 12:43:00 UTC 2023 - Fridrich Strba + +- Initial packaging of version 2.13.1 for scala 2.13, where the ant + tasks are not included any more diff --git a/scala-ant.spec b/scala-ant.spec new file mode 100644 index 0000000..7dd313d --- /dev/null +++ b/scala-ant.spec @@ -0,0 +1,67 @@ +# +# spec file for package scala-ant +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: scala-ant +Version: 2.13.1 +Release: 0 +Summary: Scala Ant Support +License: Apache-2.0 +URL: https://github.com/cigaly/scala-ant +Source0: %{name}-%{version}.tar.xz +Source1: scala.ant.d +Patch0: 0001-no-pack200.patch +BuildRequires: ant +BuildRequires: java-devel +BuildRequires: javapackages-tools +BuildRequires: scala >= %{version} +Requires: scala >= %{version} +Provides: ant-scala = %{version} +Obsoletes: ant-scala < %{version} +BuildArch: noarch + +%description +Ant support from scala, copied from original repository +since it is abandoned in 2.13+ + +%prep +%setup -q +%patch -P 0 -p1 + +%build +mkdir -p target/classes + +scalac -release 8 -d target/classes -cp $(build-classpath ant scala) \ + $(find src/main -name \*.scala | xargs) +jar \ +%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 17}%{!?pkg_vcmp:0} + --date="$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ)" \ +%endif + --create --file=target/%{name}-%{version}.jar -C target/classes . -C src/main/resources . + +%install +install -d -m 0755 %{buildroot}%{_javadir}/scala +install -p -m 0644 target/%{name}-%{version}.jar %{buildroot}%{_javadir}/scala/%{name}.jar +install -d -m 0755 %{buildroot}%{_sysconfdir}/ant.d +install -p -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/ant.d/scala + +%files +%license LICENSE +%{_javadir}/scala/%{name}.jar +%{_sysconfdir}/ant.d/scala + +%changelog diff --git a/scala.ant.d b/scala.ant.d new file mode 100644 index 0000000..0037f1b --- /dev/null +++ b/scala.ant.d @@ -0,0 +1 @@ +scala