From 42da06e037f74f9926c969f3d1dab0de36715c28 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 24 Feb 2020 16:37:31 +0100 Subject: [PATCH 01/26] Remove signature spoofing Now apply on the source code --- Dockerfile | 11 -- src/build.sh | 35 ------ .../android_frameworks_base-KK-LP.patch | 66 ----------- .../android_frameworks_base-M.patch | 104 ------------------ .../android_frameworks_base-N.patch | 104 ------------------ .../android_frameworks_base-O.patch | 102 ----------------- .../android_frameworks_base-P.patch | 88 --------------- .../frameworks_base_config.xml | 25 ----- 8 files changed, 535 deletions(-) delete mode 100644 src/signature_spoofing_patches/android_frameworks_base-KK-LP.patch delete mode 100644 src/signature_spoofing_patches/android_frameworks_base-M.patch delete mode 100644 src/signature_spoofing_patches/android_frameworks_base-N.patch delete mode 100644 src/signature_spoofing_patches/android_frameworks_base-O.patch delete mode 100644 src/signature_spoofing_patches/android_frameworks_base-P.patch delete mode 100644 src/signature_spoofing_patches/frameworks_base_config.xml diff --git a/Dockerfile b/Dockerfile index b50ef6c..47724c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -97,17 +97,6 @@ ENV ZIP_SUBDIR true # Write the verbose logs to $LOGS_DIR/$codename instead of $LOGS_DIR/ ENV LOGS_SUBDIR true -# Apply the MicroG's signature spoofing patch -# Valid values are "no", "yes" (for the original MicroG's patch) and -# "restricted" (to grant the permission only to the system privileged apps). -# -# The original ("yes") patch allows user apps to gain the ability to spoof -# themselves as other apps, which can be a major security threat. Using the -# restricted patch and embedding the apps that requires it as system privileged -# apps is a much secure option. See the README.md ("Custom mode") for an -# example. -ENV SIGNATURE_SPOOFING "no" - # Generate delta files ENV BUILD_DELTA false diff --git a/src/build.sh b/src/build.sh index f3fdeaa..dc69761 100755 --- a/src/build.sh +++ b/src/build.sh @@ -164,41 +164,6 @@ for branch in ${BRANCH_NAME//,/ }; do los_ver_minor=$(sed -n -e 's/^\s*PRODUCT_VERSION_MINOR = //p' "vendor/$vendor/config/common.mk") los_ver="$los_ver_major.$los_ver_minor" - # If needed, apply the microG's signature spoofing patch - if [ "$SIGNATURE_SPOOFING" = "yes" ] || [ "$SIGNATURE_SPOOFING" = "restricted" ]; then - # Determine which patch should be applied to the current Android source tree - patch_name="" - case $android_version in - 4.4* ) patch_name="android_frameworks_base-KK-LP.patch" ;; - 5.* ) patch_name="android_frameworks_base-KK-LP.patch" ;; - 6.* ) patch_name="android_frameworks_base-M.patch" ;; - 7.* ) patch_name="android_frameworks_base-N.patch" ;; - 8.* ) patch_name="android_frameworks_base-O.patch" ;; - 9* ) patch_name="android_frameworks_base-P.patch" ;; #not sure why 9 not 9.0 but here's a fix that will work until android 90 - esac - - if ! [ -z $patch_name ]; then - cd frameworks/base - if [ "$SIGNATURE_SPOOFING" = "yes" ]; then - echo ">> [$(date)] Applying the standard signature spoofing patch ($patch_name) to frameworks/base" - echo ">> [$(date)] WARNING: the standard signature spoofing patch introduces a security threat" - patch --quiet -p1 -i "/root/signature_spoofing_patches/$patch_name" - else - echo ">> [$(date)] Applying the restricted signature spoofing patch (based on $patch_name) to frameworks/base" - sed 's/android:protectionLevel="dangerous"/android:protectionLevel="signature|privileged"/' "/root/signature_spoofing_patches/$patch_name" | patch --quiet -p1 - fi - git clean -q -f - cd ../.. - - # Override device-specific settings for the location providers - mkdir -p "vendor/$vendor/overlay/microg/frameworks/base/core/res/res/values/" - cp /root/signature_spoofing_patches/frameworks_base_config.xml "vendor/$vendor/overlay/microg/frameworks/base/core/res/res/values/config.xml" - else - echo ">> [$(date)] ERROR: can't find a suitable signature spoofing patch for the current Android version ($android_version)" - exit 1 - fi - fi - echo ">> [$(date)] Setting \"$RELEASE_TYPE\" as release type" sed -i "/\$(filter .*\$(${vendor^^}_BUILDTYPE)/,+2d" "vendor/$vendor/config/common.mk" diff --git a/src/signature_spoofing_patches/android_frameworks_base-KK-LP.patch b/src/signature_spoofing_patches/android_frameworks_base-KK-LP.patch deleted file mode 100644 index 5571a58..0000000 --- a/src/signature_spoofing_patches/android_frameworks_base-KK-LP.patch +++ /dev/null @@ -1,66 +0,0 @@ -diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java -index e6da288..66684d3 100644 ---- a/core/java/android/content/pm/PackageParser.java -+++ b/core/java/android/content/pm/PackageParser.java -@@ -447,10 +447,23 @@ public class PackageParser { - } - } - if ((flags&PackageManager.GET_SIGNATURES) != 0) { -- int N = (p.mSignatures != null) ? p.mSignatures.length : 0; -- if (N > 0) { -- pi.signatures = new Signature[N]; -- System.arraycopy(p.mSignatures, 0, pi.signatures, 0, N); -+ boolean handledFakeSignature = false; -+ try { -+ if (p.requestedPermissions.contains("android.permission.FAKE_PACKAGE_SIGNATURE") && p.mAppMetaData != null -+ && p.mAppMetaData.get("fake-signature") instanceof String) { -+ pi.signatures = new Signature[] {new Signature(p.mAppMetaData.getString("fake-signature"))}; -+ handledFakeSignature = true; -+ } -+ } catch (Throwable t) { -+ // We should never die because of any failures, this is system code! -+ Log.w("PackageParser.FAKE_PACKAGE_SIGNATURE", t); -+ } -+ if (!handledFakeSignature) { -+ int N = (p.mSignatures != null) ? p.mSignatures.length : 0; -+ if (N > 0) { -+ pi.signatures = new Signature[N]; -+ System.arraycopy(p.mSignatures, 0, pi.signatures, 0, N); -+ } - } - } - return pi; -diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml -index 558a475..4e7aa65 100644 ---- a/core/res/AndroidManifest.xml -+++ b/core/res/AndroidManifest.xml -@@ -1562,6 +1562,13 @@ - android:label="@string/permlab_getPackageSize" - android:description="@string/permdesc_getPackageSize" /> - -+ -+ -+ - -diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml -index 790e166..8e66470 100644 ---- a/core/res/res/values/strings.xml -+++ b/core/res/res/values/strings.xml -@@ -1135,6 +1135,11 @@ - Allows the app to retrieve its code, data, and cache sizes - - -+ mimic package signature -+ -+ Allows the app to use mimic another app\'s package signature. -+ -+ - directly install apps - - Allows the app to install new or updated diff --git a/src/signature_spoofing_patches/android_frameworks_base-M.patch b/src/signature_spoofing_patches/android_frameworks_base-M.patch deleted file mode 100644 index 72d68e7..0000000 --- a/src/signature_spoofing_patches/android_frameworks_base-M.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 7357f8c0c8a6bdc09555ab47dae83f28346b8470 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Beno=C3=AEt=20Mauduit?= -Date: Wed, 22 Jun 2016 15:04:56 +0200 -Subject: [PATCH 1/1] Add signature Spoofing permission -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This is needed by GmsCore (https://microg.org/) to pretend -the existence of the official Play Services to applications calling -Google APIs. - -Signed-off-by: Benoît Mauduit ---- - core/res/AndroidManifest.xml | 7 +++++++ - core/res/res/values/config.xml | 2 ++ - core/res/res/values/strings.xml | 5 +++++ - .../android/server/pm/PackageManagerService.java | 23 ++++++++++++++++++++-- - 4 files changed, 35 insertions(+), 2 deletions(-) - -diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml -index ea0e39c..a936983 100644 ---- a/core/res/AndroidManifest.xml -+++ b/core/res/AndroidManifest.xml -@@ -1654,6 +1654,13 @@ - android:description="@string/permdesc_getPackageSize" - android:protectionLevel="normal" /> - -+ -+ -+ - -diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml -index c7846cf..916d8a5 100644 ---- a/core/res/res/values/config.xml -+++ b/core/res/res/values/config.xml -@@ -1298,6 +1298,8 @@ - - - com.android.location.fused -+ -+ com.google.android.gms - - - -diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml -index 58135db..e65367a 100644 ---- a/core/res/res/values/strings.xml -+++ b/core/res/res/values/strings.xml -@@ -616,6 +616,11 @@ - - - -+ Spoof package signature -+ -+ Allows the app to pretend to be a different app. Malicious applications might be able to use this to access private application data. Grant this permission with caution only! -+ -+ - disable or modify status bar - - Allows the app to disable the status bar or add and remove system icons. -diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java -index 0493180..35f49d7 100644 ---- a/services/core/java/com/android/server/pm/PackageManagerService.java -+++ b/services/core/java/com/android/server/pm/PackageManagerService.java -@@ -2816,8 +2816,27 @@ public class PackageManagerService extends IPackageManager.Stub { - final Set permissions = permissionsState.getPermissions(userId); - final PackageUserState state = ps.readUserState(userId); - -- return PackageParser.generatePackageInfo(p, gids, flags, -- ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId); -+ return mayFakeSignature(p, PackageParser.generatePackageInfo(p, gids, flags, -+ ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId), -+ permissions); -+ } -+ -+ private PackageInfo mayFakeSignature(PackageParser.Package p, PackageInfo pi, -+ Set permissions) { -+ try { -+ if (permissions.contains("android.permission.FAKE_PACKAGE_SIGNATURE") -+ && p.applicationInfo.targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1 -+ && p.mAppMetaData != null) { -+ String sig = p.mAppMetaData.getString("fake-signature"); -+ if (sig != null) { -+ pi.signatures = new Signature[] {new Signature(sig)}; -+ } -+ } -+ } catch (Throwable t) { -+ // We should never die because of any failures, this is system code! -+ Log.w("PackageManagerService.FAKE_PACKAGE_SIGNATURE", t); -+ } -+ return pi; - } - - @Override --- -2.8.1 - diff --git a/src/signature_spoofing_patches/android_frameworks_base-N.patch b/src/signature_spoofing_patches/android_frameworks_base-N.patch deleted file mode 100644 index 6e6125c..0000000 --- a/src/signature_spoofing_patches/android_frameworks_base-N.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 7357f8c0c8a6bdc09555ab47dae83f28346b8470 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Beno=C3=AEt=20Mauduit?= -Date: Wed, 22 Jun 2016 15:04:56 +0200 -Subject: [PATCH 1/1] Add signature Spoofing permission -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This is needed by GmsCore (https://microg.org/) to pretend -the existence of the official Play Services to applications calling -Google APIs. - -Signed-off-by: Benoît Mauduit ---- - core/res/AndroidManifest.xml | 7 +++++++ - core/res/res/values/config.xml | 2 ++ - core/res/res/values/strings.xml | 5 +++++ - .../android/server/pm/PackageManagerService.java | 23 ++++++++++++++++++++-- - 4 files changed, 35 insertions(+), 2 deletions(-) - -diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml -index ea0e39c..a936983 100644 ---- a/core/res/AndroidManifest.xml -+++ b/core/res/AndroidManifest.xml -@@ -1654,6 +1654,13 @@ - android:description="@string/permdesc_getPackageSize" - android:protectionLevel="normal" /> - -+ -+ -+ - -diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml -index c7846cf..916d8a5 100644 ---- a/core/res/res/values/config.xml -+++ b/core/res/res/values/config.xml -@@ -1298,6 +1298,8 @@ - - - com.android.location.fused -+ -+ com.google.android.gms - - - -diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml -index 58135db..e65367a 100644 ---- a/core/res/res/values/strings.xml -+++ b/core/res/res/values/strings.xml -@@ -616,6 +616,11 @@ - - - -+ Spoof package signature -+ -+ Allows the app to pretend to be a different app. Malicious applications might be able to use this to access private application data. Grant this permission with caution only! -+ -+ - disable or modify status bar - - Allows the app to disable the status bar or add and remove system icons. -diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java -index 0493180..35f49d7 100644 ---- a/services/core/java/com/android/server/pm/PackageManagerService.java -+++ b/services/core/java/com/android/server/pm/PackageManagerService.java -@@ -3067,8 +3067,27 @@ public class PackageManagerService extends IPackageManager.Stub { - ? Collections.emptySet() : permissionsState.getPermissions(userId); - final PackageUserState state = ps.readUserState(userId); - -- return PackageParser.generatePackageInfo(p, gids, flags, -- ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId); -+ return mayFakeSignature(p, PackageParser.generatePackageInfo(p, gids, flags, -+ ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId), -+ permissions); -+ } -+ -+ private PackageInfo mayFakeSignature(PackageParser.Package p, PackageInfo pi, -+ Set permissions) { -+ try { -+ if (permissions.contains("android.permission.FAKE_PACKAGE_SIGNATURE") -+ && p.applicationInfo.targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1 -+ && p.mAppMetaData != null) { -+ String sig = p.mAppMetaData.getString("fake-signature"); -+ if (sig != null) { -+ pi.signatures = new Signature[] {new Signature(sig)}; -+ } -+ } -+ } catch (Throwable t) { -+ // We should never die because of any failures, this is system code! -+ Log.w("PackageManagerService.FAKE_PACKAGE_SIGNATURE", t); -+ } -+ return pi; - } - - @Override --- -2.8.1 - diff --git a/src/signature_spoofing_patches/android_frameworks_base-O.patch b/src/signature_spoofing_patches/android_frameworks_base-O.patch deleted file mode 100644 index cc1d338..0000000 --- a/src/signature_spoofing_patches/android_frameworks_base-O.patch +++ /dev/null @@ -1,102 +0,0 @@ -commit 4e9d677b35b9656c22c922c9abca4107ab95c9b4 -Author: Bernhard Rosenkränzer -Date: Tue Aug 29 00:34:27 2017 +0200 - - Add permission to allow an APK to fake a signature. - - This is needed by GmsCore (https://microg.org/) to pretend - the existence of the official Play Services to applications calling - Google APIs. - - Forward-ported from https://github.com/microg/android_packages_apps_GmsCore/blob/master/patches/android_frameworks_base-N.patch - - Change-Id: I603fd09200432f7e1bf997072188cdfa6da1594f - Signed-off-by: Bernhard Rosenkränzer - -diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml -index 794d4f8b78b..b3189077256 100644 ---- a/core/res/AndroidManifest.xml -+++ b/core/res/AndroidManifest.xml -@@ -2075,6 +2075,13 @@ - android:description="@string/permdesc_getPackageSize" - android:protectionLevel="normal" /> - -+ -+ -+ - -diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml -index 3613acf44aa..d1636c862c5 100644 ---- a/core/res/res/values/config.xml -+++ b/core/res/res/values/config.xml -@@ -1385,6 +1385,8 @@ - - - com.android.location.fused -+ -+ com.google.android.gms - - - -diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml -index 3eebe7eb68d..7405386cd49 100644 ---- a/core/res/res/values/strings.xml -+++ b/core/res/res/values/strings.xml -@@ -764,6 +764,10 @@ - - - -+ -+ Spoof package signature -+ -+ Allows the app to pretend to be a different app. Malicious applications might be able to use this to access private application data. Legitimate uses include an emulator pretending to be what it emulates. Grant this permission with caution only! - - disable or modify status bar - -diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java -index f36b762c5e9..048a057d39c 100644 ---- a/services/core/java/com/android/server/pm/PackageManagerService.java -+++ b/services/core/java/com/android/server/pm/PackageManagerService.java -@@ -3571,8 +3571,9 @@ public class PackageManagerService extends IPackageManager.Stub - flags |= MATCH_ANY_USER; - } - -- PackageInfo packageInfo = PackageParser.generatePackageInfo(p, gids, flags, -- ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId); -+ PackageInfo packageInfo = mayFakeSignature(p, PackageParser.generatePackageInfo(p, gids, flags, -+ ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId), -+ permissions); - - if (packageInfo == null) { - return null; -@@ -3584,6 +3585,24 @@ public class PackageManagerService extends IPackageManager.Stub - return packageInfo; - } - -+ private PackageInfo mayFakeSignature(PackageParser.Package p, PackageInfo pi, -+ Set permissions) { -+ try { -+ if (permissions.contains("android.permission.FAKE_PACKAGE_SIGNATURE") -+ && p.applicationInfo.targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1 -+ && p.mAppMetaData != null) { -+ String sig = p.mAppMetaData.getString("fake-signature"); -+ if (sig != null) { -+ pi.signatures = new Signature[] {new Signature(sig)}; -+ } -+ } -+ } catch (Throwable t) { -+ // We should never die because of any failures, this is system code! -+ Log.w("PackageManagerService.FAKE_PACKAGE_SIGNATURE", t); -+ } -+ return pi; -+ } -+ - @Override - public void checkPackageStartable(String packageName, int userId) { - final int callingUid = Binder.getCallingUid(); diff --git a/src/signature_spoofing_patches/android_frameworks_base-P.patch b/src/signature_spoofing_patches/android_frameworks_base-P.patch deleted file mode 100644 index ad0fdf2..0000000 --- a/src/signature_spoofing_patches/android_frameworks_base-P.patch +++ /dev/null @@ -1,88 +0,0 @@ -diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml -index 66c497e9977..c1b2e703109 100644 ---- a/core/res/AndroidManifest.xml -+++ b/core/res/AndroidManifest.xml -@@ -2341,6 +2341,13 @@ - android:description="@string/permdesc_getPackageSize" - android:protectionLevel="normal" /> - -+ -+ -+ - -diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml -index 0b5dd7e70e8..bbdba64f2ba 100644 ---- a/core/res/res/values/config.xml -+++ b/core/res/res/values/config.xml -@@ -1650,6 +1650,8 @@ - - - com.android.location.fused -+ -+ com.google.android.gms - - - -diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml -index 3c5159c89bf..7583f1c567f 100644 ---- a/core/res/res/values/strings.xml -+++ b/core/res/res/values/strings.xml -@@ -786,6 +786,11 @@ - - - -+ Spoof package signature -+ -+ Allows the app to pretend to be a different app. Malicious applications might be able to use this to access private application data. Legitimate uses include an emulator pretending to be what it emulates. Grant this permission with caution only! -+ -+ - disable or modify status bar - - Allows the app to disable the status bar or add and remove system icons. -diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java -index 9ed2b9c1854..4c5ce24cfa7 100644 ---- a/services/core/java/com/android/server/pm/PackageManagerService.java -+++ b/services/core/java/com/android/server/pm/PackageManagerService.java -@@ -3937,8 +3937,9 @@ public class PackageManagerService extends IPackageManager.Stub - final Set permissions = ArrayUtils.isEmpty(p.requestedPermissions) - ? Collections.emptySet() : permissionsState.getPermissions(userId); - -- PackageInfo packageInfo = PackageParser.generatePackageInfo(p, gids, flags, -- ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId); -+ PackageInfo packageInfo = mayFakeSignature(p, PackageParser.generatePackageInfo(p, gids, flags, -+ ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId), -+ permissions); - - if (packageInfo == null) { - return null; -@@ -3974,6 +3975,24 @@ public class PackageManagerService extends IPackageManager.Stub - } - } - -+ private PackageInfo mayFakeSignature(PackageParser.Package p, PackageInfo pi, -+ Set permissions) { -+ try { -+ if (permissions.contains("android.permission.FAKE_PACKAGE_SIGNATURE") -+ && p.applicationInfo.targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1 -+ && p.mAppMetaData != null) { -+ String sig = p.mAppMetaData.getString("fake-signature"); -+ if (sig != null) { -+ pi.signatures = new Signature[] {new Signature(sig)}; -+ } -+ } -+ } catch (Throwable t) { -+ // We should never die because of any failures, this is system code! -+ Log.w("PackageManagerService.FAKE_PACKAGE_SIGNATURE", t); -+ } -+ return pi; -+ } -+ - @Override - public void checkPackageStartable(String packageName, int userId) { - final int callingUid = Binder.getCallingUid(); diff --git a/src/signature_spoofing_patches/frameworks_base_config.xml b/src/signature_spoofing_patches/frameworks_base_config.xml deleted file mode 100644 index 5925277..0000000 --- a/src/signature_spoofing_patches/frameworks_base_config.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - true - true - - -- GitLab From f4cf742352be210ec74890c6a3266fbadff6ae18 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 24 Feb 2020 16:38:22 +0100 Subject: [PATCH 02/26] Filter out random types behavior removed in the source code --- src/build.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/build.sh b/src/build.sh index dc69761..ac3b075 100755 --- a/src/build.sh +++ b/src/build.sh @@ -164,9 +164,6 @@ for branch in ${BRANCH_NAME//,/ }; do los_ver_minor=$(sed -n -e 's/^\s*PRODUCT_VERSION_MINOR = //p' "vendor/$vendor/config/common.mk") los_ver="$los_ver_major.$los_ver_minor" - echo ">> [$(date)] Setting \"$RELEASE_TYPE\" as release type" - sed -i "/\$(filter .*\$(${vendor^^}_BUILDTYPE)/,+2d" "vendor/$vendor/config/common.mk" - # Set a custom updater URI if a OTA URL is provided echo ">> [$(date)] Adding OTA URL overlay (for custom URL $OTA_URL)" if ! [ -z "$OTA_URL" ]; then -- GitLab From fa0384fb7e76ad3e0c28f5a8a981d257f7fc8a54 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 24 Feb 2020 16:52:37 +0100 Subject: [PATCH 03/26] Remove the microG overlay Now implemented in the ROM --- src/build.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/build.sh b/src/build.sh index ac3b075..088912b 100755 --- a/src/build.sh +++ b/src/build.sh @@ -155,11 +155,7 @@ for branch in ${BRANCH_NAME//,/ }; do echo ">> [$(date)] Missing \"vendor/$vendor\", aborting" exit 1 fi - - # Set up our overlay - mkdir -p "vendor/$vendor/overlay/microg/" - sed -i "1s;^;PRODUCT_PACKAGE_OVERLAYS := vendor/$vendor/overlay/microg\n;" "vendor/$vendor/config/common.mk" - + los_ver_major=$(sed -n -e 's/^\s*PRODUCT_VERSION_MAJOR = //p' "vendor/$vendor/config/common.mk") los_ver_minor=$(sed -n -e 's/^\s*PRODUCT_VERSION_MINOR = //p' "vendor/$vendor/config/common.mk") los_ver="$los_ver_major.$los_ver_minor" -- GitLab From d28892d6b8d437f24f2f4c233755079cfa11694d Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 24 Feb 2020 17:09:44 +0100 Subject: [PATCH 04/26] Remove a custom updater URI if a OTA URL is provided --- Dockerfile | 4 ---- src/build.sh | 20 +------------------- src/packages_updater_strings.xml | 7 ------- 3 files changed, 1 insertion(+), 30 deletions(-) delete mode 100644 src/packages_updater_strings.xml diff --git a/Dockerfile b/Dockerfile index 47724c8..7688b34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,10 +47,6 @@ ENV REPO 'https://github.com/LineageOS/android.git' # Repo use for build ENV MIRROR 'https://github.com/LineageOS/mirror' -# OTA URL that will be used inside CMUpdater -# Use this in combination with LineageOTA to make sure your device can auto-update itself from this buildbot -ENV OTA_URL '' - # User identity ENV USER_NAME 'LineageOS Buildbot' ENV USER_MAIL 'lineageos-buildbot@docker.host' diff --git a/src/build.sh b/src/build.sh index 088912b..af0eae0 100755 --- a/src/build.sh +++ b/src/build.sh @@ -155,29 +155,11 @@ for branch in ${BRANCH_NAME//,/ }; do echo ">> [$(date)] Missing \"vendor/$vendor\", aborting" exit 1 fi - + los_ver_major=$(sed -n -e 's/^\s*PRODUCT_VERSION_MAJOR = //p' "vendor/$vendor/config/common.mk") los_ver_minor=$(sed -n -e 's/^\s*PRODUCT_VERSION_MINOR = //p' "vendor/$vendor/config/common.mk") los_ver="$los_ver_major.$los_ver_minor" - # Set a custom updater URI if a OTA URL is provided - echo ">> [$(date)] Adding OTA URL overlay (for custom URL $OTA_URL)" - if ! [ -z "$OTA_URL" ]; then - updater_url_overlay_dir="vendor/$vendor/overlay/microg/packages/apps/Updater/res/values/" - mkdir -p "$updater_url_overlay_dir" - - if [ -n "$(grep updater_server_url packages/apps/Updater/res/values/strings.xml)" ]; then - # "New" updater configuration: full URL (with placeholders {device}, {type} and {incr}) - sed "s|{name}|updater_server_url|g; s|{url}|$OTA_URL/v1/{device}/{type}/{incr}|g" /root/packages_updater_strings.xml > "$updater_url_overlay_dir/strings.xml" - elif [ -n "$(grep conf_update_server_url_def packages/apps/Updater/res/values/strings.xml)" ]; then - # "Old" updater configuration: just the URL - sed "s|{name}|conf_update_server_url_def|g; s|{url}|$OTA_URL|g" /root/packages_updater_strings.xml > "$updater_url_overlay_dir/strings.xml" - else - echo ">> [$(date)] ERROR: no known Updater URL property found" - exit 1 - fi - fi - # Add custom packages to be installed if ! [ -z "$CUSTOM_PACKAGES" ]; then echo ">> [$(date)] Adding custom packages ($CUSTOM_PACKAGES)" diff --git a/src/packages_updater_strings.xml b/src/packages_updater_strings.xml deleted file mode 100644 index 64001db..0000000 --- a/src/packages_updater_strings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - {url} - - -- GitLab From 9cc6bec80c99910679c9f3f54bb96d6ba104b788 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 24 Feb 2020 17:25:50 +0100 Subject: [PATCH 05/26] Remove custom packages /e/ packages defined in the vendors, and still possibility to define custom packages --- src/build.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/build.sh b/src/build.sh index af0eae0..82eaba1 100755 --- a/src/build.sh +++ b/src/build.sh @@ -160,12 +160,6 @@ for branch in ${BRANCH_NAME//,/ }; do los_ver_minor=$(sed -n -e 's/^\s*PRODUCT_VERSION_MINOR = //p' "vendor/$vendor/config/common.mk") los_ver="$los_ver_major.$los_ver_minor" - # Add custom packages to be installed - if ! [ -z "$CUSTOM_PACKAGES" ]; then - echo ">> [$(date)] Adding custom packages ($CUSTOM_PACKAGES)" - sed -i "1s;^;PRODUCT_PACKAGES += $CUSTOM_PACKAGES\n\n;" "vendor/$vendor/config/common.mk" - fi - if [ "$SIGN_BUILDS" = true ]; then echo ">> [$(date)] Adding keys path ($KEYS_DIR)" # Soong (Android 9+) complains if the signing keys are outside the build path -- GitLab From e8cade63ec175ab301f26794d17564bcee2a5fe5 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Wed, 26 Feb 2020 11:33:36 +0100 Subject: [PATCH 06/26] Build only for one branch and one device. --- Dockerfile | 6 +- src/build.sh | 470 +++++++++++++++++++++++++-------------------------- 2 files changed, 231 insertions(+), 245 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7688b34..29b3c51 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,11 +32,11 @@ ENV CCACHE_SIZE 50G # Environment for the LineageOS branches name # See https://github.com/LineageOS/android_vendor_cm/branches for possible options -ENV BRANCH_NAME 'cm-14.1' +ENV BRANCH_NAME 'v1-pie' # Environment for the device list (separate by comma if more than one) -# eg. DEVICE_LIST=hammerhead,bullhead,angler -ENV DEVICE_LIST '' +# eg. DEVICE=hammerhead +ENV DEVICE '' # Release type string ENV RELEASE_TYPE 'UNOFFICIAL' diff --git a/src/build.sh b/src/build.sh index 82eaba1..102fab8 100755 --- a/src/build.sh +++ b/src/build.sh @@ -33,14 +33,6 @@ if [ "$CLEAN_OUTDIR" = true ]; then rm -rf "$ZIP_DIR/"* fi -# Treat DEVICE_LIST as DEVICE_LIST_ -first_branch=$(cut -d ',' -f 1 <<< "$BRANCH_NAME") -if [ -n "$DEVICE_LIST" ]; then - device_list_first_branch="DEVICE_LIST_$(sed 's/.*-\([a-zA-Z]*\)$/\1/' <<< $first_branch)" - device_list_first_branch=${device_list_first_branch^^} - read $device_list_first_branch <<< "$DEVICE_LIST,${!device_list_first_branch}" -fi - sync_successful=true if [ "$LOCAL_MIRROR" = true ]; then @@ -70,288 +62,282 @@ if [ "$LOCAL_MIRROR" = true ]; then fi fi -for branch in ${BRANCH_NAME//,/ }; do - branch_dir=$(sed 's/.*-\([a-zA-Z]*\)$/\1/' <<< $branch) - branch_dir=${branch_dir^^} - device_list_cur_branch="DEVICE_LIST_$branch_dir" - devices=${!device_list_cur_branch} - - if [ -n "$branch" ] && [ -n "$devices" ]; then +branch_dir=$(sed 's/.*-\([a-zA-Z]*\)$/\1/' <<< ${BRANCH_NAME}) +branch_dir=${branch_dir^^} - mkdir -p "$SRC_DIR/$branch_dir" - cd "$SRC_DIR/$branch_dir" +if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then - echo ">> [$(date)] Branch: $branch" - echo ">> [$(date)] Devices: $devices" + mkdir -p "$SRC_DIR/$branch_dir" + cd "$SRC_DIR/$branch_dir" - # Remove previous changes of vendor/cm, vendor/lineage and frameworks/base (if they exist) - for path in "vendor/cm" "vendor/lineage" "frameworks/base"; do - if [ -d "$path" ]; then - cd "$path" - git reset -q --hard - git clean -q -fd - cd "$SRC_DIR/$branch_dir" - fi - done + echo ">> [$(date)] Branch: ${BRANCH_NAME}" + echo ">> [$(date)] Device: ${DEVICE}" - echo ">> [$(date)] (Re)initializing branch repository" | tee -a "$repo_log" - if [ "$LOCAL_MIRROR" = true ]; then - yes | repo init -u "$REPO" --reference "$MIRROR_DIR" -b "$branch" &>> "$repo_log" - else - yes | repo init -u "$REPO" -b "$branch" &>> "$repo_log" + # Remove previous changes of vendor/cm, vendor/lineage and frameworks/base (if they exist) + for path in "vendor/cm" "vendor/lineage" "frameworks/base"; do + if [ -d "$path" ]; then + cd "$path" + git reset -q --hard + git clean -q -fd + cd "$SRC_DIR/$branch_dir" fi + done - # Copy local manifests to the appropriate folder in order take them into consideration - echo ">> [$(date)] Copying '$LMANIFEST_DIR/*.xml' to '.repo/local_manifests/'" - mkdir -p .repo/local_manifests - rsync -a --delete --include '*.xml' --exclude '*' "$LMANIFEST_DIR/" .repo/local_manifests/ - - rm -f .repo/local_manifests/proprietary.xml - if [ "$INCLUDE_PROPRIETARY" = true ]; then - if [[ $branch =~ nougat$ ]]; then - themuppets_branch=cm-14.1 - echo ">> [$(date)] Use branch $themuppets_branch on github.com/TheMuppets" - elif [[ $branch =~ oreo$ ]]; then - themuppets_branch=lineage-15.1 - echo ">> [$(date)] Use branch $themuppets_branch on github.com/TheMuppets" - elif [[ $branch =~ pie$ ]]; then - themuppets_branch=lineage-16.0 - echo ">> [$(date)] Use branch $themuppets_branch on github.com/TheMuppets" - else - themuppets_branch=cm-14.1 - echo ">> [$(date)] Can't find a matching branch on github.com/TheMuppets, using $themuppets_branch" - fi - wget -q -O .repo/local_manifests/proprietary.xml "https://raw.githubusercontent.com/TheMuppets/manifests/$themuppets_branch/muppets.xml" - fi + echo ">> [$(date)] (Re)initializing branch repository" | tee -a "$repo_log" + if [ "$LOCAL_MIRROR" = true ]; then + yes | repo init -u "$REPO" --reference "$MIRROR_DIR" -b "${BRANCH_NAME}" &>> "$repo_log" + else + yes | repo init -u "$REPO" -b "${BRANCH_NAME}" &>> "$repo_log" + fi - echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log" - builddate=$(date +%Y%m%d) - repo sync -c --force-sync &>> "$repo_log" + # Copy local manifests to the appropriate folder in order take them into consideration + echo ">> [$(date)] Copying '$LMANIFEST_DIR/*.xml' to '.repo/local_manifests/'" + mkdir -p .repo/local_manifests + rsync -a --delete --include '*.xml' --exclude '*' "$LMANIFEST_DIR/" .repo/local_manifests/ - if [ $? != 0 ]; then - sync_successful=false + rm -f .repo/local_manifests/proprietary.xml + if [ "$INCLUDE_PROPRIETARY" = true ]; then + if [[ ${BRANCH_NAME} =~ nougat$ ]]; then + themuppets_branch=cm-14.1 + echo ">> [$(date)] Use branch $themuppets_branch on github.com/TheMuppets" + elif [[ ${BRANCH_NAME} =~ oreo$ ]]; then + themuppets_branch=lineage-15.1 + echo ">> [$(date)] Use branch $themuppets_branch on github.com/TheMuppets" + elif [[ ${BRANCH_NAME} =~ pie$ ]]; then + themuppets_branch=lineage-16.0 + echo ">> [$(date)] Use branch $themuppets_branch on github.com/TheMuppets" + else + themuppets_branch=cm-14.1 + echo ">> [$(date)] Can't find a matching branch on github.com/TheMuppets, using $themuppets_branch" fi + wget -q -O .repo/local_manifests/proprietary.xml "https://raw.githubusercontent.com/TheMuppets/manifests/$themuppets_branch/muppets.xml" + fi + + echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log" + builddate=$(date +%Y%m%d) + repo sync -c --force-sync &>> "$repo_log" - android_version=$(sed -n -e 's/^\s*PLATFORM_VERSION\.OPM1 := //p' build/core/version_defaults.mk) + if [ $? != 0 ]; then + sync_successful=false + fi + + android_version=$(sed -n -e 's/^\s*PLATFORM_VERSION\.OPM1 := //p' build/core/version_defaults.mk) + if [ -z $android_version ]; then + android_version=$(sed -n -e 's/^\s*PLATFORM_VERSION\.PPR1 := //p' build/core/version_defaults.mk) if [ -z $android_version ]; then - android_version=$(sed -n -e 's/^\s*PLATFORM_VERSION\.PPR1 := //p' build/core/version_defaults.mk) + android_version=$(sed -n -e 's/^\s*PLATFORM_VERSION := //p' build/core/version_defaults.mk) if [ -z $android_version ]; then - android_version=$(sed -n -e 's/^\s*PLATFORM_VERSION := //p' build/core/version_defaults.mk) - if [ -z $android_version ]; then - echo ">> [$(date)] Can't detect the android version" - exit 1 - fi + echo ">> [$(date)] Can't detect the android version" + exit 1 fi fi - android_version_major=$(cut -d '.' -f 1 <<< $android_version) - - if [ "$android_version_major" -ge "8" ]; then - vendor="lineage" - else - vendor="cm" - fi - - if [ ! -d "vendor/$vendor" ]; then - echo ">> [$(date)] Missing \"vendor/$vendor\", aborting" - exit 1 - fi + fi + android_version_major=$(cut -d '.' -f 1 <<< $android_version) - los_ver_major=$(sed -n -e 's/^\s*PRODUCT_VERSION_MAJOR = //p' "vendor/$vendor/config/common.mk") - los_ver_minor=$(sed -n -e 's/^\s*PRODUCT_VERSION_MINOR = //p' "vendor/$vendor/config/common.mk") - los_ver="$los_ver_major.$los_ver_minor" + if [ "$android_version_major" -ge "8" ]; then + vendor="lineage" + else + vendor="cm" + fi - if [ "$SIGN_BUILDS" = true ]; then - echo ">> [$(date)] Adding keys path ($KEYS_DIR)" - # Soong (Android 9+) complains if the signing keys are outside the build path - ln -sf "$KEYS_DIR" user-keys - sed -i "1s;^;PRODUCT_DEFAULT_DEV_CERTIFICATE := user-keys/releasekey\nPRODUCT_OTA_PUBLIC_KEYS := user-keys/releasekey\nPRODUCT_EXTRA_RECOVERY_KEYS := user-keys/releasekey\n\n;" "vendor/$vendor/config/common.mk" - fi + if [ ! -d "vendor/$vendor" ]; then + echo ">> [$(date)] Missing \"vendor/$vendor\", aborting" + exit 1 + fi - if [ "$android_version_major" -ge "7" ]; then - jdk_version=8 - elif [ "$android_version_major" -ge "5" ]; then - jdk_version=7 - else - echo ">> [$(date)] ERROR: $branch requires a JDK version too old (< 7); aborting" - exit 1 - fi + los_ver_major=$(sed -n -e 's/^\s*PRODUCT_VERSION_MAJOR = //p' "vendor/$vendor/config/common.mk") + los_ver_minor=$(sed -n -e 's/^\s*PRODUCT_VERSION_MINOR = //p' "vendor/$vendor/config/common.mk") + los_ver="$los_ver_major.$los_ver_minor" - echo ">> [$(date)] Using OpenJDK $jdk_version" - update-java-alternatives -s java-1.$jdk_version.0-openjdk-amd64 &> /dev/null + if [ "$SIGN_BUILDS" = true ]; then + echo ">> [$(date)] Adding keys path ($KEYS_DIR)" + # Soong (Android 9+) complains if the signing keys are outside the build path + ln -sf "$KEYS_DIR" user-keys + sed -i "1s;^;PRODUCT_DEFAULT_DEV_CERTIFICATE := user-keys/releasekey\nPRODUCT_OTA_PUBLIC_KEYS := user-keys/releasekey\nPRODUCT_EXTRA_RECOVERY_KEYS := user-keys/releasekey\n\n;" "vendor/$vendor/config/common.mk" + fi - # Prepare the environment - echo ">> [$(date)] Preparing build environment" - source build/envsetup.sh > /dev/null + if [ "$android_version_major" -ge "7" ]; then + jdk_version=8 + elif [ "$android_version_major" -ge "5" ]; then + jdk_version=7 + else + echo ">> [$(date)] ERROR: ${BRANCH_NAME} requires a JDK version too old (< 7); aborting" + exit 1 + fi - if [ -f /root/userscripts/before.sh ]; then - echo ">> [$(date)] Running before.sh" - /root/userscripts/before.sh - fi + echo ">> [$(date)] Using OpenJDK $jdk_version" + update-java-alternatives -s java-1.$jdk_version.0-openjdk-amd64 &> /dev/null - for codename in ${devices//,/ }; do - build_device=true - if ! [ -z "$codename" ]; then + # Prepare the environment + echo ">> [$(date)] Preparing build environment" + source build/envsetup.sh > /dev/null - currentdate=$(date +%Y%m%d) - if [ "$builddate" != "$currentdate" ]; then - # Sync the source code - builddate=$currentdate + if [ -f /root/userscripts/before.sh ]; then + echo ">> [$(date)] Running before.sh" + /root/userscripts/before.sh + fi - if [ "$LOCAL_MIRROR" = true ]; then - echo ">> [$(date)] Syncing mirror repository" | tee -a "$repo_log" - cd "$MIRROR_DIR" - repo sync --force-sync --no-clone-bundle &>> "$repo_log" + build_device=true + if ! [ -z "${DEVICE}" ]; then - if [ $? != 0 ]; then - sync_successful=false - build_device=false - fi - fi + currentdate=$(date +%Y%m%d) + if [ "$builddate" != "$currentdate" ]; then + # Sync the source code + builddate=$currentdate - echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log" - cd "$SRC_DIR/$branch_dir" - repo sync -c --force-sync &>> "$repo_log" + if [ "$LOCAL_MIRROR" = true ]; then + echo ">> [$(date)] Syncing mirror repository" | tee -a "$repo_log" + cd "$MIRROR_DIR" + repo sync --force-sync --no-clone-bundle &>> "$repo_log" - if [ $? != 0 ]; then - sync_successful=false - build_device=false - fi + if [ $? != 0 ]; then + sync_successful=false + build_device=false fi + fi - if [ "$BUILD_OVERLAY" = true ]; then - mkdir -p "$TMP_DIR/device" "$TMP_DIR/workdir" "$TMP_DIR/merged" - mount -t overlay overlay -o lowerdir="$SRC_DIR/$branch_dir",upperdir="$TMP_DIR/device",workdir="$TMP_DIR/workdir" "$TMP_DIR/merged" - source_dir="$TMP_DIR/merged" - else - source_dir="$SRC_DIR/$branch_dir" - fi - cd "$source_dir" + echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log" + cd "$SRC_DIR/$branch_dir" + repo sync -c --force-sync &>> "$repo_log" - if [ "$ZIP_SUBDIR" = true ]; then - zipsubdir=$codename - mkdir -p "$ZIP_DIR/$zipsubdir" - else - zipsubdir= - fi - if [ "$LOGS_SUBDIR" = true ]; then - logsubdir=$codename - mkdir -p "$LOGS_DIR/$logsubdir" - else - logsubdir= - fi + if [ $? != 0 ]; then + sync_successful=false + build_device=false + fi + fi - DEBUG_LOG="$LOGS_DIR/$logsubdir/eelo-$los_ver-$builddate-$RELEASE_TYPE-$codename.log" + if [ "$BUILD_OVERLAY" = true ]; then + mkdir -p "$TMP_DIR/device" "$TMP_DIR/workdir" "$TMP_DIR/merged" + mount -t overlay overlay -o lowerdir="$SRC_DIR/$branch_dir",upperdir="$TMP_DIR/device",workdir="$TMP_DIR/workdir" "$TMP_DIR/merged" + source_dir="$TMP_DIR/merged" + else + source_dir="$SRC_DIR/$branch_dir" + fi + cd "$source_dir" - if [ -f /root/userscripts/pre-build.sh ]; then - echo ">> [$(date)] Running pre-build.sh for $codename" >> "$DEBUG_LOG" - /root/userscripts/pre-build.sh $codename &>> "$DEBUG_LOG" + if [ "$ZIP_SUBDIR" = true ]; then + zipsubdir=${DEVICE} + mkdir -p "$ZIP_DIR/$zipsubdir" + else + zipsubdir= + fi + if [ "$LOGS_SUBDIR" = true ]; then + logsubdir=${DEVICE} + mkdir -p "$LOGS_DIR/$logsubdir" + else + logsubdir= + fi - if [ $? != 0 ]; then - build_device=false - fi - fi + DEBUG_LOG="$LOGS_DIR/$logsubdir/eelo-$los_ver-$builddate-$RELEASE_TYPE-${DEVICE}.log" - if [ "$build_device" = false ]; then - echo ">> [$(date)] No build for $codename" >> "$DEBUG_LOG" - continue - fi + if [ -f /root/userscripts/pre-build.sh ]; then + echo ">> [$(date)] Running pre-build.sh for ${DEVICE}" >> "$DEBUG_LOG" + /root/userscripts/pre-build.sh ${DEVICE} &>> "$DEBUG_LOG" - # Start the build - echo ">> [$(date)] Starting build for $codename, $branch branch" | tee -a "$DEBUG_LOG" - build_successful=false - echo "ANDROID_JACK_VM_ARGS=${ANDROID_JACK_VM_ARGS}" - if brunch $codename &>> "$DEBUG_LOG"; then - currentdate=$(date +%Y%m%d) - if [ "$builddate" != "$currentdate" ]; then - find out/target/product/$codename -maxdepth 1 -name "e-*-$currentdate-*.zip*" -type f -exec sh /root/fix_build_date.sh {} $currentdate $builddate \; &>> "$DEBUG_LOG" - fi + if [ $? != 0 ]; then + build_device=false + fi + fi - if [ "$BUILD_DELTA" = true ]; then - if [ -d "delta_last/$codename/" ]; then - # If not the first build, create delta files - echo ">> [$(date)] Generating delta files for $codename" | tee -a "$DEBUG_LOG" - cd /root/delta - if ./opendelta.sh $codename &>> "$DEBUG_LOG"; then - echo ">> [$(date)] Delta generation for $codename completed" | tee -a "$DEBUG_LOG" - else - echo ">> [$(date)] Delta generation for $codename failed" | tee -a "$DEBUG_LOG" - fi - if [ "$DELETE_OLD_DELTAS" -gt "0" ]; then - /usr/bin/python /root/clean_up.py -n $DELETE_OLD_DELTAS -V $los_ver -N 1 "$DELTA_DIR/$codename" &>> $DEBUG_LOG - fi - cd "$source_dir" - else - # If the first build, copy the current full zip in $source_dir/delta_last/$codename/ - echo ">> [$(date)] No previous build for $codename; using current build as base for the next delta" | tee -a "$DEBUG_LOG" - mkdir -p delta_last/$codename/ &>> "$DEBUG_LOG" - find out/target/product/$codename -maxdepth 1 -name 'e-*.zip' -type f -exec cp {} "$source_dir/delta_last/$codename/" \; &>> "$DEBUG_LOG" - fi - fi - # Move produced ZIP files to the main OUT directory - echo ">> [$(date)] Moving build artifacts for $codename to '$ZIP_DIR/$zipsubdir'" | tee -a "$DEBUG_LOG" - cd out/target/product/$codename - for build in e-*.zip; do - sha256sum "$build" > "$ZIP_DIR/$zipsubdir/$build.sha256sum" - done - find . -maxdepth 1 -name 'e-*.zip*' -type f -exec mv {} "$ZIP_DIR/$zipsubdir/" \; &>> "$DEBUG_LOG" - cd "$source_dir" - build_successful=true - else - echo ">> [$(date)] Failed build for $codename" | tee -a "$DEBUG_LOG" - fi + if [ "$build_device" = false ]; then + echo ">> [$(date)] No build for ${DEVICE}" >> "$DEBUG_LOG" + continue + fi + + # Start the build + echo ">> [$(date)] Starting build for ${DEVICE}, ${BRANCH_NAME} branch" | tee -a "$DEBUG_LOG" + build_successful=false + echo "ANDROID_JACK_VM_ARGS=${ANDROID_JACK_VM_ARGS}" + if brunch ${DEVICE} &>> "$DEBUG_LOG"; then + currentdate=$(date +%Y%m%d) + if [ "$builddate" != "$currentdate" ]; then + find out/target/product/${DEVICE} -maxdepth 1 -name "e-*-$currentdate-*.zip*" -type f -exec sh /root/fix_build_date.sh {} $currentdate $builddate \; &>> "$DEBUG_LOG" + fi - # Remove old zips and logs - if [ "$DELETE_OLD_ZIPS" -gt "0" ]; then - if [ "$ZIP_SUBDIR" = true ]; then - /usr/bin/python /root/clean_up.py -n $DELETE_OLD_ZIPS -V $los_ver -N 1 "$ZIP_DIR/$zipsubdir" + if [ "$BUILD_DELTA" = true ]; then + if [ -d "delta_last/${DEVICE}/" ]; then + # If not the first build, create delta files + echo ">> [$(date)] Generating delta files for ${DEVICE}" | tee -a "$DEBUG_LOG" + cd /root/delta + if ./opendelta.sh ${DEVICE} &>> "$DEBUG_LOG"; then + echo ">> [$(date)] Delta generation for ${DEVICE} completed" | tee -a "$DEBUG_LOG" else - /usr/bin/python /root/clean_up.py -n $DELETE_OLD_ZIPS -V $los_ver -N 1 -c $codename "$ZIP_DIR" + echo ">> [$(date)] Delta generation for ${DEVICE} failed" | tee -a "$DEBUG_LOG" fi - fi - if [ "$DELETE_OLD_LOGS" -gt "0" ]; then - if [ "$LOGS_SUBDIR" = true ]; then - /usr/bin/python /root/clean_up.py -n $DELETE_OLD_LOGS -V $los_ver -N 1 "$LOGS_DIR/$logsubdir" - else - /usr/bin/python /root/clean_up.py -n $DELETE_OLD_LOGS -V $los_ver -N 1 -c $codename "$LOGS_DIR" + if [ "$DELETE_OLD_DELTAS" -gt "0" ]; then + /usr/bin/python /root/clean_up.py -n $DELETE_OLD_DELTAS -V $los_ver -N 1 "$DELTA_DIR/${DEVICE}" &>> $DEBUG_LOG fi + cd "$source_dir" + else + # If the first build, copy the current full zip in $source_dir/delta_last/${DEVICE}/ + echo ">> [$(date)] No previous build for ${DEVICE}; using current build as base for the next delta" | tee -a "$DEBUG_LOG" + mkdir -p delta_last/${DEVICE}/ &>> "$DEBUG_LOG" + find out/target/product/${DEVICE} -maxdepth 1 -name 'e-*.zip' -type f -exec cp {} "$source_dir/delta_last/${DEVICE}/" \; &>> "$DEBUG_LOG" fi - if [ -f /root/userscripts/post-build.sh ]; then - echo ">> [$(date)] Running post-build.sh for $codename" >> "$DEBUG_LOG" - /root/userscripts/post-build.sh $codename $build_successful &>> "$DEBUG_LOG" - fi - echo ">> [$(date)] Finishing build for $codename" | tee -a "$DEBUG_LOG" + fi + # Move produced ZIP files to the main OUT directory + echo ">> [$(date)] Moving build artifacts for ${DEVICE} to '$ZIP_DIR/$zipsubdir'" | tee -a "$DEBUG_LOG" + cd out/target/product/${DEVICE} + for build in e-*.zip; do + sha256sum "$build" > "$ZIP_DIR/$zipsubdir/$build.sha256sum" + done + find . -maxdepth 1 -name 'e-*.zip*' -type f -exec mv {} "$ZIP_DIR/$zipsubdir/" \; &>> "$DEBUG_LOG" + cd "$source_dir" + build_successful=true + else + echo ">> [$(date)] Failed build for ${DEVICE}" | tee -a "$DEBUG_LOG" + fi - if [ "$BUILD_OVERLAY" = true ]; then - # The Jack server must be stopped manually, as we want to unmount $TMP_DIR/merged - cd "$TMP_DIR" - if [ -f "$TMP_DIR/merged/prebuilts/sdk/tools/jack-admin" ]; then - "$TMP_DIR/merged/prebuilts/sdk/tools/jack-admin kill-server" &> /dev/null || true - fi - lsof | grep "$TMP_DIR/merged" | awk '{ print $2 }' | sort -u | xargs -r kill &> /dev/null + # Remove old zips and logs + if [ "$DELETE_OLD_ZIPS" -gt "0" ]; then + if [ "$ZIP_SUBDIR" = true ]; then + /usr/bin/python /root/clean_up.py -n $DELETE_OLD_ZIPS -V $los_ver -N 1 "$ZIP_DIR/$zipsubdir" + else + /usr/bin/python /root/clean_up.py -n $DELETE_OLD_ZIPS -V $los_ver -N 1 -c ${DEVICE} "$ZIP_DIR" + fi + fi + if [ "$DELETE_OLD_LOGS" -gt "0" ]; then + if [ "$LOGS_SUBDIR" = true ]; then + /usr/bin/python /root/clean_up.py -n $DELETE_OLD_LOGS -V $los_ver -N 1 "$LOGS_DIR/$logsubdir" + else + /usr/bin/python /root/clean_up.py -n $DELETE_OLD_LOGS -V $los_ver -N 1 -c ${DEVICE} "$LOGS_DIR" + fi + fi + if [ -f /root/userscripts/post-build.sh ]; then + echo ">> [$(date)] Running post-build.sh for ${DEVICE}" >> "$DEBUG_LOG" + /root/userscripts/post-build.sh ${DEVICE} $build_successful &>> "$DEBUG_LOG" + fi + echo ">> [$(date)] Finishing build for ${DEVICE}" | tee -a "$DEBUG_LOG" - while [ -n "$(lsof | grep $TMP_DIR/merged)" ]; do - sleep 1 - done + if [ "$BUILD_OVERLAY" = true ]; then + # The Jack server must be stopped manually, as we want to unmount $TMP_DIR/merged + cd "$TMP_DIR" + if [ -f "$TMP_DIR/merged/prebuilts/sdk/tools/jack-admin" ]; then + "$TMP_DIR/merged/prebuilts/sdk/tools/jack-admin kill-server" &> /dev/null || true + fi + lsof | grep "$TMP_DIR/merged" | awk '{ print $2 }' | sort -u | xargs -r kill &> /dev/null - umount "$TMP_DIR/merged" - fi + while [ -n "$(lsof | grep $TMP_DIR/merged)" ]; do + sleep 1 + done - if [ "$CLEAN_AFTER_BUILD" = true ]; then - echo ">> [$(date)] Cleaning source dir for device $codename" | tee -a "$DEBUG_LOG" - if [ "$BUILD_OVERLAY" = true ]; then - cd "$TMP_DIR" - rm -rf ./* - else - cd "$source_dir" - mka clean &>> "$DEBUG_LOG" - fi - fi + umount "$TMP_DIR/merged" + fi + if [ "$CLEAN_AFTER_BUILD" = true ]; then + echo ">> [$(date)] Cleaning source dir for device ${DEVICE}" | tee -a "$DEBUG_LOG" + if [ "$BUILD_OVERLAY" = true ]; then + cd "$TMP_DIR" + rm -rf ./* + else + cd "$source_dir" + mka clean &>> "$DEBUG_LOG" fi - done + fi fi -done + +fi # Create the OpenDelta's builds JSON file if ! [ -z "$OPENDELTA_BUILDS_JSON" ]; then -- GitLab From f76b96e413afa11e330024a95932e60d1e371aae Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Wed, 26 Feb 2020 11:36:25 +0100 Subject: [PATCH 07/26] Remove everything related to mirror --- Dockerfile | 9 --------- src/build.sh | 44 +------------------------------------------- 2 files changed, 1 insertion(+), 52 deletions(-) diff --git a/Dockerfile b/Dockerfile index 29b3c51..54a5c29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,6 @@ MAINTAINER Nicola Corna # Environment variables ####################### -ENV MIRROR_DIR /srv/mirror ENV SRC_DIR /srv/src ENV TMP_DIR /srv/tmp ENV CCACHE_DIR /srv/ccache @@ -44,9 +43,6 @@ ENV RELEASE_TYPE 'UNOFFICIAL' # Repo use for build ENV REPO 'https://github.com/LineageOS/android.git' -# Repo use for build -ENV MIRROR 'https://github.com/LineageOS/mirror' - # User identity ENV USER_NAME 'LineageOS Buildbot' ENV USER_MAIL 'lineageos-buildbot@docker.host' @@ -58,9 +54,6 @@ ENV INCLUDE_PROPRIETARY true # Mount an overlay filesystem over the source dir to do each build on a clean source ENV BUILD_OVERLAY false -# Clone the full LineageOS mirror (> 200 GB) -ENV LOCAL_MIRROR false - # If you want to preserve old ZIPs set this to 'false' ENV CLEAN_OUTDIR false @@ -122,7 +115,6 @@ ENV OPENDELTA_BUILDS_JSON '' # Create Volume entry points ############################ -VOLUME $MIRROR_DIR VOLUME $SRC_DIR VOLUME $TMP_DIR VOLUME $CCACHE_DIR @@ -140,7 +132,6 @@ COPY src/ /root/ # Create missing directories ############################ -RUN mkdir -p $MIRROR_DIR RUN mkdir -p $SRC_DIR RUN mkdir -p $TMP_DIR RUN mkdir -p $CCACHE_DIR diff --git a/src/build.sh b/src/build.sh index 102fab8..52ee782 100755 --- a/src/build.sh +++ b/src/build.sh @@ -35,33 +35,6 @@ fi sync_successful=true -if [ "$LOCAL_MIRROR" = true ]; then - - cd "$MIRROR_DIR" - - if [ ! -d .repo ]; then - echo ">> [$(date)] Initializing mirror repository" | tee -a "$repo_log" - yes | repo init -u "$MIRROR" --mirror --no-clone-bundle -p linux &>> "$repo_log" - fi - - # Copy local manifests to the appropriate folder in order take them into consideration - echo ">> [$(date)] Copying '$LMANIFEST_DIR/*.xml' to '.repo/local_manifests/'" - mkdir -p .repo/local_manifests - rsync -a --delete --include '*.xml' --exclude '*' "$LMANIFEST_DIR/" .repo/local_manifests/ - - rm -f .repo/local_manifests/proprietary.xml - if [ "$INCLUDE_PROPRIETARY" = true ]; then - wget -q -O .repo/local_manifests/proprietary.xml "https://raw.githubusercontent.com/TheMuppets/manifests/mirror/default.xml" - fi - - echo ">> [$(date)] Syncing mirror repository" | tee -a "$repo_log" - repo sync --force-sync --no-clone-bundle &>> "$repo_log" - - if [ $? != 0 ]; then - sync_successful=false - fi -fi - branch_dir=$(sed 's/.*-\([a-zA-Z]*\)$/\1/' <<< ${BRANCH_NAME}) branch_dir=${branch_dir^^} @@ -84,11 +57,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then done echo ">> [$(date)] (Re)initializing branch repository" | tee -a "$repo_log" - if [ "$LOCAL_MIRROR" = true ]; then - yes | repo init -u "$REPO" --reference "$MIRROR_DIR" -b "${BRANCH_NAME}" &>> "$repo_log" - else - yes | repo init -u "$REPO" -b "${BRANCH_NAME}" &>> "$repo_log" - fi + yes | repo init -u "$REPO" -b "${BRANCH_NAME}" &>> "$repo_log" # Copy local manifests to the appropriate folder in order take them into consideration echo ">> [$(date)] Copying '$LMANIFEST_DIR/*.xml' to '.repo/local_manifests/'" @@ -185,17 +154,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then # Sync the source code builddate=$currentdate - if [ "$LOCAL_MIRROR" = true ]; then - echo ">> [$(date)] Syncing mirror repository" | tee -a "$repo_log" - cd "$MIRROR_DIR" - repo sync --force-sync --no-clone-bundle &>> "$repo_log" - - if [ $? != 0 ]; then - sync_successful=false - build_device=false - fi - fi - echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log" cd "$SRC_DIR/$branch_dir" repo sync -c --force-sync &>> "$repo_log" -- GitLab From 400086e38200ac367cd35ae1b08c9f8f36788812 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Wed, 26 Feb 2020 11:44:20 +0100 Subject: [PATCH 08/26] Remove overlay --- Dockerfile | 6 ------ src/build.sh | 32 +++----------------------------- 2 files changed, 3 insertions(+), 35 deletions(-) diff --git a/Dockerfile b/Dockerfile index 54a5c29..3c19cf8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,6 @@ MAINTAINER Nicola Corna ####################### ENV SRC_DIR /srv/src -ENV TMP_DIR /srv/tmp ENV CCACHE_DIR /srv/ccache ENV ZIP_DIR /srv/zips ENV LMANIFEST_DIR /srv/local_manifests @@ -51,9 +50,6 @@ ENV USER_MAIL 'lineageos-buildbot@docker.host' # Only some branches are supported ENV INCLUDE_PROPRIETARY true -# Mount an overlay filesystem over the source dir to do each build on a clean source -ENV BUILD_OVERLAY false - # If you want to preserve old ZIPs set this to 'false' ENV CLEAN_OUTDIR false @@ -116,7 +112,6 @@ ENV OPENDELTA_BUILDS_JSON '' # Create Volume entry points ############################ VOLUME $SRC_DIR -VOLUME $TMP_DIR VOLUME $CCACHE_DIR VOLUME $ZIP_DIR VOLUME $LMANIFEST_DIR @@ -133,7 +128,6 @@ COPY src/ /root/ # Create missing directories ############################ RUN mkdir -p $SRC_DIR -RUN mkdir -p $TMP_DIR RUN mkdir -p $CCACHE_DIR RUN mkdir -p $ZIP_DIR RUN mkdir -p $LMANIFEST_DIR diff --git a/src/build.sh b/src/build.sh index 52ee782..29c0562 100755 --- a/src/build.sh +++ b/src/build.sh @@ -164,13 +164,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then fi fi - if [ "$BUILD_OVERLAY" = true ]; then - mkdir -p "$TMP_DIR/device" "$TMP_DIR/workdir" "$TMP_DIR/merged" - mount -t overlay overlay -o lowerdir="$SRC_DIR/$branch_dir",upperdir="$TMP_DIR/device",workdir="$TMP_DIR/workdir" "$TMP_DIR/merged" - source_dir="$TMP_DIR/merged" - else - source_dir="$SRC_DIR/$branch_dir" - fi + source_dir="$SRC_DIR/$branch_dir" cd "$source_dir" if [ "$ZIP_SUBDIR" = true ]; then @@ -267,30 +261,10 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then fi echo ">> [$(date)] Finishing build for ${DEVICE}" | tee -a "$DEBUG_LOG" - if [ "$BUILD_OVERLAY" = true ]; then - # The Jack server must be stopped manually, as we want to unmount $TMP_DIR/merged - cd "$TMP_DIR" - if [ -f "$TMP_DIR/merged/prebuilts/sdk/tools/jack-admin" ]; then - "$TMP_DIR/merged/prebuilts/sdk/tools/jack-admin kill-server" &> /dev/null || true - fi - lsof | grep "$TMP_DIR/merged" | awk '{ print $2 }' | sort -u | xargs -r kill &> /dev/null - - while [ -n "$(lsof | grep $TMP_DIR/merged)" ]; do - sleep 1 - done - - umount "$TMP_DIR/merged" - fi - if [ "$CLEAN_AFTER_BUILD" = true ]; then echo ">> [$(date)] Cleaning source dir for device ${DEVICE}" | tee -a "$DEBUG_LOG" - if [ "$BUILD_OVERLAY" = true ]; then - cd "$TMP_DIR" - rm -rf ./* - else - cd "$source_dir" - mka clean &>> "$DEBUG_LOG" - fi + cd "$source_dir" + mka clean &>> "$DEBUG_LOG" fi fi -- GitLab From 29680a3cfe083b147caf73c6bdfaa830c6d43c03 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Wed, 26 Feb 2020 11:54:20 +0100 Subject: [PATCH 09/26] Rebrand to /e/ --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3c19cf8..785fd76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,11 +28,11 @@ ENV USE_CCACHE 1 # for no limit. ENV CCACHE_SIZE 50G -# Environment for the LineageOS branches name +# Environment for the /e/ branches name # See https://github.com/LineageOS/android_vendor_cm/branches for possible options ENV BRANCH_NAME 'v1-pie' -# Environment for the device list (separate by comma if more than one) +# Environment for the device # eg. DEVICE=hammerhead ENV DEVICE '' @@ -40,11 +40,11 @@ ENV DEVICE '' ENV RELEASE_TYPE 'UNOFFICIAL' # Repo use for build -ENV REPO 'https://github.com/LineageOS/android.git' +ENV REPO 'https://gitlab.e.foundation/e/os/android.git' # User identity -ENV USER_NAME 'LineageOS Buildbot' -ENV USER_MAIL 'lineageos-buildbot@docker.host' +ENV USER_NAME '/e/ robot' +ENV USER_MAIL 'erobot@e.email' # Include proprietary files, downloaded automatically from github.com/TheMuppets/ # Only some branches are supported -- GitLab From 2cfb0fc67a672504ee555470499622b58f26302a Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Wed, 26 Feb 2020 11:54:35 +0100 Subject: [PATCH 10/26] Remove SU --- Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 785fd76..3a6795c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -61,9 +61,6 @@ ENV CRONTAB_TIME 'now' # Clean artifacts output after each build ENV CLEAN_AFTER_BUILD true -# Provide root capabilities builtin inside the ROM (see http://lineageos.org/Update-and-Build-Prep/) -ENV WITH_SU false - # Provide a default JACK configuration in order to avoid out-of-memory issues ENV ANDROID_JACK_VM_ARGS "-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G" -- GitLab From f9807c9eb12d35e6542bfa9521680e0a609f47d1 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Wed, 26 Feb 2020 16:23:43 +0100 Subject: [PATCH 11/26] Remove the jack server memory --- src/init.sh | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/init.sh b/src/init.sh index 3c6ae12..57656d5 100755 --- a/src/init.sh +++ b/src/init.sh @@ -57,18 +57,6 @@ if [ "$SIGN_BUILDS" = true ]; then done fi -# Define memory to use for jack (depending of runner tag) -if [[ -n ${CI_RUNNER_TAGS} ]] -then - jack_memory=$(echo ${CI_RUNNER_TAGS} | grep GB | sed 's/.*ram:\([0-9]*G\)B.*/\1/') - if [ -n ${jack_memory} ] - then - ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx"${jack_memory} - export ANDROID_JACK_VM_ARGS - echo "ANDROID_JACK_VM_ARGS set to ${ANDROID_JACK_VM_ARGS}" - fi -fi - if [ "$CRONTAB_TIME" = "now" ]; then /root/build.sh else -- GitLab From 072f307a07efff9396de6a5ce9f96d7457ea372e Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Wed, 26 Feb 2020 16:25:09 +0100 Subject: [PATCH 12/26] Use python3 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3a6795c..1d9da5b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -149,7 +149,7 @@ RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt cron \ lib32ncurses5-dev lib32readline-dev lib32z1-dev libesd0-dev liblz4-tool \ libncurses5-dev libsdl1.2-dev libssl-dev libxml2 \ libxml2-utils lsof lzop maven pngcrush \ - procps python rsync schedtool squashfs-tools wget xdelta3 xsltproc yasm \ + procps python3 rsync schedtool squashfs-tools wget xdelta3 xsltproc yasm \ zip zlib1g-dev RUN curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo -- GitLab From 26443acc3449368aed25efe7d0d517336ec1204b Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Wed, 26 Feb 2020 16:51:18 +0100 Subject: [PATCH 13/26] Try to use the last version of Debian to get last version of python --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1d9da5b..345da83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:stretch +FROM debian:buster MAINTAINER Nicola Corna # Environment variables -- GitLab From 47d7769508855093ba059819e19327c8af10cdb3 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Wed, 26 Feb 2020 17:18:24 +0100 Subject: [PATCH 14/26] Use java 11 --- Dockerfile | 2 +- src/build.sh | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 345da83..d461200 100644 --- a/Dockerfile +++ b/Dockerfile @@ -137,7 +137,7 @@ RUN mkdir -p $USERSCRIPTS_DIR ############################ COPY apt_preferences /etc/apt/preferences RUN apt-get -qq update -RUN apt-get install -y imagemagick libwxgtk3.0-dev openjdk-8-jdk +RUN apt-get install -y imagemagick libwxgtk3.0-dev openjdk-11-jdk RUN echo 'deb http://deb.debian.org/debian sid main' >> /etc/apt/sources.list RUN echo 'deb http://deb.debian.org/debian experimental main' >> /etc/apt/sources.list diff --git a/src/build.sh b/src/build.sh index 29c0562..ecab078 100755 --- a/src/build.sh +++ b/src/build.sh @@ -125,15 +125,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then sed -i "1s;^;PRODUCT_DEFAULT_DEV_CERTIFICATE := user-keys/releasekey\nPRODUCT_OTA_PUBLIC_KEYS := user-keys/releasekey\nPRODUCT_EXTRA_RECOVERY_KEYS := user-keys/releasekey\n\n;" "vendor/$vendor/config/common.mk" fi - if [ "$android_version_major" -ge "7" ]; then - jdk_version=8 - elif [ "$android_version_major" -ge "5" ]; then - jdk_version=7 - else - echo ">> [$(date)] ERROR: ${BRANCH_NAME} requires a JDK version too old (< 7); aborting" - exit 1 - fi - echo ">> [$(date)] Using OpenJDK $jdk_version" update-java-alternatives -s java-1.$jdk_version.0-openjdk-amd64 &> /dev/null -- GitLab From 59624b9cc4288afb391489fd17ce636d31c4323f Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Thu, 27 Feb 2020 09:27:39 +0100 Subject: [PATCH 15/26] Update packages for debian:buster --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d461200..03bb12e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -146,8 +146,8 @@ RUN apt-get -qqy upgrade RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt cron \ curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick kmod \ - lib32ncurses5-dev lib32readline-dev lib32z1-dev libesd0-dev liblz4-tool \ - libncurses5-dev libsdl1.2-dev libssl-dev libxml2 \ + lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool \ + libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 \ libxml2-utils lsof lzop maven pngcrush \ procps python3 rsync schedtool squashfs-tools wget xdelta3 xsltproc yasm \ zip zlib1g-dev -- GitLab From 662f7a57cca69ec8d749c1ae189b3e371b75e047 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 16 Mar 2020 08:06:34 +0100 Subject: [PATCH 16/26] Symbolic link to run python --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 03bb12e..dc17a21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -154,6 +154,7 @@ RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt cron \ RUN curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo RUN chmod a+x /usr/local/bin/repo +RUN ln -s /usr/bin/python3 /usr/bin/python # Download and build delta tools ################################ -- GitLab From 0f6af60ac6025325af859a1197689cde12b607ee Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 16 Mar 2020 08:10:08 +0100 Subject: [PATCH 17/26] Use only 1 job --- .gitlab-ci.yml | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7366edb..44636f3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ variables: DOCKER_DRIVER: overlay2 CONTAINER_IMAGE: registry.gitlab.e.foundation:5000/$CI_PROJECT_PATH -.build_image: +build_image: stage: build image: docker:git services: @@ -16,19 +16,4 @@ variables: - "docker build --cache-from $CONTAINER_IMAGE:$IMAGE_TAG -t $CONTAINER_IMAGE -t $CONTAINER_IMAGE:$IMAGE_TAG -t $CONTAINER_IMAGE:$IMAGE_TAG_RELEASE ." - "docker push $CONTAINER_IMAGE:$IMAGE_TAG" - 'if [ "${CI_COMMIT_REF_NAME}" = master ] ; then docker push $CONTAINER_IMAGE:$IMAGE_TAG_RELEASE ; fi' - -build_prod: - extends: .build_image - after_script: - 'if [ "${CI_COMMIT_REF_NAME}" = master ] ; then docker push $CONTAINER_IMAGE:latest ; fi' - variables: - IMAGE_TAG: $CI_COMMIT_REF_NAME - IMAGE_TAG_RELEASE: prod - -build_debug: - extends: .build_image - before_script: - - "mv build.dev.sh src/build.sh" - variables: - IMAGE_TAG: $CI_COMMIT_REF_NAME-debug - IMAGE_TAG_RELEASE: debug -- GitLab From 4102af6869eb88c6b4a91a1130d932d1e556a581 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 16 Mar 2020 08:27:09 +0100 Subject: [PATCH 18/26] Add missing variables --- .gitlab-ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 44636f3..f4e0c66 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,11 +5,14 @@ variables: DOCKER_DRIVER: overlay2 CONTAINER_IMAGE: registry.gitlab.e.foundation:5000/$CI_PROJECT_PATH -build_image: +.build_image: stage: build image: docker:git services: - docker:18-dind + variables: + IMAGE_TAG: $CI_COMMIT_REF_NAME + IMAGE_TAG_RELEASE: prod script: - "docker pull $CONTAINER_IMAGE:$IMAGE_TAG || true" - "docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.e.foundation:5000" -- GitLab From 96cb1d7a6bf9d4dcec01789897531179f4e165b5 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 16 Mar 2020 08:27:49 +0100 Subject: [PATCH 19/26] Fix syntax issue --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f4e0c66..40afd9b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ variables: DOCKER_DRIVER: overlay2 CONTAINER_IMAGE: registry.gitlab.e.foundation:5000/$CI_PROJECT_PATH -.build_image: +build_image: stage: build image: docker:git services: -- GitLab From a9bf2a77cc9f4f377884827f8485329bcbb07936 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 16 Mar 2020 08:44:42 +0100 Subject: [PATCH 20/26] Remove log files --- src/build.sh | 60 ++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/src/build.sh b/src/build.sh index ecab078..2353332 100755 --- a/src/build.sh +++ b/src/build.sh @@ -17,8 +17,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -repo_log="$LOGS_DIR/repo-$(date +%Y%m%d).log" - # cd to working directory cd "$SRC_DIR" @@ -56,8 +54,8 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then fi done - echo ">> [$(date)] (Re)initializing branch repository" | tee -a "$repo_log" - yes | repo init -u "$REPO" -b "${BRANCH_NAME}" &>> "$repo_log" + echo ">> [$(date)] (Re)initializing branch repository" + yes | repo init -u "$REPO" -b "${BRANCH_NAME}" # Copy local manifests to the appropriate folder in order take them into consideration echo ">> [$(date)] Copying '$LMANIFEST_DIR/*.xml' to '.repo/local_manifests/'" @@ -82,9 +80,9 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then wget -q -O .repo/local_manifests/proprietary.xml "https://raw.githubusercontent.com/TheMuppets/manifests/$themuppets_branch/muppets.xml" fi - echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log" + echo ">> [$(date)] Syncing branch repository" builddate=$(date +%Y%m%d) - repo sync -c --force-sync &>> "$repo_log" + repo sync -c --force-sync if [ $? != 0 ]; then sync_successful=false @@ -145,9 +143,9 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then # Sync the source code builddate=$currentdate - echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log" + echo ">> [$(date)] Syncing branch repository" cd "$SRC_DIR/$branch_dir" - repo sync -c --force-sync &>> "$repo_log" + repo sync -c --force-sync if [ $? != 0 ]; then sync_successful=false @@ -171,11 +169,9 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then logsubdir= fi - DEBUG_LOG="$LOGS_DIR/$logsubdir/eelo-$los_ver-$builddate-$RELEASE_TYPE-${DEVICE}.log" - if [ -f /root/userscripts/pre-build.sh ]; then - echo ">> [$(date)] Running pre-build.sh for ${DEVICE}" >> "$DEBUG_LOG" - /root/userscripts/pre-build.sh ${DEVICE} &>> "$DEBUG_LOG" + echo ">> [$(date)] Running pre-build.sh for ${DEVICE}" + /root/userscripts/pre-build.sh ${DEVICE} if [ $? != 0 ]; then build_device=false @@ -183,52 +179,52 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then fi if [ "$build_device" = false ]; then - echo ">> [$(date)] No build for ${DEVICE}" >> "$DEBUG_LOG" + echo ">> [$(date)] No build for ${DEVICE}" continue fi # Start the build - echo ">> [$(date)] Starting build for ${DEVICE}, ${BRANCH_NAME} branch" | tee -a "$DEBUG_LOG" + echo ">> [$(date)] Starting build for ${DEVICE}, ${BRANCH_NAME} branch" build_successful=false echo "ANDROID_JACK_VM_ARGS=${ANDROID_JACK_VM_ARGS}" - if brunch ${DEVICE} &>> "$DEBUG_LOG"; then + if brunch ${DEVICE}; then currentdate=$(date +%Y%m%d) if [ "$builddate" != "$currentdate" ]; then - find out/target/product/${DEVICE} -maxdepth 1 -name "e-*-$currentdate-*.zip*" -type f -exec sh /root/fix_build_date.sh {} $currentdate $builddate \; &>> "$DEBUG_LOG" + find out/target/product/${DEVICE} -maxdepth 1 -name "e-*-$currentdate-*.zip*" -type f -exec sh /root/fix_build_date.sh {} $currentdate $builddate \; fi if [ "$BUILD_DELTA" = true ]; then if [ -d "delta_last/${DEVICE}/" ]; then # If not the first build, create delta files - echo ">> [$(date)] Generating delta files for ${DEVICE}" | tee -a "$DEBUG_LOG" + echo ">> [$(date)] Generating delta files for ${DEVICE}" cd /root/delta - if ./opendelta.sh ${DEVICE} &>> "$DEBUG_LOG"; then - echo ">> [$(date)] Delta generation for ${DEVICE} completed" | tee -a "$DEBUG_LOG" + if ./opendelta.sh ${DEVICE}; then + echo ">> [$(date)] Delta generation for ${DEVICE} completed" else - echo ">> [$(date)] Delta generation for ${DEVICE} failed" | tee -a "$DEBUG_LOG" + echo ">> [$(date)] Delta generation for ${DEVICE} failed" fi if [ "$DELETE_OLD_DELTAS" -gt "0" ]; then - /usr/bin/python /root/clean_up.py -n $DELETE_OLD_DELTAS -V $los_ver -N 1 "$DELTA_DIR/${DEVICE}" &>> $DEBUG_LOG + /usr/bin/python /root/clean_up.py -n $DELETE_OLD_DELTAS -V $los_ver -N 1 "$DELTA_DIR/${DEVICE}" fi cd "$source_dir" else # If the first build, copy the current full zip in $source_dir/delta_last/${DEVICE}/ - echo ">> [$(date)] No previous build for ${DEVICE}; using current build as base for the next delta" | tee -a "$DEBUG_LOG" - mkdir -p delta_last/${DEVICE}/ &>> "$DEBUG_LOG" - find out/target/product/${DEVICE} -maxdepth 1 -name 'e-*.zip' -type f -exec cp {} "$source_dir/delta_last/${DEVICE}/" \; &>> "$DEBUG_LOG" + echo ">> [$(date)] No previous build for ${DEVICE}; using current build as base for the next delta" + mkdir -p delta_last/${DEVICE}/ + find out/target/product/${DEVICE} -maxdepth 1 -name 'e-*.zip' -type f -exec cp {} "$source_dir/delta_last/${DEVICE}/" \; fi fi # Move produced ZIP files to the main OUT directory - echo ">> [$(date)] Moving build artifacts for ${DEVICE} to '$ZIP_DIR/$zipsubdir'" | tee -a "$DEBUG_LOG" + echo ">> [$(date)] Moving build artifacts for ${DEVICE} to '$ZIP_DIR/$zipsubdir'" cd out/target/product/${DEVICE} for build in e-*.zip; do sha256sum "$build" > "$ZIP_DIR/$zipsubdir/$build.sha256sum" done - find . -maxdepth 1 -name 'e-*.zip*' -type f -exec mv {} "$ZIP_DIR/$zipsubdir/" \; &>> "$DEBUG_LOG" + find . -maxdepth 1 -name 'e-*.zip*' -type f -exec mv {} "$ZIP_DIR/$zipsubdir/" \; cd "$source_dir" build_successful=true else - echo ">> [$(date)] Failed build for ${DEVICE}" | tee -a "$DEBUG_LOG" + echo ">> [$(date)] Failed build for ${DEVICE}" fi # Remove old zips and logs @@ -247,15 +243,15 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then fi fi if [ -f /root/userscripts/post-build.sh ]; then - echo ">> [$(date)] Running post-build.sh for ${DEVICE}" >> "$DEBUG_LOG" - /root/userscripts/post-build.sh ${DEVICE} $build_successful &>> "$DEBUG_LOG" + echo ">> [$(date)] Running post-build.sh for ${DEVICE}" + /root/userscripts/post-build.sh ${DEVICE} $build_successful fi - echo ">> [$(date)] Finishing build for ${DEVICE}" | tee -a "$DEBUG_LOG" + echo ">> [$(date)] Finishing build for ${DEVICE}" if [ "$CLEAN_AFTER_BUILD" = true ]; then - echo ">> [$(date)] Cleaning source dir for device ${DEVICE}" | tee -a "$DEBUG_LOG" + echo ">> [$(date)] Cleaning source dir for device ${DEVICE}" cd "$source_dir" - mka clean &>> "$DEBUG_LOG" + mka clean fi fi -- GitLab From 9dec0d93efc4e5c1a85ecbb98224742f1fa30caa Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 16 Mar 2020 09:52:19 +0100 Subject: [PATCH 21/26] Switch between python 2 and 3 --- Dockerfile | 4 ++-- src/build.sh | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index dc17a21..9093a99 100644 --- a/Dockerfile +++ b/Dockerfile @@ -149,12 +149,12 @@ RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt cron \ lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool \ libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 \ libxml2-utils lsof lzop maven pngcrush \ - procps python3 rsync schedtool squashfs-tools wget xdelta3 xsltproc yasm \ + procps python python3 rsync schedtool squashfs-tools wget xdelta3 xsltproc yasm \ zip zlib1g-dev RUN curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo RUN chmod a+x /usr/local/bin/repo -RUN ln -s /usr/bin/python3 /usr/bin/python +RUN ln -fs /usr/bin/python3 /usr/bin/python # Download and build delta tools ################################ diff --git a/src/build.sh b/src/build.sh index 2353332..ca6c7e5 100755 --- a/src/build.sh +++ b/src/build.sh @@ -187,6 +187,8 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then echo ">> [$(date)] Starting build for ${DEVICE}, ${BRANCH_NAME} branch" build_successful=false echo "ANDROID_JACK_VM_ARGS=${ANDROID_JACK_VM_ARGS}" + echo "Switch to Python2" + ln -fs /usr/bin/python2 /usr/bin/python if brunch ${DEVICE}; then currentdate=$(date +%Y%m%d) if [ "$builddate" != "$currentdate" ]; then @@ -256,6 +258,9 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then fi + echo "Switch back to Python3" + ln -fs /usr/bin/python3 /usr/bin/python + fi # Create the OpenDelta's builds JSON file -- GitLab From d32a07bb4dda99183c52206fd6a5f763568c3bba Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 16 Mar 2020 10:38:08 +0100 Subject: [PATCH 22/26] Add libtinfo5 library --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9093a99..966a3b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -146,7 +146,7 @@ RUN apt-get -qqy upgrade RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt cron \ curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick kmod \ - lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool \ + lib32ncurses5-dev lib32readline-dev lib32z1-dev libtinfo5 liblz4-tool \ libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 \ libxml2-utils lsof lzop maven pngcrush \ procps python python3 rsync schedtool squashfs-tools wget xdelta3 xsltproc yasm \ -- GitLab From e34bdf7fd3f610477e092beac5af416accbe4429 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 16 Mar 2020 10:50:09 +0100 Subject: [PATCH 23/26] Add missing libncurses5 (?) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 966a3b0..d72cae3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -146,7 +146,7 @@ RUN apt-get -qqy upgrade RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt cron \ curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick kmod \ - lib32ncurses5-dev lib32readline-dev lib32z1-dev libtinfo5 liblz4-tool \ + lib32ncurses5-dev libncurses5 lib32readline-dev lib32z1-dev libtinfo5 liblz4-tool \ libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 \ libxml2-utils lsof lzop maven pngcrush \ procps python python3 rsync schedtool squashfs-tools wget xdelta3 xsltproc yasm \ -- GitLab From 15bd02f5ff043a91692e6195d2ae1d7573f1e860 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 16 Mar 2020 17:48:02 +0100 Subject: [PATCH 24/26] Use OpenJDK 8 (from adoptopenjdk.net) --- Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index d72cae3..0f3228d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -136,20 +136,22 @@ RUN mkdir -p $USERSCRIPTS_DIR # Install build dependencies ############################ COPY apt_preferences /etc/apt/preferences -RUN apt-get -qq update -RUN apt-get install -y imagemagick libwxgtk3.0-dev openjdk-11-jdk + +# Add adoptopenjdk.net repository, because openjdk8 is not available on debian:buster +RUN wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add - +RUN add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ RUN echo 'deb http://deb.debian.org/debian sid main' >> /etc/apt/sources.list RUN echo 'deb http://deb.debian.org/debian experimental main' >> /etc/apt/sources.list RUN apt-get -qq update RUN apt-get -qqy upgrade -RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt cron \ +RUN apt-get install -y adoptopenjdk-8-hotspot bc bison bsdmainutils build-essential ccache cgpt cron \ curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick kmod \ lib32ncurses5-dev libncurses5 lib32readline-dev lib32z1-dev libtinfo5 liblz4-tool \ libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 \ libxml2-utils lsof lzop maven pngcrush \ - procps python python3 rsync schedtool squashfs-tools wget xdelta3 xsltproc yasm \ + procps python python3 rsync schedtool squashfs-tools software-properties-common wget xdelta3 xsltproc yasm \ zip zlib1g-dev RUN curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo -- GitLab From 7a7bfd4d105951a16d234fd97cb561acc644b5e9 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 16 Mar 2020 17:53:05 +0100 Subject: [PATCH 25/26] Fix adoptopenjdk process --- Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0f3228d..1545896 100644 --- a/Dockerfile +++ b/Dockerfile @@ -137,16 +137,12 @@ RUN mkdir -p $USERSCRIPTS_DIR ############################ COPY apt_preferences /etc/apt/preferences -# Add adoptopenjdk.net repository, because openjdk8 is not available on debian:buster -RUN wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add - -RUN add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ - RUN echo 'deb http://deb.debian.org/debian sid main' >> /etc/apt/sources.list RUN echo 'deb http://deb.debian.org/debian experimental main' >> /etc/apt/sources.list RUN apt-get -qq update RUN apt-get -qqy upgrade -RUN apt-get install -y adoptopenjdk-8-hotspot bc bison bsdmainutils build-essential ccache cgpt cron \ +RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt cron \ curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick kmod \ lib32ncurses5-dev libncurses5 lib32readline-dev lib32z1-dev libtinfo5 liblz4-tool \ libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 \ @@ -158,6 +154,11 @@ RUN curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin RUN chmod a+x /usr/local/bin/repo RUN ln -fs /usr/bin/python3 /usr/bin/python +# Use adoptopenjdk.net to be able to use OpeJDK8 on debian:buster +RUN curl -q https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add - +RUN add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ +RUN apt-get -qq update && apt-get install -y adoptopenjdk-8-hotspot + # Download and build delta tools ################################ RUN cd /root/ && \ -- GitLab From 84d3f38cfdc8d60368277ab8b8992fbc64d83630 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 16 Mar 2020 19:17:11 +0100 Subject: [PATCH 26/26] Set the java version used --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 1545896..c5545f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -158,6 +158,7 @@ RUN ln -fs /usr/bin/python3 /usr/bin/python RUN curl -q https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add - RUN add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ RUN apt-get -qq update && apt-get install -y adoptopenjdk-8-hotspot +RUN update-alternatives --set java /usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin/java # Download and build delta tools ################################ -- GitLab