From d63d1d996c91cb09bffce5d9c50547ffaea3a489 Mon Sep 17 00:00:00 2001 From: finn Date: Sat, 15 Jan 2022 17:17:26 -0800 Subject: [PATCH] update to unofficial_38 some slightly different patching requirements --- .gitlab-ci.yml | 14 +---- build.sh | 10 +++ hashes.json | 26 ++++++++ libsignal-service-java.patch | 107 ++++++++++++++++++++++++-------- update-hashes.py | 29 +++++++++ update-verification-metadata.py | 20 ++++++ 6 files changed, 170 insertions(+), 36 deletions(-) create mode 100755 build.sh create mode 100644 hashes.json create mode 100644 update-hashes.py create mode 100644 update-verification-metadata.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a619373..d12c080 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,18 +2,14 @@ stages: - build variables: - version: "v2.15.3_unofficial_34" + version: "v2.15.3_unofficial_38" GRADLE_OPTS: -Dorg.gradle.daemon=false build: image: gradle:7.2 stage: build script: - - git clone https://github.com/Turasa/libsignal-service-java - - cd libsignal-service-java && git checkout "$version" - - git config user.email nobody@signald.org && git config user.name signald - - git am ../libsignal-service-java.patch - - gradle assemble publish + - ./build.sh parallel: matrix: - TARGET: @@ -27,10 +23,6 @@ build x86_64-apple-darwin: stage: build tags: [darwin-builder] script: - - git clone https://github.com/Turasa/libsignal-service-java - - cd libsignal-service-java && git checkout "$version" - - git config user.email nobody@signald.org && git config user.name signald - - git am ../libsignal-service-java.patch - - ./gradlew assemble publish + - ./build.sh variables: TARGET: x86_64-apple-darwin \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..a4c0a45 --- /dev/null +++ b/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -exuo pipefail +git clone https://github.com/Turasa/libsignal-service-java.git +cd libsignal-service-java +git config user.email nobody@signald.org +git config user.name signald +git am ../libsignal-service-java.patch +python3 ../update-verification-metadata.py +git diff --color=always +gradle assemble publish || (gradle --write-verification-metadata sha256 && git diff --color=always && exit 1) \ No newline at end of file diff --git a/hashes.json b/hashes.json new file mode 100644 index 0000000..d4f6f0a --- /dev/null +++ b/hashes.json @@ -0,0 +1,26 @@ +{ + "aarch64-unknown-linux-gnu": { + "jar": "842116b54ce7a64e7d1a2f5b95e089c274ab35fee45f0e108864b9a6bb47b5db", + "module": "30bb4de626a589810b6f01aede8be1d3df1d3adb01d674fc1ba75ee93ed0fa69" + }, + "arm-unknown-linux-gnueabi": { + "jar": "5178c42d4347d727da39f34659c8b964befb9d82225ea069d91517397b638ace", + "module": "b60d58873960d1bede4704ca6c07801cc1ca95543cc04da683aa228d6c35dbdc" + }, + "arm-unknown-linux-gnueabihf": { + "jar": "b5f8779a593c0fe37169a884eccbc0a70b8c55c0e389a0bace5e466e379af367", + "module": "dbda76abc260ad88d9cc4986f37f0327ed79fb1a12d0b9f397793ad2004f4e65" + }, + "armv7-unknown-linux-gnueabihf": { + "jar": "b60df2af653e37cdb858fa844c49b81d568be9d158e6bcf9a99584f2a9fd9463", + "module": "135d0a143b581407a4f04d50460f497a7302d46aa9bc532fa9a1d039e60007d2" + }, + "x86_64-unknown-linux-gnu": { + "jar": "b7ac682938e12f3b2b9f88a5ad7bd843d86abc4368742e404bc8d1b9e4fc6de5", + "module": "224b6332067e77650065e6dbd4f6b2d8eed1f4830bcf0e4ab31d3c4483352f0c" + }, + "x86_64-apple-darwin": { + "jar": "7d22516d32ab6be5648d4b2d728daafa755ac188f0880a99c956265e175e7840", + "module": "efa44dab7df24db4d60030ed613c17bff9f439bc7797124db8cdc18b177acc8f" + } +} \ No newline at end of file diff --git a/libsignal-service-java.patch b/libsignal-service-java.patch index 1e4a7ab..14373b9 100644 --- a/libsignal-service-java.patch +++ b/libsignal-service-java.patch @@ -1,17 +1,18 @@ -From 9c663c86765a9a0b2950ae8850bffc9fe4abe335 Mon Sep 17 00:00:00 2001 -From: finn -Date: Thu, 18 Nov 2021 18:55:31 -0800 +From 15483c7c0a29067bad3752cdaa12634beb351995 Mon Sep 17 00:00:00 2001 +From: signald +Date: Sat, 15 Jan 2022 17:34:03 -0800 Subject: [PATCH] update gradle files --- - build.gradle | 10 +--------- - dependencies.gradle | 3 +-- - service/build.gradle | 21 ++++++++++----------- - settings.gradle | 2 +- - 4 files changed, 13 insertions(+), 23 deletions(-) + build.gradle | 18 +++--------------- + dependencies.gradle | 3 +-- + gradle/verification-metadata.xml | 12 +++++++++--- + service/build.gradle | 24 +++++++++++------------- + settings.gradle | 1 - + 5 files changed, 24 insertions(+), 34 deletions(-) diff --git a/build.gradle b/build.gradle -index 5a4cded..a1d8d70 100644 +index 818516d..2083332 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ @@ -21,7 +22,20 @@ index 5a4cded..a1d8d70 100644 google() mavenCentral() } -@@ -23,15 +24,6 @@ def getRepositoryPassword() { +@@ -9,11 +10,7 @@ buildscript { + } + } + +-plugins { +- id("io.github.gradle-nexus.publish-plugin") version "1.1.0" +-} +- +-project.group = "com.github.turasa" ++project.group = "org.signald" + + def getRepositoryUsername() { + return hasProperty('whisperSonatypeUsername') ? whisperSonatypeUsername : "" +@@ -23,18 +20,9 @@ def getRepositoryPassword() { return hasProperty('whisperSonatypePassword') ? whisperSonatypePassword : "" } @@ -35,10 +49,14 @@ index 5a4cded..a1d8d70 100644 -} - subprojects { - ext.lib_signal_service_version_number = "2.15.3_unofficial_34" - ext.lib_signal_service_group_info = "com.github.turasa" + ext.lib_signal_service_version_number = "2.15.3_unofficial_38" +- ext.lib_signal_service_group_info = "com.github.turasa" ++ ext.lib_signal_service_group_info = "org.signald" + + if (JavaVersion.current().isJava8Compatible()) { + allprojects { diff --git a/dependencies.gradle b/dependencies.gradle -index c1288ca..fc83d0f 100644 +index c3a0278..b28c32d 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -8,8 +8,7 @@ dependencyResolutionManagement { @@ -50,12 +68,42 @@ index c1288ca..fc83d0f 100644 + alias('signal-client-java').to('org.whispersystems', 'signal-client-java-' + System.getenv("TARGET")).versionRef('signal-client') // Third Party - alias('jackson-core').to('com.fasterxml.jackson.core:jackson-databind:2.9.9.2') + alias('jackson-core').to('com.fasterxml.jackson.core:jackson-databind:2.13.0') +diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml +index 447b720..5fa2f62 100644 +--- a/gradle/verification-metadata.xml ++++ b/gradle/verification-metadata.xml +@@ -477,6 +477,9 @@ + + + ++ ++ ++ + + + +@@ -1140,9 +1143,12 @@ + + + +- +- +- ++ ++ ++ ++ ++ ++ + + + diff --git a/service/build.gradle b/service/build.gradle -index 98377c1..ca5a4c0 100644 +index 076cf4b..817cbf1 100644 --- a/service/build.gradle +++ b/service/build.gradle -@@ -23,6 +23,7 @@ compileJava { +@@ -21,6 +21,7 @@ compileJava { } repositories { @@ -63,7 +111,15 @@ index 98377c1..ca5a4c0 100644 mavenCentral() mavenLocal() } -@@ -103,8 +104,8 @@ def getRepositoryPassword() { +@@ -74,7 +75,6 @@ protobuf { + idea { + module { + generatedSourceDirs += file("${protobuf.generatedFilesBaseDir}/main/java") +- scopes.COMPILE.plus += [configurations.ideaTestFixturesImplementation] + } + } + +@@ -97,8 +97,8 @@ def getRepositoryPassword() { publishing { publications { @@ -74,7 +130,7 @@ index 98377c1..ca5a4c0 100644 from components.java pom { -@@ -145,16 +146,14 @@ publishing { +@@ -139,16 +139,14 @@ publishing { repositories { maven { @@ -86,30 +142,31 @@ index 98377c1..ca5a4c0 100644 + credentials(HttpHeaderCredentials) { + name = 'Job-Token' + value = System.getenv("CI_JOB_TOKEN") -+ } + } + authentication { + header(HttpHeaderAuthentication) - } ++ } } } - } +-} - -signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } - sign publishing.publications.mavenJava -} ++} +\ No newline at end of file diff --git a/settings.gradle b/settings.gradle -index 8861c00..c180376 100644 +index 8861c00..8dd0342 100644 --- a/settings.gradle +++ b/settings.gradle -@@ -1,6 +1,6 @@ +@@ -1,6 +1,5 @@ enableFeaturePreview('VERSION_CATALOGS') -include ':android' -+ include 'libsignal-service' project(':libsignal-service').projectDir = file('service') -- -2.20.1 +2.30.2 diff --git a/update-hashes.py b/update-hashes.py new file mode 100644 index 0000000..dbaa0f5 --- /dev/null +++ b/update-hashes.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +import requests +import hashlib +import json + +VERSION = "0.11.0" +TARGETS = [ + "aarch64-unknown-linux-gnu", + "arm-unknown-linux-gnueabi", + "arm-unknown-linux-gnueabihf", + "armv7-unknown-linux-gnueabihf", + "x86_64-unknown-linux-gnu", + "x86_64-apple-darwin" +] + +urlFormat = "https://gitlab.com/api/v4/groups/6853927/-/packages/maven/org/whispersystems/signal-client-java-{target}/{version}/signal-client-java-{target}-{version}.{ext}" +output = {} + +for target in TARGETS: + output[target] = {} + for ext in ["jar", "module"]: + url = urlFormat.format(target=target, version=VERSION, ext=ext) + print("fetching {}".format(url)) + r = requests.get(url, allow_redirects=True) + r.raise_for_status() + output[target][ext] = hashlib.sha256(r.content).hexdigest() + +with open('hashes.json', 'w') as f: + json.dump(output, f, indent=4) diff --git a/update-verification-metadata.py b/update-verification-metadata.py new file mode 100644 index 0000000..08db5a9 --- /dev/null +++ b/update-verification-metadata.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +import os +import json + +filename = "gradle/verification-metadata.xml" +with open('../hashes.json') as f: + hashes = json.load(f) + +target = os.getenv("TARGET") + +if target not in hashes: + raise Exception("Target {} not in known hashes, please update the python script".format(os.getenv("TARGET"))) + +with open(filename) as f: + template = f.read() + +output = template.format(TARGET=target, TARGET_JAR_SHA256=hashes[target]["jar"], TARGET_MODULE_SHA256=hashes[target]["module"]) + +with open(filename, 'w') as f: + f.write(output) \ No newline at end of file