Package: android-platform-build
Followup-For: Bug #1042042
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu noble ubuntu-patch
Control: tags -1 patch

Dear Maintainer,

The attached patch resolves the above ftbfs by adding patches for BouncyCastle
and libziparchive-dev API changes.

In Ubuntu, the attached patch was applied to achieve the following:

  * Resolve ftbfs due to the API changes (LP: #2056084):
    - d/p/bouncycastle177-compat.patch: replace DerOutputStream with
      ASN1OutputStream.
    - d/p/zip-archive-reader-signature: update ReadAtOffset method
      signature.


Thanks for considering the patch.


-- System Information:
Debian Release: trixie/sid
  APT prefers mantic-updates
  APT policy: (500, 'mantic-updates'), (500, 'mantic-security'), (500, 
'mantic'), (100, 'mantic-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.5.0-21-generic (SMP w/32 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru 
android-platform-build-10.0.0+r36/debian/patches/bouncycastle177-compat.patch 
android-platform-build-10.0.0+r36/debian/patches/bouncycastle177-compat.patch
--- 
android-platform-build-10.0.0+r36/debian/patches/bouncycastle177-compat.patch   
    1970-01-01 12:00:00.000000000 +1200
+++ 
android-platform-build-10.0.0+r36/debian/patches/bouncycastle177-compat.patch   
    2024-03-06 14:35:07.000000000 +1300
@@ -0,0 +1,30 @@
+Description: remove usage of DerOutputStream
+ BouncyCastle removed DerOutputStream and replaced it
+ with ASN1OutputStream.
+Author: Vladimir Petko <vladimir.pe...@canonical.com>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1042042
+Bug-Ubuntu: 
https://bugs.launchpad.net/ubuntu/+source/android-platform-build/+bug/2056084
+Forwarded: not-needed
+Last-Update: 2024-03-06
+
+--- a/tools/signapk/src/com/android/signapk/SignApk.java
++++ b/tools/signapk/src/com/android/signapk/SignApk.java
+@@ -18,7 +18,8 @@
+
+ import org.bouncycastle.asn1.ASN1InputStream;
+ import org.bouncycastle.asn1.ASN1ObjectIdentifier;
+-import org.bouncycastle.asn1.DEROutputStream;
++import org.bouncycastle.asn1.ASN1OutputStream;
++import org.bouncycastle.asn1.ASN1Encoding;
+ import org.bouncycastle.asn1.cms.CMSObjectIdentifiers;
+ import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
+ import org.bouncycastle.cert.jcajce.JcaCertStore;
+@@ -334,7 +335,7 @@
+         CMSSignedData sigData = gen.generate(data, false);
+
+         try (ASN1InputStream asn1 = new 
ASN1InputStream(sigData.getEncoded())) {
+-            DEROutputStream dos = new DEROutputStream(out);
++            ASN1OutputStream dos = ASN1OutputStream.create(out, 
ASN1Encoding.DER);
+             dos.writeObject(asn1.readObject());
+         }
+     }
diff -Nru android-platform-build-10.0.0+r36/debian/patches/series 
android-platform-build-10.0.0+r36/debian/patches/series
--- android-platform-build-10.0.0+r36/debian/patches/series     2021-01-03 
10:32:31.000000000 +1300
+++ android-platform-build-10.0.0+r36/debian/patches/series     2024-03-06 
14:35:07.000000000 +1300
@@ -3,3 +3,5 @@
 fix_zipalign_typo.diff
 python-2to3.patch
 Implement-range-based-pin-list.patch
+zip-archive-reader-signature.patch
+bouncycastle177-compat.patch
diff -Nru 
android-platform-build-10.0.0+r36/debian/patches/zip-archive-reader-signature.patch
 
android-platform-build-10.0.0+r36/debian/patches/zip-archive-reader-signature.patch
--- 
android-platform-build-10.0.0+r36/debian/patches/zip-archive-reader-signature.patch
 1970-01-01 12:00:00.000000000 +1200
+++ 
android-platform-build-10.0.0+r36/debian/patches/zip-archive-reader-signature.patch
 2024-03-06 14:35:07.000000000 +1300
@@ -0,0 +1,21 @@
+Description: update FileReader::ReadAtOffset signature
+ FileReader:ReadAtOffset() signature was changed in
+ android-libziparchive-dev. Update the method signature
+ to match.
+Author: Vladimir Petko <vladimir.pe...@canonical.com>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1042042
+Bug-Ubuntu: 
https://bugs.launchpad.net/ubuntu/+source/android-platform-build/+bug/2056084
+Forwarded: not-needed
+Last-Update: 2024-03-06
+
+--- a/tools/zipalign/ZipFile.cpp
++++ b/tools/zipalign/ZipFile.cpp
+@@ -1223,7 +1223,7 @@
+     FileReader(FILE* fp) : Reader(), fp_(fp), current_offset_(0) {
+     }
+
+-    bool ReadAtOffset(uint8_t* buf, size_t len, uint32_t offset) const {
++    bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const {
+         // Data is usually requested sequentially, so this helps avoid 
pointless
+         // fseeks every time we perform a read. There's an impedence mismatch
+         // here because the original API was designed around pread and pwrite.

Reply via email to