From 828311a24fc0cc58c29dc121a328da5cfc1bb918 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Fri, 10 Apr 2020 18:49:30 +0000
Subject: [PATCH] Debian: Fix patch offsets Add ant target to validate patches

---
 build.xml                                     | 14 ++++++++++++++
 debian/patches/0001-path-substitution.patch   |  4 ++--
 debian/patches/0002-jetty-compatibility.patch | 10 +++++-----
 3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/build.xml b/build.xml
index 1b470e9565..31f9bb3e16 100644
--- a/build.xml
+++ b/build.xml
@@ -2538,6 +2538,20 @@
         <property name="Extended.Version" value="${full.version}" />
     </target>
 
+    <target name="debcheckpatch">
+        <exec executable="patch" failonerror="true" input="debian/patches/0001-path-substitution.patch" >
+            <arg value="--dry-run" />
+            <arg value="-F0" />
+            <arg value="-p1" />
+        </exec>
+        <exec executable="patch" failonerror="true" input="debian/patches/0002-jetty-compatibility.patch" >
+            <arg value="--dry-run" />
+            <arg value="-F0" />
+            <arg value="-p1" />
+        </exec>
+    </target>
+
+
     <target name="debchange" depends="getExtendedVersion" unless="noAutoDebchange">
         <echo message= "Debian version is ${Extended.Version}-1" />
         <exec executable="dch" failonerror="true">
diff --git a/debian/patches/0001-path-substitution.patch b/debian/patches/0001-path-substitution.patch
index 03566e313a..a34078c677 100644
--- a/debian/patches/0001-path-substitution.patch
+++ b/debian/patches/0001-path-substitution.patch
@@ -509,7 +509,7 @@ Index: b/installer/resources/locale/po/messages_fr.po
 ===================================================================
 --- a/installer/resources/locale/po/messages_fr.po
 +++ b/installer/resources/locale/po/messages_fr.po
-@@ -188,13 +188,13 @@ msgid "Request a Java thread dump if run
+@@ -189,13 +189,13 @@ msgid "Request a Java thread dump if run
  msgstr "Demander un vidage des fils d’exécution de Java si elle est en cours d’exécution."
  
  #: ../i2prouter:1874
@@ -553,7 +553,7 @@ Index: b/installer/resources/locale/po/messages_sv.po
 ===================================================================
 --- a/installer/resources/locale/po/messages_sv.po
 +++ b/installer/resources/locale/po/messages_sv.po
-@@ -187,13 +187,13 @@ msgid "Request a Java thread dump if run
+@@ -189,13 +189,13 @@ msgid "Request a Java thread dump if run
  msgstr "Fråga efter en Java thread dump vid drift."
  
  #: ../i2prouter:1874
diff --git a/debian/patches/0002-jetty-compatibility.patch b/debian/patches/0002-jetty-compatibility.patch
index 77c62c4148..59f8542d11 100644
--- a/debian/patches/0002-jetty-compatibility.patch
+++ b/debian/patches/0002-jetty-compatibility.patch
@@ -63,7 +63,7 @@
  import org.eclipse.jetty.security.authentication.DigestAuthenticator;
  import org.eclipse.jetty.server.AbstractConnector;
  import org.eclipse.jetty.server.ConnectionFactory;
-@@ -959,6 +961,8 @@
+@@ -968,6 +970,8 @@
              } else {
                  HashLoginService realm = new CustomHashLoginService(JETTY_REALM, context.getContextPath(),
                                                                      ctx.logManager().getLog(RouterConsoleRunner.class));
@@ -72,7 +72,7 @@
                  sec.setLoginService(realm);
                  sec.setAuthenticator(authenticator);
                  String[] role = new String[] {JETTY_ROLE};
-@@ -966,7 +970,7 @@
+@@ -975,7 +979,7 @@
                      String user = e.getKey();
                      String pw = e.getValue();
                      Credential cred = Credential.getCredential(MD5_CREDENTIAL_TYPE + pw);
@@ -81,7 +81,7 @@
                      Constraint constraint = new Constraint(user, JETTY_ROLE);
                      constraint.setAuthenticate(true);
                      ConstraintMapping cm = new ConstraintMapping();
-@@ -986,7 +990,7 @@
+@@ -995,7 +999,7 @@
                          try {
                              // each char truncated to 8 bytes
                              String user2 = new String(b2, "ISO-8859-1");
@@ -90,7 +90,7 @@
                              constraint = new Constraint(user2, JETTY_ROLE);
                              constraint.setAuthenticate(true);
                              cm = new ConstraintMapping();
-@@ -997,7 +1001,7 @@
+@@ -1006,7 +1010,7 @@
                              // each UTF-8 byte as a char
                              // this is what chrome does
                              String user3 = new String(b1, "ISO-8859-1");
@@ -99,7 +99,7 @@
                              constraint = new Constraint(user3, JETTY_ROLE);
                              constraint.setAuthenticate(true);
                              cm = new ConstraintMapping();
-@@ -1072,8 +1076,8 @@
+@@ -1081,8 +1085,8 @@
          }
  
          @Override
-- 
GitLab