[Git][java-team/javatools][master] 9 commits: Bug#1040512: javatools: Please support Java 21
Tony Mancill (@tmancill)
gitlab at salsa.debian.org
Sat Jul 29 06:23:47 BST 2023
Tony Mancill pushed to branch master at Debian Java Maintainers / javatools
Commits:
76d64516 by Vladimir Petko at 2023-07-26T22:00:43-07:00
Bug#1040512: javatools: Please support Java 21
Package: javatools
Severity: wishlist
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu mantic ubuntu-patch
X-Debbugs-Cc: vladimir.petko at canonical.com
Dear Maintainer,
Java 21 retires release level 7 and requires release level 8. This patch allows
to set release level to 8 if Java is 21 or later.
Changes:
* jh_build: check Java version to set the minimum release level.
* d/control: javahelper now depends on jarwrapper to check Java version.
* d/rules: use release level 8.
- - - - -
26384228 by tony mancill at 2023-07-28T20:30:26-07:00
Update string literals in jh_build for Test::Perl::Critic
- - - - -
989d3c00 by tony mancill at 2023-07-28T20:30:26-07:00
Rename variable in jh_manifest due to Perl::Critic warning about magic var
- - - - -
b33cfbd8 by tony mancill at 2023-07-28T20:30:26-07:00
Adjust formatting of CheckIntProperty
- - - - -
44a0c6b4 by tony mancill at 2023-07-28T21:38:00-07:00
Remove Fedora-License from debian/copyright
This license clause was for the file "fetch-eclipse-source", which was
removed from the package in 2018.
- - - - -
d8e61ae9 by tony mancill at 2023-07-28T21:38:00-07:00
Rework debian/copyright into machine-readable format
The copyright holder and their dates of copyright were generated by
parsing the git history for the repo.
- - - - -
fded212d by tony mancill at 2023-07-28T21:56:31-07:00
Drop dependency on obsolete bsdmainutils
- - - - -
eb9a0505 by tony mancill at 2023-07-28T22:16:40-07:00
Bump Standards-Version to 4.6.2 (no changes)
- - - - -
0fa10692 by tony mancill at 2023-07-28T22:16:40-07:00
Prepare changelog for upload
- - - - -
7 changed files:
- debian/changelog
- debian/control
- debian/copyright
- debian/rules
- jh_build
- jh_manifest
- + src/main/java/org/debian/javatools/CheckIntProperty.java
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,19 @@
+javatools (0.79) unstable; urgency=medium
+
+ [ Vladimir Petko ]
+ * Support Java 21 (Closes: #1040512)
+
+ [ tony mancill ]
+ * Update string literals in jh_build for Test::Perl::Critic
+ * Rename variable in jh_manifest due to Perl::Critic warning about magic var
+ * Adjust formatting of CheckIntProperty
+ * Remove Fedora-License from debian/copyright (no longer applicable)
+ * Rework debian/copyright into machine-readable format
+ * Drop dependency on obsolete bsdmainutils
+ * Bump Standards-Version to 4.6.2 (no changes)
+
+ -- tony mancill <tmancill at debian.org> Fri, 28 Jul 2023 22:15:46 -0700
+
javatools (0.78) unstable; urgency=medium
[ tony mancill ]
=====================================
debian/control
=====================================
@@ -14,7 +14,7 @@ Build-Depends:
markdown,
perl
Rules-Requires-Root: no
-Standards-Version: 4.5.1
+Standards-Version: 4.6.2
Vcs-Git: https://salsa.debian.org/java-team/javatools.git
Vcs-Browser: https://salsa.debian.org/java-team/javatools
@@ -36,7 +36,8 @@ Description: Run executable Java .jar files
Package: javahelper
Architecture: all
Depends:
- bsdextrautils | bsdmainutils,
+ jarwrapper,
+ bsdextrautils,
dctrl-tools,
debhelper-compat (= 13),
devscripts,
=====================================
debian/copyright
=====================================
@@ -1,171 +1,53 @@
-This package was created by Matthew Johnson <debian at matthew.ath.cx> on
-Sat, 09 May 2007 17:24:36 +0100.
-
-Copyright: 2007, Matthew Johnson <debian at matthew.ath.cx>
- 2010, Niels Thykier <niels at thykier.net>
-
-License:
-
- This package is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 as published by
- the Free Software Foundation
-
- This package is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along
- with this package; if not, write to the Free Software Foundation, Inc., 51
- Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-License:
-
-License: Fedora-License
- The file was downloaded from Fedora's CVS repository; all committers
- are required to sign a license agreement with Fedora, which puts
- contributions without a license under the license included below.
- .
- At the time Debian acquired these files, the "default" Fedora license
- was:
- .
- The Fedora Project Individual Contributor License Agreement
- .
- The Fedora Project
- .
- Individual Contributor License Agreement (CLA)
- .
- http://fedoraproject.org/wiki/Legal/Licenses/CLA
- .
- Thank you for your interest in The Fedora Project (the "Project"). In
- order to clarify the intellectual property license granted with
- Contributions from any person or entity, Red Hat, Inc. ("Red Hat"),
- as maintainer of the Project, must have a Contributor License
- Agreement (CLA) on file that has been signed by each Contributor,
- indicating agreement to the license terms below. This license is for
- Your protection as a Contributor as well as the protection of the
- Project and its users; it does not change your rights to use your own
- Contributions for any other purpose.
- .
- You and the Project hereby accept and agree to the following terms
- and conditions:
- .
- * 1. Contributors and Contributions.
- .
- * A. The Project and any individual or legal entity that
- voluntarily submits to the Project a Contribution are
- collectively addressed herein as "Contributors". For legal
- entities, the entity making a Contribution and all other entities
- that control, are controlled by, or are under common control with
- that entity are considered to be a single Contributor. For the
- purposes of this definition, "control" means (i) the power,
- direct or indirect, to cause the direction or management of such
- entity, whether by contract or otherwise, or (ii) ownership of
- fifty percent (50%) or more of the outstanding shares, or (iii)
- beneficial ownership of such entity.
- .
- * B. A "Contribution" is any original work, including any
- modification or addition to an existing work, that has been
- submitted for inclusion in, or documentation of, any of the
- products owned or managed by the Project, where such work
- originates from that particular Contributor or from some entity
- acting on behalf of that Contributor.
- .
- * C. A Contribution is "submitted" when any form of electronic,
- verbal, or written communication is sent to the Project,
- including but not limited to communication on electronic mailing
- lists, source code control systems, and issue tracking systems
- that are managed by, or on behalf of, the Project for the purpose
- of discussing or improving software or documentation of the
- Project, but excluding communication that is conspicuously marked
- or otherwise designated in writing by you as "Not a
- Contribution."
- .
- * D. Any Contribution submitted by you to the Project shall be
- under the terms and conditions of this License, without any
- additional terms or conditions, unless you explicitly state
- otherwise in the submission.
- .
- * 2. Contributor Grant of License. You hereby grant to Red Hat, Inc.,
- on behalf of the Project, and to recipients of software distributed
- by the Project:
- .
- * (a) a perpetual, non-exclusive, worldwide, fully paid-up, royalty
- free, irrevocable copyright license to reproduce, prepare
- derivative works of, publicly display, publicly perform,
- sublicense, and distribute your Contribution and such derivative
- works; and,
- .
- * (b) a perpetual, non-exclusive, worldwide, fully paid-up, royalty
- free, irrevocable (subject to Section 3) patent license to make,
- have made, use, offer to sell, sell, import, and otherwise
- transfer your Contribution and derivative works thereof, where
- such license applies only to those patent claims licensable by
- you that are necessarily infringed by your Contribution alone or
- by combination of your Contribution with the work to which you
- submitted the Contribution. Except for the license granted in
- this section, you reserve all right, title and interest in and to
- your Contributions.
- .
- * 3. Reciprocity. As of the date any such litigation is filed, your
- patent grant shall immediately terminate with respect to any party
- that institutes patent litigation against you (including a
- cross-claim or counterclaim in a lawsuit) alleging that your
- Contribution, or the work to which you have contributed,
- constitutes direct or contributory patent infringement.
- .
- * 4. You represent that you are legally entitled to grant the above
- license. If your employer(s) has rights to intellectual property
- that you create that includes your Contributions, you represent
- that you have received permission to make Contributions on behalf
- of that employer, that your employer has waived such rights for
- your Contributions to the Project, or that your employer has
- executed a separate Corporate CLA with the Project.
- .
- * 5. You represent that each of your Contributions is your original
- creation (see section 7 for submissions on behalf of others). You
- represent that your Contribution submission(s) include complete
- details of any third-party license or other restriction (including,
- but not limited to, related copyright, patents and trademarks) of
- which you are personally aware and which are associated with any
- part of your Contribution.
- .
- * 6. You are not expected to provide support for your Contributions,
- except to the extent you desire to provide support. You may provide
- support for free, for a fee, or not at all. Your Contributions are
- provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
- ANY KIND, either express or implied, including, without limitation,
- any warranties or conditions of NON-INFRINGEMENT, MERCHANTABILITY,
- or FITNESS FOR A PARTICULAR PURPOSE.
- .
- * 7. Should you wish to submit work that is not your original
- creation, you may submit it to the Project separately from any
- Contribution, identifying the complete details of its source and of
- any license or other restriction (including, but not limited to,
- related patents, trademarks, and license agreements) of which you
- are personally aware, and conspicuously marking the work as
- "Submitted on behalf of a third-party: [named here] ".
- .
- * 8. You agree to notify the Project of any facts or circumstances of
- which you become aware that would make these representations
- inaccurate in any respect.
- .
- * 9. The Project is under no obligations to accept and include every
- contribution..
-
-License: GPL-2
- This package is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 as published by
- the Free Software Foundation
- .
- This package is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
- .
- You should have received a copy of the GNU General Public License along
- with this package; if not, write to the Free Software Foundation, Inc., 51
- Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- .
- On Debian systems, the complete text of the GNU General Public License can be
- found in `/usr/share/common-licenses/GPL-2'.
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+
+Files: *
+Copyright: 2007-2012 Matthew Johnson <mjj29 at debian.org>
+ 2010 Benjamin Drung <bdrung at ubuntu.com>
+ 2010-2019, Niels Thykier <niels at thykier.net>
+ 2011 Martin Quinson <mquinson at debian.org>
+ 2012 Jakub Adam <jakub.adam at ktknet.cz>
+ 2012 Kai Ruschenburg <kairu at web.de>
+ 2012 Sylvestre Ledru <sylvestre.ledru at scilab-enterprises.com>
+ 2013 Colin Watson <cjwatson at ubuntu.com>
+ 2013 Francesco Poli <invernomuto at paranoici.org>
+ 2013-2023 Markus Koschany <apo at debian.org>
+ 2014 Dmitry Smirnov <onlyjob at member.fsf.org>
+ 2014-2023 Emmanuel Bourg <ebourg at apache.org>
+ 2014-2023 tony mancill <tmancill at debian.org>
+ 2018 Chris Lamb <lamby at debian.org>
+ 2018 Tiago Stürmer Daitx <tiago.daitx at ubuntu.com>
+ 2019 Andrej Shadura <andrew.shadura at collabora.co.uk>
+ 2019 Apollon Oikonomopoulos <apoikos at debian.org>
+ 2020-2023 Jochen Sprickerhof <jspricke at debian.org>
+ 2023 Vladimir Petko <vladimir.petko at canonical.com>
+License: GPL-2+
+
+Files: src/main/java/org/debian/javatools/CheckProperty.java
+Copyright: 2018-2023, Emmanuel Bourg
+License: Apache-2.0
+
+Files: src/main/java/org/debian/javatools/CheckIntProperty.java
+Copyright: 2023, Canonical Ltd
+License: Apache-2.0
+
+License: Apache-2.0
+ On Debian systems, the complete text of the Apache version 2.0 license
+ can be found in "/usr/share/common-licenses/Apache-2.0".
+
+License: GPL-2+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ .
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this package; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License can be found in `/usr/share/common-licenses/GPL-2'.
=====================================
debian/rules
=====================================
@@ -14,7 +14,7 @@ jh_lib.sh: jh_lib.sh.in
override_dh_auto_build: jh_lib.sh
mkdir -p target/classes
- javac -d target/classes -source 7 -target 7 src/main/java/org/debian/javatools/CheckProperty.java
+ javac -d target/classes -source 8 -target 8 src/main/java/org/debian/javatools/*.java
jar -cvf target/javatools.jar -C target/classes/ .
mkdir tmp tmp.jarwrapper
=====================================
jh_build
=====================================
@@ -10,9 +10,7 @@ use strict;
use warnings;
use Cwd qw(realpath);
use List::Util qw(any);
-
-# Value to pass to -source/-target by default
-use constant DEFAULT_JAVA_RELEASE => '1.7';
+use File::Temp qw(tempfile);
use Debian::Debhelper::Dh_Lib;
use Debian::Javahelper::Java qw(write_manifest_fd);
@@ -115,7 +113,7 @@ my $CLASSPATH = $CLASSPATH_ORIG;
my @JH_JAR_EXTRA;
my $build_javadoc = 1;
my (@javac_opts, @javadoc_opts, $main_class, $do_clean);
-my (@JAVAC, @JAVADOC, @JAR, @builds);
+my (@JAVAC, @JAVA, @JAVADOC, @JAR, @builds);
$CLASSPATH =~ tr/:/ /;
@JH_JAR_EXTRA = split(' ', $ENV{'JH_JAR_EXTRA'}) if defined $ENV{'JH_JAR_EXTRA'};
@@ -150,6 +148,17 @@ if ($do_clean) {
exit(0);
}
+# Value to pass to -source/-target by default
+sub get_min_release {
+ if (doit_noerror(@JAVA, '-cp', '/usr/share/java/javatools.jar', 'org.debian.javatools.CheckIntProperty', 'java.specification.version', 'gte', '21')) {
+ warning('Java machine does not support --release 7, using --release 8');
+ return '8';
+ }
+ # when the specification version is less than 21 or an error occured
+ # default to 7
+ return '7';
+}
+
sub _has_java_option {
my ($opt_ref, $option_name) = @_;
for my $arg (@{$opt_ref}) {
@@ -171,27 +180,6 @@ sub _default_java_option {
return;
}
-# Use ISO8859-1 as the default encoding to avoid unmappable character errors
-_default_java_option(\@javac_opts, '-encoding', 'ISO8859-1');
-_default_java_option(\@javadoc_opts, '-encoding', 'ISO8859-1');
-
-if (not _has_java_option(\@javac_opts, '--release') and not _has_java_option(\@javac_opts, '-source')) {
- # If neither --release nor -source is set, then set -source (and -target if also absent)
- if (not _has_java_option(\@javac_opts, '-target')) {
- push(@javac_opts, '-source', DEFAULT_JAVA_RELEASE, '-target', DEFAULT_JAVA_RELEASE);
- } else {
- push(@javac_opts, '-source', DEFAULT_JAVA_RELEASE);
- }
-}
-
-if (not _has_java_option(\@javadoc_opts, '--release')) {
- _default_java_option(\@javadoc_opts, '-source', DEFAULT_JAVA_RELEASE);
-}
-
-_default_java_option(\@javadoc_opts, '-notimestamp');
-_default_java_option(\@javadoc_opts, '-Xdoclint:none');
-
-
sub do_build {
my ($jarfile, @sources) = @_;
my (@srcdirs, @srcfiles);
@@ -275,8 +263,33 @@ if (@builds) {
error('Cannot find any JAVA_HOME: aborting');
}
@JAVAC = ("${JAVA_HOME}/bin/javac");
+ @JAVA = ("${JAVA_HOME}/bin/java");
+
@JAVADOC = ("${JAVA_HOME}/bin/javadoc", '-locale', 'en_US');
@JAR = ("${JAVA_HOME}/bin/jar");
+
+ my $default_java_release = get_min_release();
+
+ # Use ISO8859-1 as the default encoding to avoid unmappable character errors
+ _default_java_option(\@javac_opts, '-encoding', 'ISO8859-1');
+ _default_java_option(\@javadoc_opts, '-encoding', 'ISO8859-1');
+
+ if (not _has_java_option(\@javac_opts, '--release') and not _has_java_option(\@javac_opts, '-source')) {
+ # If neither --release nor -source is set, then set -source (and -target if also absent)
+ if (not _has_java_option(\@javac_opts, '-target')) {
+ push(@javac_opts, '-source', $default_java_release, '-target', $default_java_release);
+ } else {
+ push(@javac_opts, '-source', $default_java_release);
+ }
+ }
+
+ if (not _has_java_option(\@javadoc_opts, '--release')) {
+ _default_java_option(\@javadoc_opts, '-source', $default_java_release);
+ }
+
+ _default_java_option(\@javadoc_opts, '-notimestamp');
+ _default_java_option(\@javadoc_opts, '-Xdoclint:none');
+
for my $build (@builds) {
do_build(@{$build});
}
=====================================
jh_manifest
=====================================
@@ -289,7 +289,7 @@ sub update_jar{
my $manifest;
my $stat;
my $dirty = 0;
- my $main;
+ my $main_section;
my $new_manifest = 0;
# stringify or $zip will make a call back that fails.
$zip->read( "$jar" ) == AZ_OK or error("Could not read $jar: $!");
@@ -309,21 +309,21 @@ sub update_jar{
$manifest->merge($merge);
$dirty = 1;
}
- $main = $manifest->get_section(MAIN_SECTION, 1);
- if($cp && (!$envcp || ($main->get_value('Class-Path')//q{}) eq q{})){
- $main->set_value('Class-Path', $cp);
+ $main_section = $manifest->get_section(MAIN_SECTION, 1);
+ if($cp && (!$envcp || ($main_section->get_value('Class-Path')//q{}) eq q{})){
+ $main_section->set_value('Class-Path', $cp);
$dirty = 1;
}
if($mcl){
- $main->set_value('Main-Class', $mcl);
+ $main_section->set_value('Main-Class', $mcl);
$dirty = 1;
}
if($jvm){
- $main->set_value('Debian-Java-Home', $jvm);
+ $main_section->set_value('Debian-Java-Home', $jvm);
$dirty = 1;
}
if($jopt){
- $main->set_value('Debian-Java-Parameters', $jopt);
+ $main_section->set_value('Debian-Java-Parameters', $jopt);
$dirty = 1;
}
if($dirty){
=====================================
src/main/java/org/debian/javatools/CheckIntProperty.java
=====================================
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2023 Canonical Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.debian.javatools;
+
+/**
+ * Check the value of a system property from the command line.
+ *
+ * Syntax:
+ *
+ * java org.debian.javatools.CheckIntProperty <propertyName> <condition> <expectedValue>
+ *
+ * <condition>:
+ * - gte - greater or equal
+ * - lte - less than or equal
+ * - gt - greater than
+ * - lt - less than
+ *
+ * The program exits with the status code 0 if the condition is true, and 1 otherwise.
+ */
+public class CheckIntProperty {
+
+ private static boolean check(String operation, int actualValue, int expectedValue){
+ switch (operation) {
+ case "gt": return actualValue > expectedValue;
+ case "gte": return actualValue >= expectedValue;
+ case "lte": return actualValue <= expectedValue;
+ case "lt": return actualValue < expectedValue;
+ default: return false;
+ }
+ }
+
+ private static boolean isVerbose() {
+ try {
+ return Integer.parseInt(System.getenv("DH_VERBOSE")) != 0;
+ }
+ catch (NumberFormatException ex) {
+ // ignored
+ }
+ return false;
+ }
+
+ public static void main(String[] args) {
+ boolean verbose = isVerbose();
+ String propertyName = args[0];
+ String operation = args[1];
+ try {
+ int expectedValue = Integer.parseInt(args[2]);
+ int actualValue = Integer.parseInt(System.getProperty(propertyName));
+ if (check(operation, actualValue, expectedValue)) {
+ if (isVerbose())
+ System.out.println("OK: " + propertyName + " " + actualValue + " " + operation + " " + expectedValue);
+ System.exit(0);
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ if (isVerbose()) {
+ System.out.println("FAILED: " + propertyName + " " + System.getProperty(propertyName) + " " + operation + " " + args[2]);
+ }
+ System.exit(1);
+ }
+}
View it on GitLab: https://salsa.debian.org/java-team/javatools/-/compare/8ca2da3d4a46e4aa3d986e8f6afbce53cc7dc9ef...0fa10692242ef11181396952260cb0a7b733a1f6
--
View it on GitLab: https://salsa.debian.org/java-team/javatools/-/compare/8ca2da3d4a46e4aa3d986e8f6afbce53cc7dc9ef...0fa10692242ef11181396952260cb0a7b733a1f6
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20230729/7c08ca64/attachment.htm>
More information about the pkg-java-commits
mailing list