SHA256
1
0
forked from pool/aqute-bnd
Fridrich Strba 2023-09-17 17:41:28 +00:00 committed by Git OBS Bridge
parent 9c2a93e420
commit 378921bae0
7 changed files with 431 additions and 78 deletions

View File

@ -5,8 +5,8 @@ Sat Sep 16 10:08:36 UTC 2023 - Fridrich Strba <fstrba@suse.com>
* reproducible-timestamps.patch
+ set "-reproducible" option to true by default
+ use SOURCE_DATE_EPOCH for timestamp if available
* reproducible-packages-list.patch
+ make the order of packages to import/export determininstic
* reproducible-element-order.patch
+ make the order of elements in manifest deterministic
-------------------------------------------------------------------
Thu May 4 14:25:12 UTC 2023 - Dominique Leuenberger <dimstar@opensuse.org>

View File

@ -37,8 +37,7 @@ Patch2: 0003-Port-to-OSGI-7.0.0.patch
Patch3: aqute-bnd-java8compat.patch
Patch4: 0004-maven-plugin-dependencies.patch
Patch5: reproducible-timestamps.patch
Patch6: reproducible-packages-list.patch
Patch7: reproducible-require-capability.patch
Patch6: reproducible-element-order.patch
BuildRequires: ant
BuildRequires: fdupes
BuildRequires: javapackages-local
@ -100,7 +99,6 @@ build-jar-repository -s lib \
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
# the commands pull in more dependencies than we want (felix-resolver, jetty, jtwig, javapackager)
rm biz.aQute.bnd/src/aQute/bnd/main/{RemoteCommand,ResolveCommand,ExportReportCommand,MbrCommand,ReporterLogger}.java

View File

@ -5,10 +5,8 @@ Sat Sep 16 10:08:36 UTC 2023 - Fridrich Strba <fstrba@suse.com>
* reproducible-timestamps.patch
+ set "-reproducible" option to true by default
+ use SOURCE_DATE_EPOCH for timestamp if available
* reproducible-packages-list.patch
+ make the order of packages to import/export deterministic
* reproducible-require-capability.patch
+ make the order of require-capabilities entries deterministic
* reproducible-element-order.patch
+ make the order of elements in manifest deterministic
-------------------------------------------------------------------
Wed Apr 26 17:47:47 UTC 2023 - Fridrich Strba <fstrba@suse.com>

View File

@ -30,8 +30,7 @@ Patch2: 0003-Port-to-OSGI-7.0.0.patch
Patch3: aqute-bnd-java8compat.patch
Patch4: 0004-maven-plugin-dependencies.patch
Patch5: reproducible-timestamps.patch
Patch6: reproducible-packages-list.patch
Patch7: reproducible-require-capability.patch
Patch6: reproducible-element-order.patch
BuildRequires: fdupes
BuildRequires: maven-local
BuildRequires: mvn(biz.aQute.bnd:biz.aQute.bndlib)
@ -67,7 +66,6 @@ API documentation for %{name}.
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
pushd maven
%pom_remove_dep -r :biz.aQute.bnd.maven

View File

