Compare commits
No commits in common. "main" and "f41" have entirely different histories.
11 changed files with 60 additions and 117 deletions
24
README.md
24
README.md
|
|
@ -1,5 +1,23 @@
|
|||
# Deprecated
|
||||
# javapackages-validator-tests
|
||||
|
||||
This repository is deprecated.
|
||||
This repository contains the `.fmf` test files referenced by packages that are tested by _javapackages-validator_ tool.
|
||||
|
||||
Javapackages tests were moved to https://gitlab.com/redhat/centos-stream/tests/javapackages
|
||||
## 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.
|
||||
|
|
|
|||
|
|
@ -25,6 +25,16 @@ 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,20 +2,16 @@ 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
|
||||
|
|
@ -40,12 +36,6 @@ 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"));
|
||||
|
|
@ -67,11 +57,9 @@ 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));
|
||||
|
|
@ -84,9 +72,7 @@ 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) {
|
||||
|
|
@ -169,7 +155,7 @@ public class FilesValidatorJP extends FilesValidator {
|
|||
}
|
||||
|
||||
if (patternsCache.computeIfAbsent(Common.getPackageName(rpm) + "/javadoc",
|
||||
_ -> Pattern.compile("/usr/share/javadoc/" + Common.getPackageName(rpm) + "(:?/.*)?"))
|
||||
p -> Pattern.compile("/usr/share/javadoc/" + Common.getPackageName(rpm) + "(:?/.*)?"))
|
||||
.matcher(filename).matches()) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -331,16 +317,6 @@ 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()) {
|
||||
|
|
@ -348,6 +324,11 @@ 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")) {
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
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 <= 60_000_000;
|
||||
return sizeBytes <= 40_000_000;
|
||||
}
|
||||
|
||||
// javadoc rpms
|
||||
|
|
@ -33,6 +33,6 @@ public class RpmFilesizeValidatorJP extends RpmFilesizeValidator {
|
|||
}
|
||||
}
|
||||
|
||||
return sizeBytes <= 4_000_000;
|
||||
return sizeBytes <= 3_500_000;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class ValidatorFactoryGeneric implements ValidatorFactory {
|
|||
return List.of(new Validator[] {
|
||||
new AttributeProvidesValidator(),
|
||||
new JavadocNoarchValidator(),
|
||||
new JavaExclusiveArchValidatorJP(),
|
||||
new JavaExclusiveArchValidator(),
|
||||
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 \
|
||||
io.kojan:runit-validator:1.0.0 \
|
||||
io.kojan:runit-api:1.0.0-SNAPSHOT \
|
||||
io.kojan:runit-validator:1.0.0-SNAPSHOT \
|
||||
org.apiguardian:apiguardian-api:1.1.2 \
|
||||
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.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.opentest4j:opentest4j:1.3.0 \
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
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.*;
|
||||
|
|
@ -23,10 +26,12 @@ 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());
|
||||
assertThat("Apache Commons packages should have jpms provides", rpm,
|
||||
provides("jpms\\(org.apache.commons." + id + "\\)( = .*)?"));
|
||||
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 + ")"));
|
||||
}
|
||||
|
||||
@PackageTest
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
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;
|
||||
|
|
@ -35,7 +34,8 @@ public class BasicCheck {
|
|||
@ExcludeBinary("sisu")
|
||||
@ExcludeBinary("javapackages-bootstrap")
|
||||
public void bundledProvides(RpmInfo rpm) {
|
||||
assertThat("No bundled(*) provides", rpm, not(provides("bundled\\(.*\\)")));
|
||||
assertThat("No bundled(*) provides", () -> rpm.getProvides().stream().map(RpmDependency::getName).iterator(),
|
||||
everyItem(not(startsWith("bundled("))));
|
||||
}
|
||||
|
||||
@PackageTest
|
||||
|
|
@ -48,10 +48,4 @@ 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(".*")));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
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,7 +56,6 @@ 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