Compare commits

..

8 commits

Author SHA1 Message Date
Mikolaj Izdebski
261e44c3fa Add deprecation notice to README.md 2025-03-24 08:47:41 +01:00
Mikolaj Izdebski
0999df51b8 Fix a typo in maven4 package name 2025-02-26 23:24:09 +01:00
Mikolaj Izdebski
26792c770b Increase generic package size limit 2025-02-26 23:09:58 +01:00
Mikolaj Izdebski
13f9485252 Configure files for maven4 2025-02-26 23:06:06 +01:00
Mikolaj Izdebski
d5d139af27 Increase allowed size for javapackages-bootstrap 2025-02-26 20:43:17 +01:00
Mikolaj Izdebski
5db07614a8 Add files whiletists for jline 2025-02-26 20:41:03 +01:00
Marian Koncek
4758ee4fda Allow junit5 to install executables 2025-02-25 10:48:31 +01:00
Mikolaj Izdebski
25bf954aac Allow public domain for plexus-utils4 2025-02-16 18:06:31 +01:00
7 changed files with 49 additions and 27 deletions

View file

@ -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

View file

@ -68,7 +68,10 @@ public class FilesValidatorJP extends FilesValidator {
prefixes.put("javacc", List.of(Prefix.USR_BIN));
prefixes.put("java_cup", List.of(Prefix.USR_BIN));
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));
@ -81,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) {

View file

@ -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;
}
}

View file

@ -15,8 +15,6 @@ public class ValidatorFactoryGeneric implements ValidatorFactory {
new JavaExclusiveArchValidatorJP(),
new MavenMetadataValidator(),
new NoBootstrapValidator(),
new JpmsProvidesValidatorJP(),
new NVRJarMetadataValidator(),
});
}
}

View 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"));
}
}

View file

@ -23,7 +23,6 @@ public class JavadocCheck {
@IncludeBinary(".*-javadoc")
public void javadocFiles(RpmInfo rpm, Path path) {
assertThat("Javadoc package contains only javadoc content", path.toString(),
anyOf(startsWith("/usr/share/doc/"), // provisional for c10s
startsWith("/usr/share/javadoc/"), startsWith("/usr/share/licenses/")));
anyOf(startsWith("/usr/share/javadoc/"), startsWith("/usr/share/licenses/")));
}
}

View file

@ -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
);