@ -0,0 +1,425 @@
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/ActivelyClosingClassLoader.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/ActivelyClosingClassLoader.java
index 761f48ef..4c9b3efd 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/ActivelyClosingClassLoader.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/ActivelyClosingClassLoader.java
@@ -14,10 +14,10 @@ import java.net.URLClassLoader;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.util.Enumeration;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.TreeMap;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -35,7 +35,7 @@ import aQute.lib.io.IO;
* This class loader can load classes from JAR files.
*/
class ActivelyClosingClassLoader extends URLClassLoader implements Closeable {
- final AtomicReference<Map<File, Wrapper>> wrappers = new AtomicReference<>(new LinkedHashMap<>());
+ final AtomicReference<Map<File, Wrapper>> wrappers = new AtomicReference<>(new TreeMap<>());
final AtomicBoolean open = new AtomicBoolean(true);
final Processor processor;
ScheduledFuture<?> schedule;
@@ -89,7 +89,7 @@ class ActivelyClosingClassLoader extends URLClassLoader implements Closeable {
throw new IllegalStateException("Already closed");
}
wrappers.updateAndGet(map -> {
- Map<File, Wrapper> copy = new LinkedHashMap<>(map);
+ Map<File, Wrapper> copy = new TreeMap<>(map);
copy.computeIfAbsent(file, Wrapper::new);
return copy;
});
@@ -183,7 +183,7 @@ class ActivelyClosingClassLoader extends URLClassLoader implements Closeable {
if (schedule != null) {
schedule.cancel(true);
}
- wrappers.getAndSet(new LinkedHashMap<>())
+ wrappers.getAndSet(new TreeMap<>())
.values()
.forEach(Wrapper::close);
}
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/Analyzer.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/Analyzer.java
index bf5029ae..533eea3d 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/Analyzer.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/Analyzer.java
@@ -43,7 +43,6 @@ import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -2144,7 +2143,7 @@ public class Analyzer extends Processor {
.distinct()
.filter(this::isProvider)
.map(TypeRef::getPackageRef)
- .collect(toCollection(LinkedHashSet<PackageRef>::new));
+ .collect(toCollection(TreeSet<PackageRef>::new));
return providers;
}
@@ -2686,7 +2685,7 @@ public class Analyzer extends Processor {
// Look at the referred packages
// and copy them to our baseline
- Set<PackageRef> refs = new LinkedHashSet<>(clazz.getReferred());
+ Set<PackageRef> refs = new TreeSet<>(clazz.getReferred());
refs.addAll(referencesByAnnotation(clazz));
for (PackageRef p : refs) {
referred.put(p);
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/Annotation.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/Annotation.java
index 685c92e1..c3f10b29 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/Annotation.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/Annotation.java
@@ -6,9 +6,9 @@ import java.lang.annotation.RetentionPolicy;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
-import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.TreeMap;
import java.util.Set;
import java.util.stream.Stream;
@@ -150,7 +150,7 @@ public class Annotation {
public void put(String string, Object v) {
if (elements == null) {
- elements = new LinkedHashMap<>();
+ elements = new TreeMap<>();
}
elements.put(string, v);
}
@@ -193,7 +193,7 @@ public class Annotation {
public <T extends java.lang.annotation.Annotation> T getAnnotation(Class<T> c) throws Exception {
if (elements == null) {
- elements = new LinkedHashMap<>();
+ elements = new TreeMap<>();
}
return CONVERTER.convert(c, elements);
}
@@ -211,7 +211,7 @@ public class Annotation {
return;
}
if (elements == null) {
- elements = new LinkedHashMap<>(map);
+ elements = new TreeMap<>(map);
} else {
map.forEach(elements::putIfAbsent);
}
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/Clazz.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/Clazz.java
index b97251b5..e0e315bf 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/Clazz.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/Clazz.java
@@ -32,7 +32,6 @@ import java.util.Deque;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -40,6 +39,7 @@ import java.util.Properties;
import java.util.Set;
import java.util.Spliterator;
import java.util.Spliterators.AbstractSpliterator;
+import java.util.TreeMap;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
@@ -1478,7 +1478,7 @@ public class Clazz {
private Map<String, Object> annotationValues(ElementValueInfo[] values, ElementType elementType,
RetentionPolicy policy, int access_flags) {
- Map<String, Object> elements = new LinkedHashMap<>();
+ Map<String, Object> elements = new TreeMap<>();
for (ElementValueInfo elementValueInfo : values) {
String element = elementValueInfo.name;
Object value = newElementValue(elementValueInfo.value, elementType, policy, access_flags);
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/Instructions.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/Instructions.java
index bf1d13c4..277d8f00 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/Instructions.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/Instructions.java
@@ -9,10 +9,10 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
@@ -23,13 +23,13 @@ import aQute.lib.collections.MultiMap;
import aQute.lib.io.IO;
public class Instructions implements Map<Instruction, Attrs> {
- private LinkedHashMap<Instruction, Attrs> map;
+ private TreeMap<Instruction, Attrs> map;
public static Instructions ALWAYS = new Instructions();
static Map<Instruction, Attrs> EMPTY = Collections.emptyMap();
public Instructions(Instructions other) {
if (other.map != null && !other.map.isEmpty()) {
- map = new LinkedHashMap<>(other.map);
+ map = new TreeMap<>(other.map);
}
}
@@ -134,7 +134,7 @@ public class Instructions implements Map<Instruction, Attrs> {
@Override
public Attrs put(Instruction key, Attrs value) {
if (map == null)
- map = new LinkedHashMap<>();
+ map = new TreeMap<>();
return map.put(key, value);
}
@@ -144,7 +144,7 @@ public class Instructions implements Map<Instruction, Attrs> {
if (this.map == null) {
if (map.isEmpty())
return;
- this.map = new LinkedHashMap<>();
+ this.map = new TreeMap<>();
}
this.map.putAll(map);
}
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/Macro.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/Macro.java
index 47312379..f9996bd8 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/Macro.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/Macro.java
@@ -29,7 +29,6 @@ import java.util.Date;
import java.util.Deque;
import java.util.Formatter;
import java.util.Iterator;
-import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
@@ -42,6 +41,7 @@ import java.util.Random;
import java.util.Set;
import java.util.TimeZone;
import java.util.TreeMap;
+import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.BiFunction;
import java.util.function.Function;
@@ -2166,7 +2166,7 @@ public class Macro {
* @return a map with commands and their help
*/
public Map<String, String> getCommands() {
- Set<Object> targets = new LinkedHashSet<>();
+ Set<Object> targets = new TreeSet<>();
Collections.addAll(targets, this.targets);
Processor rover = domain;
while (rover != null) {
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/Packages.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/Packages.java
index 6e0cd11d..6bd42dcd 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/Packages.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/Packages.java
@@ -1,9 +1,9 @@
package aQute.bnd.osgi;
import java.util.Collection;
-import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
import aQute.bnd.header.Attrs;
import aQute.bnd.osgi.Descriptors.PackageRef;
@@ -21,11 +21,11 @@ public class Packages implements Map<PackageRef, Attrs> {
}
public Packages(Packages other) {
- map = new LinkedHashMap<>(other.map);
+ map = new TreeMap<>(other.map);
}
public Packages() {
- map = new LinkedHashMap<>();
+ map = new TreeMap<>();
}
@Override
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/Processor.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/Processor.java
index ca5d496d..c65c493e 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/Processor.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/Processor.java
@@ -31,7 +31,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -41,6 +40,7 @@ import java.util.Properties;
import java.util.Random;
import java.util.Set;
import java.util.Spliterator;
+import java.util.TreeMap;
import java.util.TreeSet;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
@@ -942,11 +942,11 @@ public class Processor extends Domain implements Reporter, Registry, Constants,
}
public static <K, V> Map<K, V> newMap() {
- return new LinkedHashMap<>();
+ return new TreeMap<>();
}
public static <K, V> Map<K, V> newHashMap() {
- return new LinkedHashMap<>();
+ return new TreeMap<>();
}
public <T> List<T> newList(Collection<T> t) {
@@ -958,7 +958,7 @@ public class Processor extends Domain implements Reporter, Registry, Constants,
}
public <K, V> Map<K, V> newMap(Map<K, V> t) {
- return new LinkedHashMap<>(t);
+ return new TreeMap<>(t);
}
@Override
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/eclipse/EclipseClasspath.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/eclipse/EclipseClasspath.java
index 3f9a2be9..2daf737c 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/eclipse/EclipseClasspath.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/eclipse/EclipseClasspath.java
@@ -5,11 +5,11 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
+import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -34,18 +34,18 @@ public class EclipseClasspath {
static final DocumentBuilderFactory documentBuilderFactory = XML.newDocumentBuilderFactory();
File project;
File workspace;
- Set<File> sources = new LinkedHashSet<>();
- Set<File> allSources = new LinkedHashSet<>();
+ Set<File> sources = new TreeSet<>();
+ Set<File> allSources = new TreeSet<>();
- Set<File> classpath = new LinkedHashSet<>();
+ Set<File> classpath = new TreeSet<>();
List<File> dependents = new ArrayList<>();
File output;
boolean recurse = true;
- Set<File> exports = new LinkedHashSet<>();
+ Set<File> exports = new TreeSet<>();
Map<String, String> properties = new HashMap<>();
Reporter reporter;
int options;
- Set<File> bootclasspath = new LinkedHashSet<>();
+ Set<File> bootclasspath = new TreeSet<>();
public final static int DO_VARIABLES = 1;
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/repository/ResourcesRepository.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/repository/ResourcesRepository.java
index 4cf286bc..8ef64202 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/repository/ResourcesRepository.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/repository/ResourcesRepository.java
@@ -5,10 +5,10 @@ import static java.util.stream.Collectors.toMap;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Predicate;
import java.util.stream.Collector;
@@ -24,7 +24,7 @@ public class ResourcesRepository extends BaseRepository {
private final Map<String, Predicate<Map<String, Object>>> cache;
public ResourcesRepository() {
- resources = new LinkedHashSet<>();
+ resources = new TreeSet<>();
cache = new ConcurrentHashMap<>();
}
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/repository/SimpleIndexer.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/repository/SimpleIndexer.java
index 9ac735f6..6e022641 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/repository/SimpleIndexer.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/repository/SimpleIndexer.java
@@ -9,10 +9,10 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.util.Collection;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
+import java.util.TreeSet;
import java.util.stream.Collectors;
import org.osgi.resource.Resource;
@@ -67,7 +67,7 @@ public class SimpleIndexer {
void analyzeFile(File file, ResourceBuilder resourceBuilder) throws Exception;
}
- private final Set<File> files = new LinkedHashSet<>();
+ private final Set<File> files = new TreeSet<>();
private Path base;
private boolean compress = false;
private String name;
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/ResourceBuilder.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/ResourceBuilder.java
index ebb8463a..e624009c 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/ResourceBuilder.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/ResourceBuilder.java
@@ -11,8 +11,6 @@ import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -20,6 +18,7 @@ import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import java.util.TreeMap;
+import java.util.TreeSet;
import java.util.function.Supplier;
import java.util.jar.Manifest;
@@ -101,7 +100,7 @@ public class ResourceBuilder {
}
private static <CR> void add(Map<String, Set<CR>> map, String namespace, CR capreq) {
- map.computeIfAbsent(namespace, k -> new LinkedHashSet<>())
+ map.computeIfAbsent(namespace, k -> new TreeSet<>())
.add(capreq);
}
@@ -672,7 +671,7 @@ public class ResourceBuilder {
}
public Map<Capability, Capability> from(Resource bundle) {
- Map<Capability, Capability> mapping = new LinkedHashMap<>();
+ Map<Capability, Capability> mapping = new TreeMap<>();
addRequirements(bundle.getRequirements(null));

View File

@ -1,27 +0,0 @@
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/Packages.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/Packages.java
@@ -1,9 +1,9 @@
package aQute.bnd.osgi;
import java.util.Collection;
-import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
import aQute.bnd.header.Attrs;
import aQute.bnd.osgi.Descriptors.PackageRef;
@@ -21,11 +21,11 @@ public class Packages implements Map<PackageRef, Attrs> {
}
public Packages(Packages other) {
- map = new LinkedHashMap<>(other.map);
+ map = new TreeMap<>(other.map);
}
public Packages() {
- map = new LinkedHashMap<>();
+ map = new TreeMap<>();
}
@Override

View File

@ -1,39 +0,0 @@
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/ResourceBuilder.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/ResourceBuilder.java
index ebb8463a..e624009c 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/ResourceBuilder.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/ResourceBuilder.java
@@ -11,8 +11,6 @@ import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -20,6 +18,7 @@ import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import java.util.TreeMap;
+import java.util.TreeSet;
import java.util.function.Supplier;
import java.util.jar.Manifest;
@@ -101,7 +100,7 @@ public class ResourceBuilder {
}
private static <CR> void add(Map<String, Set<CR>> map, String namespace, CR capreq) {
- map.computeIfAbsent(namespace, k -> new LinkedHashSet<>())
+ map.computeIfAbsent(namespace, k -> new TreeSet<>())
.add(capreq);
}
@@ -672,7 +671,7 @@ public class ResourceBuilder {
}
public Map<Capability, Capability> from(Resource bundle) {
- Map<Capability, Capability> mapping = new LinkedHashMap<>();
+ Map<Capability, Capability> mapping = new TreeMap<>();
addRequirements(bundle.getRequirements(null));