Compare commits
22 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
261e44c3fa | ||
|
|
0999df51b8 | ||
|
|
26792c770b | ||
|
|
13f9485252 | ||
|
|
d5d139af27 | ||
|
|
5db07614a8 | ||
|
|
4758ee4fda | ||
|
|
25bf954aac | ||
|
|
af194b6641 | ||
|
|
75adec844b | ||
|
|
0cd1370868 | ||
|
|
745343f757 | ||
|
|
50e2e10695 | ||
|
|
c9fe403c5e | ||
|
|
27b31452b9 | ||
|
|
1433c52224 | ||
|
|
4d05ece41c | ||
|
|
5f09737c33 | ||
|
|
cfa4787b3b | ||
|
|
d633634528 | ||
|
|
ed92ce4e3b | ||
|
|
b86f2bd711 |
11 changed files with 117 additions and 60 deletions
24
README.md
24
README.md
|
|
@ -1,23 +1,5 @@
|
|||
# javapackages-validator-tests
|
||||
# Deprecated
|
||||
|
||||
This repository contains the `.fmf` test files referenced by packages that are tested by _javapackages-validator_ tool.
|
||||
This repository is deprecated.
|
||||
|
||||
## Versioning
|
||||
|
||||
The version scheme is based on Fedora versions (`f<NUM>`).
|
||||
Changes made to a single branch must be backwards compatible or fix a bug.
|
||||
Breaking changes can be made to a branch that corresponds to the Rawhide branch at the time of submission.
|
||||
Packages then explicitly update their git reference and new versions of the package will be tested with the new tests.
|
||||
|
||||
This approach ensures that changes to old versions of packages will not be tested with possibly incompatible tests.
|
||||
|
||||
## Forking
|
||||
|
||||
If you wish to fork this project and add your own tests, you should follow these steps:
|
||||
|
||||
1. Add a source directory (e.g. `src`) with your own validators.
|
||||
2. Add a text [service file](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/ServiceLoader.html) named `org.fedoraproject.javapackages.validator.Validator` into the same directory.
|
||||
This file contains fully-qualified class names of validators which you want to use, one name per line.
|
||||
|
||||
Javapackages-validator will run all the validators listed in the service file, unless they have been explicitly filtered using per-package configuration.
|
||||
This is explained in the project documentation.
|
||||
Javapackages tests were moved to https://gitlab.com/redhat/centos-stream/tests/javapackages
|
||||
|
|
|
|||
|
|
@ -25,16 +25,6 @@ public class DuplicateFileValidatorJP extends DefaultDuplicateFileValidator {
|
|||
return providerRpms.stream().map(Common::getPackageName).distinct().count() == 1;
|
||||
}
|
||||
|
||||
// FIXME this only applies to Fedora < 42
|
||||
if (providerRpms.stream().allMatch(rpm -> rpm.getName().startsWith("maven-openjdk"))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// FIXME this only applies to Fedora < 42
|
||||
if (providerRpms.stream().allMatch(rpm -> rpm.getName().startsWith("maven-local-openjdk"))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,16 +2,20 @@ package org.fedoraproject.javapackages.validator.validators.jp;
|
|||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.fedoraproject.javapackages.validator.spi.Decorated;
|
||||
import org.fedoraproject.javapackages.validator.util.Common;
|
||||
import org.fedoraproject.javapackages.validator.util.FilesValidator;
|
||||
|
||||
import io.kojan.javadeptools.rpm.RpmInfo;
|
||||
import io.kojan.javadeptools.rpm.RpmPackage;
|
||||
|
||||
public class FilesValidatorJP extends FilesValidator {
|
||||
@Override
|
||||
|
|
@ -36,6 +40,12 @@ public class FilesValidatorJP extends FilesValidator {
|
|||
static final String USR_LIB_BUILD_ID = "/usr/lib/.build-id";
|
||||
}
|
||||
|
||||
private static Set<String> ignoredComponents = new LinkedHashSet<>();
|
||||
static {
|
||||
ignoredComponents.add("javapackages-bootstrap");
|
||||
ignoredComponents.add("javapackages-tools");
|
||||
}
|
||||
|
||||
private static Map<String, List<String>> nameAliases = new TreeMap<>();
|
||||
static {
|
||||
nameAliases.put("maven-resolver", List.of("aether"));
|
||||
|
|
@ -57,9 +67,11 @@ public class FilesValidatorJP extends FilesValidator {
|
|||
prefixes.put("jansi", List.of(Prefix.USR_LIB_BUILD_ID));
|
||||
prefixes.put("javacc", List.of(Prefix.USR_BIN));
|
||||
prefixes.put("java_cup", List.of(Prefix.USR_BIN));
|
||||
prefixes.put("javapackages-bootstrap", List.of("/usr/lib/java/javapackages-bootstrap", "/usr/lib/javapackages-bootstrap", "/usr/lib/rpm", "/etc/rpm", "/usr/libexec/javapackages-bootstrap"));
|
||||
prefixes.put("jflex", List.of(Prefix.USR_BIN));
|
||||
prefixes.put("jline", List.of(Prefix.USR_LIB_BUILD_ID));
|
||||
prefixes.put("junit5", List.of(Prefix.USR_BIN));
|
||||
prefixes.put("maven", List.of(Prefix.ETC_PKG, Prefix.ETC_JAVA, Prefix.JPBINDING, Prefix.USR_BIN));
|
||||
prefixes.put("maven4", List.of(Prefix.ETC_PKG, Prefix.ETC_JAVA, Prefix.JPBINDING, Prefix.USR_BIN));
|
||||
prefixes.put("modello", List.of(Prefix.USR_BIN));
|
||||
prefixes.put("objectweb-asm", List.of(Prefix.USR_BIN));
|
||||
prefixes.put("xerces-j2", List.of(Prefix.USR_BIN));
|
||||
|
|
@ -72,7 +84,9 @@ public class FilesValidatorJP extends FilesValidator {
|
|||
static {
|
||||
exceptionalFiles.put("aqute-bnd", List.of("/etc/ant.d/aqute-bnd"));
|
||||
exceptionalFiles.put("maven", List.of("/etc/m2.conf"));
|
||||
exceptionalFiles.put("maven4", List.of("/etc/m24.conf"));
|
||||
exceptionalFiles.put("jansi", List.of("/usr/lib/jansi", "/usr/lib/jansi/libjansi.so", "/usr/lib/java/jansi"));
|
||||
exceptionalFiles.put("jline", List.of("/usr/lib/jline", "/usr/lib/jline/libjlinenative.so", "/usr/lib/java/jline"));
|
||||
}
|
||||
|
||||
private static boolean namesRelated(String lhs, String rhs) {
|
||||
|
|
@ -155,7 +169,7 @@ public class FilesValidatorJP extends FilesValidator {
|
|||
}
|
||||
|
||||
if (patternsCache.computeIfAbsent(Common.getPackageName(rpm) + "/javadoc",
|
||||
p -> Pattern.compile("/usr/share/javadoc/" + Common.getPackageName(rpm) + "(:?/.*)?"))
|
||||
_ -> Pattern.compile("/usr/share/javadoc/" + Common.getPackageName(rpm) + "(:?/.*)?"))
|
||||
.matcher(filename).matches()) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -317,6 +331,16 @@ public class FilesValidatorJP extends FilesValidator {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(RpmPackage rpm) throws Exception {
|
||||
if (ignoredComponents.contains(rpm.getInfo().getSourceName())) {
|
||||
skip("{0}: the component {1} is ignored", Decorated.rpm(rpm),
|
||||
Decorated.actual(rpm.getInfo().getSourceName()));
|
||||
} else {
|
||||
super.validate(rpm);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowedFile(RpmInfo rpm, Path path) {
|
||||
if (rpm.isSourcePackage()) {
|
||||
|
|
@ -324,11 +348,6 @@ public class FilesValidatorJP extends FilesValidator {
|
|||
return true;
|
||||
}
|
||||
|
||||
// if (Common.getPackageName(rpm).equals("javapackages-bootstrap")) {
|
||||
// // TODO
|
||||
// return true;
|
||||
// }
|
||||
|
||||
String filename = path.toString();
|
||||
|
||||
if (rpm.getName().equals(Common.getPackageName(rpm) + "-javadoc") || rpm.getName().equals(Common.getPackageName(rpm) + "-javadocs")) {
|
||||
|
|
|
|||
27
src/JavaExclusiveArchValidatorJP.java
Normal file
27
src/JavaExclusiveArchValidatorJP.java
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package org.fedoraproject.javapackages.validator.validators.jp;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.fedoraproject.javapackages.validator.spi.Decorated;
|
||||
import org.fedoraproject.javapackages.validator.validators.JavaExclusiveArchValidator;
|
||||
|
||||
import io.kojan.javadeptools.rpm.RpmPackage;
|
||||
|
||||
public class JavaExclusiveArchValidatorJP extends JavaExclusiveArchValidator {
|
||||
@Override
|
||||
public String getTestName() {
|
||||
return "/java/jp/exclusive_arch";
|
||||
}
|
||||
|
||||
private static final Set<String> SKIPPED = Set.of("javapackages-tools", "byaccj", "jurand");
|
||||
|
||||
@Override
|
||||
public void validate(RpmPackage rpm) throws Exception {
|
||||
String component = rpm.getInfo().getSourceName();
|
||||
if (SKIPPED.contains(component)) {
|
||||
skip("Skipping rpm {0}", Decorated.rpm(rpm));
|
||||
return;
|
||||
}
|
||||
super.validate(rpm);
|
||||
}
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ public class RpmFilesizeValidatorJP extends RpmFilesizeValidator {
|
|||
}
|
||||
|
||||
if (Common.getPackageName(rpm).equals("javapackages-bootstrap")) {
|
||||
return sizeBytes <= 40_000_000;
|
||||
return sizeBytes <= 60_000_000;
|
||||
}
|
||||
|
||||
// javadoc rpms
|
||||
|
|
@ -33,6 +33,6 @@ public class RpmFilesizeValidatorJP extends RpmFilesizeValidator {
|
|||
}
|
||||
}
|
||||
|
||||
return sizeBytes <= 3_500_000;
|
||||
return sizeBytes <= 4_000_000;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class ValidatorFactoryGeneric implements ValidatorFactory {
|
|||
return List.of(new Validator[] {
|
||||
new AttributeProvidesValidator(),
|
||||
new JavadocNoarchValidator(),
|
||||
new JavaExclusiveArchValidator(),
|
||||
new JavaExclusiveArchValidatorJP(),
|
||||
new MavenMetadataValidator(),
|
||||
new NoBootstrapValidator(),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
compiler.release=22
|
||||
repositories=https://s01.oss.sonatype.org/content/repositories/snapshots
|
||||
#repositories=https://s01.oss.sonatype.org/content/repositories/snapshots
|
||||
dependencies=\
|
||||
io.kojan:runit-api:1.0.0-SNAPSHOT \
|
||||
io.kojan:runit-validator:1.0.0-SNAPSHOT \
|
||||
io.kojan:runit-api:1.0.0 \
|
||||
io.kojan:runit-validator:1.0.0 \
|
||||
org.apiguardian:apiguardian-api:1.1.2 \
|
||||
org.hamcrest:hamcrest:2.2 \
|
||||
org.junit.jupiter:junit-jupiter-api:5.10.0 \
|
||||
org.junit.jupiter:junit-jupiter-engine:5.10.0 \
|
||||
org.junit.platform:junit-platform-commons:1.10.0 \
|
||||
org.junit.platform:junit-platform-engine:1.10.0 \
|
||||
org.junit.platform:junit-platform-launcher:1.10.0 \
|
||||
org.hamcrest:hamcrest:3.0 \
|
||||
org.junit.jupiter:junit-jupiter-api:5.11.3 \
|
||||
org.junit.jupiter:junit-jupiter-engine:5.11.3 \
|
||||
org.junit.platform:junit-platform-commons:1.11.3 \
|
||||
org.junit.platform:junit-platform-engine:1.11.3 \
|
||||
org.junit.platform:junit-platform-launcher:1.11.3 \
|
||||
org.opentest4j:opentest4j:1.3.0 \
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
package tests;
|
||||
|
||||
import static io.kojan.runit.api.RUnit.*;
|
||||
import static io.kojan.runit.api.matcher.RUnitMatchers.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
|
||||
import io.kojan.javadeptools.rpm.*;
|
||||
|
|
@ -26,12 +23,10 @@ public class ApacheCommonsCheck {
|
|||
@PackageTest
|
||||
@IncludeBinary("apache-commons-[a-z][a-z0-9]+")
|
||||
@ExcludeBinary("apache-commons-parent") // Parent POM, no Java code
|
||||
@Disabled("JPMS provides are not generated for now")
|
||||
public void jpmsProvides(RpmInfo rpm) {
|
||||
String id = rpm.getName().substring("apache-commons-".length());
|
||||
List<String> prov = rpm.getProvides().stream().map(RpmDependency::getName).collect(Collectors.toList());
|
||||
assertThat("Apache Commons packages should have jpms provides", prov,
|
||||
hasItem("jpms(org.apache.commons." + id + ")"));
|
||||
assertThat("Apache Commons packages should have jpms provides", rpm,
|
||||
provides("jpms\\(org.apache.commons." + id + "\\)( = .*)?"));
|
||||
}
|
||||
|
||||
@PackageTest
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package tests;
|
||||
|
||||
import static io.kojan.runit.api.RUnit.*;
|
||||
import static io.kojan.runit.api.matcher.RUnitMatchers.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
|
|
@ -34,8 +35,7 @@ public class BasicCheck {
|
|||
@ExcludeBinary("sisu")
|
||||
@ExcludeBinary("javapackages-bootstrap")
|
||||
public void bundledProvides(RpmInfo rpm) {
|
||||
assertThat("No bundled(*) provides", () -> rpm.getProvides().stream().map(RpmDependency::getName).iterator(),
|
||||
everyItem(not(startsWith("bundled("))));
|
||||
assertThat("No bundled(*) provides", rpm, not(provides("bundled\\(.*\\)")));
|
||||
}
|
||||
|
||||
@PackageTest
|
||||
|
|
@ -48,4 +48,10 @@ public class BasicCheck {
|
|||
assertThat("Binary package Release matches SRPM Release", rpm.getRelease(), is(matcher.group(3)));
|
||||
}
|
||||
|
||||
@PackageTest
|
||||
@IncludeBinary
|
||||
public void noConflicts(RpmInfo rpm) {
|
||||
assertThat("Packages have no explicit Conflicts", rpm, not(conflicts(".*")));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
37
src/runit/JPackageScriptCheck.java
Normal file
37
src/runit/JPackageScriptCheck.java
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package tests;
|
||||
|
||||
import static io.kojan.runit.api.RUnit.*;
|
||||
import static io.kojan.runit.api.matcher.RUnitMatchers.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
|
||||
import io.kojan.javadeptools.rpm.RpmInfo;
|
||||
import io.kojan.runit.api.ExcludeFileName;
|
||||
import io.kojan.runit.api.ExcludeSource;
|
||||
import io.kojan.runit.api.ExcludeSymlink;
|
||||
import io.kojan.runit.api.FileTest;
|
||||
import io.kojan.runit.api.IncludeFileName;
|
||||
|
||||
@DisplayName("/jpackage_script")
|
||||
public class JPackageScriptCheck {
|
||||
@FileTest
|
||||
@IncludeFileName("/usr/bin/.*")
|
||||
@ExcludeSource
|
||||
@ExcludeSymlink
|
||||
@ExcludeFileName("/usr/bin/ant")
|
||||
public void testJPackageScript(RpmInfo rpm, byte[] bytes) {
|
||||
assumeThat("The binary is a script with a shebang", bytes.length, greaterThan(1));
|
||||
assumeThat("The binary is a script with a shebang", bytes[0], is((byte)'#'));
|
||||
assumeThat("The binary is a script with a shebang", bytes[1], is((byte)'!'));
|
||||
String content = new String(bytes, StandardCharsets.UTF_8);
|
||||
assumeThat("The script was generated with %jpackage_script", content,
|
||||
containsString(". /usr/share/java-utils/java-functions\n"));
|
||||
assertThat("The script explicitly sets JAVA_HOME to Java 21", content,
|
||||
containsString("\nJAVA_HOME=\"${JAVA_HOME:-/usr/lib/jvm/jre-21-openjdk}\"\n"));
|
||||
assertThat("Requires on java-21-openjdk-headless are present", rpm, requires("java-21-openjdk-headless"));
|
||||
assertThat("Requires on javapackages-tools are present", rpm, requires("javapackages-tools"));
|
||||
}
|
||||
}
|
||||
|
|
@ -56,6 +56,7 @@ public class LicenseCheck {
|
|||
private static final Set<String> PUBLIC_DOMAIN_PACKAGES = Set.of( //
|
||||
"aopalliance", //
|
||||
"plexus-utils", //
|
||||
"plexus-utils4", //
|
||||
"xz-java", //
|
||||
"javapackages-bootstrap" // special case, as it it bundles all the above
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue