From c3478c335294ade3032b67ba0a967aff8edafa1a Mon Sep 17 00:00:00 2001 From: Nicola Corna Date: Wed, 21 Aug 2019 10:00:45 +0200 Subject: [PATCH 01/29] Remove openjdk-7 OpenJDK 7 was previously taken from the Debian experimental repo, but is has been removed. OpenJDK 7 is needed to build LineageOS/Cyanogenmod 11.0-13.0, so support for those version is dropped. --- Dockerfile | 8 ++------ src/build.sh | 17 +++++------------ 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4e0f838..5a031a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -161,9 +161,6 @@ RUN mkdir -p $USERSCRIPTS_DIR # Install build dependencies ############################ -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 -COPY apt_preferences /etc/apt/preferences RUN apt-get -qq update RUN apt-get -qqy upgrade @@ -171,9 +168,8 @@ 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 libwxgtk3.0-dev libxml2 \ - libxml2-utils lsof lzop maven openjdk-7-jdk openjdk-8-jdk pngcrush \ - procps python rsync schedtool squashfs-tools wget xdelta3 xsltproc yasm \ - zip zlib1g-dev + libxml2-utils lsof lzop maven openjdk-8-jdk pngcrush procps python 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 diff --git a/src/build.sh b/src/build.sh index 5c92bb7..84604f1 100755 --- a/src/build.sh +++ b/src/build.sh @@ -146,6 +146,11 @@ for branch in ${BRANCH_NAME//,/ }; do fi android_version_major=$(cut -d '.' -f 1 <<< $android_version) + if [ "$android_version_major" -lt "7" ]; then + echo ">> [$(date)] ERROR: $branch requires a JDK version too old (< 8); aborting" + exit 1 + fi + if [ "$android_version_major" -ge "8" ]; then vendor="lineage" else @@ -234,18 +239,6 @@ for branch in ${BRANCH_NAME//,/ }; do 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 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 - # Prepare the environment echo ">> [$(date)] Preparing build environment" source build/envsetup.sh > /dev/null -- GitLab From 481aefe6de349bb42a57fe8789f4cb2eedb313ba Mon Sep 17 00:00:00 2001 From: Nicola Corna Date: Wed, 21 Aug 2019 10:24:13 +0200 Subject: [PATCH 02/29] Update default branch from cm-14.1 to lineage-16.0 Also adjust the examples in the README. --- Dockerfile | 2 +- README.md | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5a031a5..aa60eae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,7 @@ 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 'lineage-16.0' # Environment for the device list (separate by comma if more than one) # eg. DEVICE_LIST=hammerhead,bullhead,angler diff --git a/README.md b/README.md index 1c5fca3..f5eb517 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ TL;DR - go to the [Examples](#examples) The two fundamental settings are: - * `BRANCH_NAME (cm-14.1)`: LineageOS branch, see the branch list + * `BRANCH_NAME (lineage-16.0)`: LineageOS branch, see the branch list [here][los-branches] (multiple comma-separated branches can be specified) * `DEVICE_LIST`: comma-separated list of devices to build @@ -161,12 +161,12 @@ When `LOCAL_MIRROR` is `true`: ## Examples -### Build for thea (cm-14.1, officially supported), test keys, no patches +### Build for bacon (lineage-16.0, officially supported), test keys, no patches ``` docker run \ - -e "BRANCH_NAME=cm-14.1" \ - -e "DEVICE_LIST=thea" \ + -e "BRANCH_NAME=lineage-16.0" \ + -e "DEVICE_LIST=bacon" \ -v "/home/user/lineage:/srv/src" \ -v "/home/user/zips:/srv/zips" \ -v "/home/user/logs:/srv/logs" \ @@ -174,12 +174,12 @@ docker run \ lineageos4microg/docker-lineage-cicd ``` -### Build for dumpling (lineage-15.1, officially supported), custom keys, restricted signature spoofing with integrated microG and FDroid +### Build for angler (lineage-15.1, officially supported), custom keys, restricted signature spoofing with integrated microG and FDroid ``` docker run \ -e "BRANCH_NAME=lineage-15.1" \ - -e "DEVICE_LIST=dumpling" \ + -e "DEVICE_LIST=angler" \ -e "SIGN_BUILDS=true" \ -e "SIGNATURE_SPOOFING=restricted" \ -e "CUSTOM_PACKAGES=GmsCore GsfProxy FakeStore MozillaNlpBackend NominatimNlpBackend com.google.android.maps.jar FDroid FDroidPrivilegedExtension " \ @@ -209,13 +209,13 @@ it ends with `.xml`) in the `/home/user/manifests` folder with this content: ``` -### Build for four devices on cm-14.1 and lineage-15.1 (officially supported), custom keys, restricted signature spoofing with integrated microG and FDroid, custom OTA server +### Build for four devices on lineage-15.1 and lineage-16.0 (officially supported), custom keys, restricted signature spoofing with integrated microG and FDroid, custom OTA server ``` docker run \ - -e "BRANCH_NAME=cm-14.1,lineage-15.1" \ - -e "DEVICE_LIST_CM_14_1=onyx,thea" \ - -e "DEVICE_LIST_LINEAGE_15_1=cheeseburger,dumpling" \ + -e "BRANCH_NAME=lineage-15.1,lineage-16.0" \ + -e "DEVICE_LIST_LINEAGE_15_1=angler,oneplus2" \ + -e "DEVICE_LIST_LINEAGE_16_0=bacon,dumpling" \ -e "SIGN_BUILDS=true" \ -e "SIGNATURE_SPOOFING=restricted" \ -e "CUSTOM_PACKAGES=GmsCore GsfProxy FakeStore MozillaNlpBackend NominatimNlpBackend com.google.android.maps.jar FDroid FDroidPrivilegedExtension " \ @@ -313,4 +313,3 @@ docker run \ [a6000-xda]: https://forum.xda-developers.com/lenovo-a6000/development/rom-lineageos-15-1-t3733747 [a6000-device-tree-deps]: https://github.com/dev-harsh1998/android_device_lenovo_a6000/blob/lineage-15.1/lineage.dependencies [a6000-common-tree-deps]: https://github.com/dev-harsh1998/android_device_lenovo_msm8916-common/blob/lineage-15.1/lineage.dependencies - -- GitLab From c732a03857a1fccb664a29e76fdff3150db4695b Mon Sep 17 00:00:00 2001 From: Milan Date: Sun, 15 Sep 2019 02:51:16 +0200 Subject: [PATCH 03/29] Add clang Some devices need clang to build successfully --- Dockerfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index aa60eae..6508932 100644 --- a/Dockerfile +++ b/Dockerfile @@ -164,12 +164,13 @@ RUN mkdir -p $USERSCRIPTS_DIR RUN apt-get -qq update 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 libwxgtk3.0-dev libxml2 \ - libxml2-utils lsof lzop maven openjdk-8-jdk pngcrush procps python rsync \ - schedtool squashfs-tools wget xdelta3 xsltproc yasm zip zlib1g-dev +RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt clang \ + 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 libwxgtk3.0-dev \ + libxml2 libxml2-utils lsof lzop maven openjdk-8-jdk pngcrush procps \ + python 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 -- GitLab From e724032a86cfd469b97c82027a7617a83149f05e Mon Sep 17 00:00:00 2001 From: Nicola Corna Date: Mon, 30 Sep 2019 17:32:28 +0200 Subject: [PATCH 04/29] Add gitlab.com/the-muppets as additional source for proprietary files Manifests can not be used as-is, as they have some incompatibilities (like the re-define of the already existing "gitlab" remote) with the build system. --- Dockerfile | 4 +-- README.md | 4 ++- src/build.sh | 5 +++- src/build_manifest.py | 60 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 4 deletions(-) create mode 100755 src/build_manifest.py diff --git a/Dockerfile b/Dockerfile index aa60eae..f7fdf68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,7 +49,7 @@ ENV OTA_URL '' ENV USER_NAME 'LineageOS Buildbot' ENV USER_MAIL 'lineageos-buildbot@docker.host' -# Include proprietary files, downloaded automatically from github.com/TheMuppets/ +# Include proprietary files, downloaded automatically from github.com/TheMuppets/ and gitlab.com/the-muppets/ # Only some branches are supported ENV INCLUDE_PROPRIETARY true @@ -123,7 +123,7 @@ ENV OPENDELTA_BUILDS_JSON '' # You can optionally specify a USERSCRIPTS_DIR volume containing these scripts: # * begin.sh, run at the very beginning # * before.sh, run after the syncing and patching, before starting the builds -# * pre-build.sh, run before the build of every device +# * pre-build.sh, run before the build of every device # * post-build.sh, run after the build of every device # * end.sh, run at the very end # Each script will be run in $SRC_DIR and must be owned and writeable only by diff --git a/README.md b/README.md index f5eb517..5bf46da 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,8 @@ three ways: * by [pulling them from a running LineageOS][blobs-pull] * by [extracting them from a LineageOS ZIP][blobs-extract] - * by downloading them from [TheMuppets repos][blobs-themuppets] (unofficial) + * by downloading them from TheMuppets [GitHub][blobs-themuppets] and + [GitLab][blobs-the-muppets] repositories (unofficial) The third way is the easiest one and is enabled by default; if you're OK with that just move on, otherwise set `INCLUDE_PROPRIETARY (true)` to `false` and @@ -306,6 +307,7 @@ docker run \ [blobs-pull]: https://wiki.lineageos.org/devices/bacon/build#extract-proprietary-blobs [blobs-extract]: https://wiki.lineageos.org/extracting_blobs_from_zips.html [blobs-themuppets]: https://github.com/TheMuppets/manifests +[blobs-the-muppets]: https://gitlab.com/the-muppets/manifest [lineageota]: https://github.com/julianxhokaxhiu/LineageOTA [los-extras]: https://download.lineageos.org/extras [dockerfile]: Dockerfile diff --git a/src/build.sh b/src/build.sh index 84604f1..c6f089f 100755 --- a/src/build.sh +++ b/src/build.sh @@ -70,6 +70,8 @@ if [ "$LOCAL_MIRROR" = true ]; then 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" + /root/build_manifest.py --remote "https://gitlab.com" --remotename "gitlab_https" \ + "https://gitlab.com/the-muppets/manifest/raw/mirror/default.xml" .repo/local_manifests/proprietary_gitlab.xml fi echo ">> [$(date)] Syncing mirror repository" | tee -a "$repo_log" @@ -127,6 +129,8 @@ for branch in ${BRANCH_NAME//,/ }; do 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" + /root/build_manifest.py --remote "https://gitlab.com" --remotename "gitlab_https" \ + "https://gitlab.com/the-muppets/manifest/raw/$themuppets_branch/muppets.xml" .repo/local_manifests/proprietary_gitlab.xml fi echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log" @@ -409,4 +413,3 @@ if [ -f /root/userscripts/end.sh ]; then echo ">> [$(date)] Running end.sh" /root/userscripts/end.sh fi - diff --git a/src/build_manifest.py b/src/build_manifest.py new file mode 100755 index 0000000..d24af59 --- /dev/null +++ b/src/build_manifest.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# +# Copyright (C) 2019 Nicola Corna +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from xml.dom import minidom +import xml.etree.ElementTree as ET +import argparse + +try: + from urllib.request import urlopen +except ImportError: + from urllib2 import urlopen + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='Build an Android repo manifest') + parser.add_argument('url', type=str, help='URL of the source manifest') + parser.add_argument('out', type=str, help='Output path') + parser.add_argument('--remote', type=str, help='Remote URL') + parser.add_argument('--remotename', type=str, help='Remote name') + + args = parser.parse_args() + + source_manifest = urlopen(args.url).read() + + xmlin = ET.fromstring(source_manifest) + xmlout = ET.Element("manifest") + + if args.remote: + ET.SubElement(xmlout, 'remote', attrib={"name": args.remotename, + "fetch": args.remote}) + + for child in xmlin: + if child.tag == "project": + attributes = {} + attributes["name"] = child.attrib["name"] + + if "path" in child.attrib: + attributes["path"] = child.attrib["path"] + + if args.remote: + attributes["remote"] = args.remotename + + ET.SubElement(xmlout, 'project', attrib=attributes) + + xmlstr = minidom.parseString(ET.tostring(xmlout)).toprettyxml(indent=" ", encoding="UTF-8") + with open(args.out, "w") as f: + f.write(xmlstr) -- GitLab From 1f9f92e22fc0a91cfe8bc8770da32587c7e98df4 Mon Sep 17 00:00:00 2001 From: Evan Goode Date: Sat, 11 Apr 2020 10:14:54 -0400 Subject: [PATCH 05/29] Send some User-Agent other than "Python-urllib" Looks like GitLab is using CloudFlare to block requests of raw files from user agents matching "Python-urllib*". So we'll just send a generic browser user agent instead. --- src/build_manifest.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/build_manifest.py b/src/build_manifest.py index d24af59..32f9411 100755 --- a/src/build_manifest.py +++ b/src/build_manifest.py @@ -20,9 +20,9 @@ import xml.etree.ElementTree as ET import argparse try: - from urllib.request import urlopen + from urllib.request import urlopen, Request except ImportError: - from urllib2 import urlopen + from urllib2 import urlopen, Request if __name__ == "__main__": parser = argparse.ArgumentParser(description='Build an Android repo manifest') @@ -33,7 +33,8 @@ if __name__ == "__main__": args = parser.parse_args() - source_manifest = urlopen(args.url).read() + request = Request(args.url, headers={"User-Agent": "Mozilla/5.0"}) + source_manifest = urlopen(request).read() xmlin = ET.fromstring(source_manifest) xmlout = ET.Element("manifest") -- GitLab From d75cb19d8fc735f4d7b9cab37cc9b11bc0ef94dc Mon Sep 17 00:00:00 2001 From: SolidHal Date: Mon, 20 Apr 2020 18:38:50 -0700 Subject: [PATCH 06/29] remove opendelta support, opendelta seems to have been dropped from omnirom --- Dockerfile | 18 ------------- src/build.sh | 30 ---------------------- src/opendelta_builds_json.py | 49 ------------------------------------ 3 files changed, 97 deletions(-) delete mode 100755 src/opendelta_builds_json.py diff --git a/Dockerfile b/Dockerfile index f06d5e4..034c01b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -175,24 +175,6 @@ RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt clang \ RUN curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo RUN chmod a+x /usr/local/bin/repo -# Download and build delta tools -################################ -RUN cd /root/ && \ - mkdir delta && \ - git clone --depth=1 https://github.com/omnirom/android_packages_apps_OpenDelta.git OpenDelta && \ - gcc -o delta/zipadjust OpenDelta/jni/zipadjust.c OpenDelta/jni/zipadjust_run.c -lz && \ - cp OpenDelta/server/minsignapk.jar OpenDelta/server/opendelta.sh delta/ && \ - chmod +x delta/opendelta.sh && \ - rm -rf OpenDelta/ && \ - sed -i -e 's|^\s*HOME=.*|HOME=/root|; \ - s|^\s*BIN_XDELTA=.*|BIN_XDELTA=xdelta3|; \ - s|^\s*FILE_MATCH=.*|FILE_MATCH=lineage-\*.zip|; \ - s|^\s*PATH_CURRENT=.*|PATH_CURRENT=$SRC_DIR/out/target/product/$DEVICE|; \ - s|^\s*PATH_LAST=.*|PATH_LAST=$SRC_DIR/delta_last/$DEVICE|; \ - s|^\s*KEY_X509=.*|KEY_X509=$KEYS_DIR/releasekey.x509.pem|; \ - s|^\s*KEY_PK8=.*|KEY_PK8=$KEYS_DIR/releasekey.pk8|; \ - s|publish|$DELTA_DIR|g' /root/delta/opendelta.sh - # Set the work directory ######################## WORKDIR $SRC_DIR diff --git a/src/build.sh b/src/build.sh index c6f089f..4b8a65e 100755 --- a/src/build.sh +++ b/src/build.sh @@ -309,27 +309,6 @@ for branch in ${BRANCH_NAME//,/ }; do find out/target/product/$codename -maxdepth 1 -name "lineage-*-$currentdate-*.zip*" -type f -exec sh /root/fix_build_date.sh {} $currentdate $builddate \; &>> "$DEBUG_LOG" 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 'lineage-*.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 @@ -396,15 +375,6 @@ for branch in ${BRANCH_NAME//,/ }; do fi done -# Create the OpenDelta's builds JSON file -if ! [ -z "$OPENDELTA_BUILDS_JSON" ]; then - echo ">> [$(date)] Creating OpenDelta's builds JSON file (ZIP_DIR/$OPENDELTA_BUILDS_JSON)" - if [ "$ZIP_SUBDIR" != true ]; then - echo ">> [$(date)] WARNING: OpenDelta requires zip builds separated per device! You should set ZIP_SUBDIR to true" - fi - /usr/bin/python /root/opendelta_builds_json.py "$ZIP_DIR" -o "$ZIP_DIR/$OPENDELTA_BUILDS_JSON" -fi - if [ "$DELETE_OLD_LOGS" -gt "0" ]; then find "$LOGS_DIR" -maxdepth 1 -name repo-*.log | sort | head -n -$DELETE_OLD_LOGS | xargs -r rm fi diff --git a/src/opendelta_builds_json.py b/src/opendelta_builds_json.py deleted file mode 100755 index 9ae338e..0000000 --- a/src/opendelta_builds_json.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2017 Nicola Corna -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -from sys import argv -from argparse import ArgumentParser -import os -import json - -if __name__ == "__main__": - parser = ArgumentParser(description='Generate an OpenDelta\'s builds.json ' - 'file') - parser.add_argument('path', metavar='PATH', type=str, help='the directory ' - 'containing the zips') - parser.add_argument('-o', "--output", type=str, help='output file; ' - 'if unspecified, print to stdout') - args = parser.parse_args() - - data = {} - builddirs = ['./' + s for s in os.listdir(args.path)] - for builddir in builddirs: - try: - builds = os.listdir(os.path.join(args.path, builddir)) - data[builddir] = [dict() for x in range(len(builds))] - for i in range(0, len(builds)): - data[builddir][i]["filename"] = builds[i] - data[builddir][i]["timestamp"] = int(os.path.getmtime( - os.path.join(args.path, builddir, builds[i]))) - except OSError: - pass - - if args.output: - with open(args.output, "w") as f: - f.write(json.dumps(data, separators=(',',':'))) - else: - print(json.dumps(data, separators=(',',':'))) -- GitLab From 60c8c9de4e41ff7a26f3e43dd3166e9b4b976aa4 Mon Sep 17 00:00:00 2001 From: Simon Polack Date: Fri, 14 Aug 2020 21:39:41 +0200 Subject: [PATCH 07/29] Define branch specifics statically instead of smart logic --- src/build.sh | 102 +++++++++++++++++++-------------------------------- 1 file changed, 38 insertions(+), 64 deletions(-) diff --git a/src/build.sh b/src/build.sh index 4b8a65e..1132214 100755 --- a/src/build.sh +++ b/src/build.sh @@ -85,6 +85,31 @@ for branch in ${BRANCH_NAME//,/ }; do devices=${!device_list_cur_branch} if [ -n "$branch" ] && [ -n "$devices" ]; then + vendor=lineage + case "$branch" in + cm-14.1*) + vendor="cm" + themuppets_branch="cm-14.1" + android_version="7.1.2" + patch_name="android_frameworks_base-N.patch" + ;; + lineage-15.1*) + themuppets_branch="lineage-15.1" + android_version="8.1" + patch_name="android_frameworks_base-O.patch" + ;; + lineage-16.0*) + themuppets_branch="lineage-16.0" + android_version="9" + patch_name="android_frameworks_base-P.patch" + ;; + *) + echo ">> [$(date)] Building branch $branch is not (yet) suppported" + exit 1 + ;; + esac + + android_version_major=$(cut -d '.' -f 1 <<< $android_version) mkdir -p "$SRC_DIR/$branch_dir" cd "$SRC_DIR/$branch_dir" @@ -116,18 +141,6 @@ for branch in ${BRANCH_NAME//,/ }; do rm -f .repo/local_manifests/proprietary.xml if [ "$INCLUDE_PROPRIETARY" = true ]; then - if [[ $branch =~ .*cm\-13\.0.* ]]; then - themuppets_branch=cm-13.0 - elif [[ $branch =~ .*cm-14\.1.* ]]; then - themuppets_branch=cm-14.1 - elif [[ $branch =~ .*lineage-15\.1.* ]]; then - themuppets_branch=lineage-15.1 - elif [[ $branch =~ .*lineage-16\.0.* ]]; then - themuppets_branch=lineage-16.0 - else - themuppets_branch=lineage-15.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" /root/build_manifest.py --remote "https://gitlab.com" --remotename "gitlab_https" \ "https://gitlab.com/the-muppets/manifest/raw/$themuppets_branch/muppets.xml" .repo/local_manifests/proprietary_gitlab.xml @@ -137,30 +150,6 @@ for branch in ${BRANCH_NAME//,/ }; do 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 [ -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 := //p' build/core/version_defaults.mk) - if [ -z $android_version ]; then - echo ">> [$(date)] Can't detect the android version" - exit 1 - fi - fi - fi - android_version_major=$(cut -d '.' -f 1 <<< $android_version) - - if [ "$android_version_major" -lt "7" ]; then - echo ">> [$(date)] ERROR: $branch requires a JDK version too old (< 8); aborting" - exit 1 - fi - - 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 @@ -177,36 +166,21 @@ for branch in ${BRANCH_NAME//,/ }; do # 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" + 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)] ERROR: can't find a suitable signature spoofing patch for the current Android version ($android_version)" - exit 1 + 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" fi echo ">> [$(date)] Setting \"$RELEASE_TYPE\" as release type" -- GitLab From 4a18e077b397baeca05f614c5424e9418aca19b1 Mon Sep 17 00:00:00 2001 From: Simon Polack Date: Sat, 15 Aug 2020 19:16:05 +0200 Subject: [PATCH 08/29] Add keys for networkstack Resolves error FAILED: ninja: 'user-keys/networkstack.x509.pem', needed by 'out/soong/.intermediates/packages/modules/CaptivePortalLogin/CaptivePortalLogin/android_common/CaptivePortalLogin.apk', missing and no known rule to make it See: https://android-review.googlesource.com/q/I7257a472d702e82acdadffc4e0535c63a8bd591d --- src/init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init.sh b/src/init.sh index a6e5b03..3746108 100755 --- a/src/init.sh +++ b/src/init.sh @@ -35,12 +35,12 @@ git config --global user.email $USER_MAIL if [ "$SIGN_BUILDS" = true ]; then if [ -z "$(ls -A "$KEYS_DIR")" ]; then echo ">> [$(date)] SIGN_BUILDS = true but empty \$KEYS_DIR, generating new keys" - for c in releasekey platform shared media; do + for c in releasekey platform shared media networkstack; do echo ">> [$(date)] Generating $c..." /root/make_key "$KEYS_DIR/$c" "$KEYS_SUBJECT" <<< '' &> /dev/null done else - for c in releasekey platform shared media; do + for c in releasekey platform shared media networkstack; do for e in pk8 x509.pem; do if [ ! -f "$KEYS_DIR/$c.$e" ]; then echo ">> [$(date)] SIGN_BUILDS = true and not empty \$KEYS_DIR, but \"\$KEYS_DIR/$c.$e\" is missing" -- GitLab From 1cc6a653cd6bf110c54d490953d61578a7825d5c Mon Sep 17 00:00:00 2001 From: Simon Polack Date: Sat, 15 Aug 2020 19:16:05 +0200 Subject: [PATCH 09/29] Add android Q sig spoofing patch --- src/build.sh | 5 ++ .../android_frameworks_base-Q.patch | 88 +++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 src/signature_spoofing_patches/android_frameworks_base-Q.patch diff --git a/src/build.sh b/src/build.sh index 1132214..5af81ca 100755 --- a/src/build.sh +++ b/src/build.sh @@ -103,6 +103,11 @@ for branch in ${BRANCH_NAME//,/ }; do android_version="9" patch_name="android_frameworks_base-P.patch" ;; + lineage-17.1*) + themuppets_branch="lineage-17.1" + android_version="10" + patch_name="android_frameworks_base-Q.patch" + ;; *) echo ">> [$(date)] Building branch $branch is not (yet) suppported" exit 1 diff --git a/src/signature_spoofing_patches/android_frameworks_base-Q.patch b/src/signature_spoofing_patches/android_frameworks_base-Q.patch new file mode 100644 index 0000000..eaa6b77 --- /dev/null +++ b/src/signature_spoofing_patches/android_frameworks_base-Q.patch @@ -0,0 +1,88 @@ +diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml +index d79a23d5..6cf49ecd 100644 +--- a/core/res/AndroidManifest.xml ++++ b/core/res/AndroidManifest.xml +@@ -2637,6 +2637,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 0db2e140..4a42e50d 100644 +--- a/core/res/res/values/config.xml ++++ b/core/res/res/values/config.xml +@@ -1856,6 +1856,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 152b131a..f8d87a37 100644 +--- a/core/res/res/values/strings.xml ++++ b/core/res/res/values/strings.xml +@@ -827,6 +827,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 + +diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java +index 1b5a03b0..0f4f97ab 100644 +--- a/services/core/java/com/android/server/pm/PackageManagerService.java ++++ b/services/core/java/com/android/server/pm/PackageManagerService.java +@@ -4105,8 +4105,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; +@@ -4142,6 +4143,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(); -- GitLab From 90b39579189d5d21bc8da22cb24497f1b9b88493 Mon Sep 17 00:00:00 2001 From: SolidHal Date: Wed, 5 Feb 2020 14:35:03 -0800 Subject: [PATCH 10/29] Don't include keys in PRODUCT_EXTRA_RECOVERY_KEYS, causes build signing error --- src/build.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/build.sh b/src/build.sh index 5af81ca..0d7e090 100755 --- a/src/build.sh +++ b/src/build.sh @@ -219,7 +219,13 @@ for branch in ${BRANCH_NAME//,/ }; do 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" + if [ "$android_version_major" -lt "10" ]; 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 "10" ]; then + sed -i "1s;^;PRODUCT_DEFAULT_DEV_CERTIFICATE := user-keys/releasekey\nPRODUCT_OTA_PUBLIC_KEYS := user-keys/releasekey\n\n;" "vendor/$vendor/config/common.mk" + fi fi # Prepare the environment -- GitLab From aca1a10efb3b02074eb62afd9bb56b66718991d1 Mon Sep 17 00:00:00 2001 From: Simon Polack Date: Sun, 16 Aug 2020 01:39:14 +0200 Subject: [PATCH 11/29] Docker: Base on Ubuntu 20.04 --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 034c01b..8a0c55d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:stretch +FROM ubuntu:20.04 MAINTAINER Nicola Corna # Environment variables @@ -166,9 +166,9 @@ RUN apt-get -qqy upgrade RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt clang \ 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 libwxgtk3.0-dev \ - libxml2 libxml2-utils lsof lzop maven openjdk-8-jdk pngcrush procps \ + kmod lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool \ + libncurses5 libncurses5-dev libsdl1.2-dev libssl-dev libxml2 \ + libxml2-utils lsof lzop maven openjdk-8-jdk pngcrush procps \ python rsync schedtool squashfs-tools wget xdelta3 xsltproc yasm zip \ zlib1g-dev -- GitLab From 4f145950dd5e47d944cc5ee2716d7265a6cc27b2 Mon Sep 17 00:00:00 2001 From: Simon Polack Date: Sun, 16 Aug 2020 01:44:51 +0200 Subject: [PATCH 12/29] Cleanup leftovers of opendelta --- Dockerfile | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8a0c55d..44c2962 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,6 @@ ENV TMP_DIR /srv/tmp ENV CCACHE_DIR /srv/ccache ENV ZIP_DIR /srv/zips ENV LMANIFEST_DIR /srv/local_manifests -ENV DELTA_DIR /srv/delta ENV KEYS_DIR /srv/keys ENV LOGS_DIR /srv/logs ENV USERSCRIPTS_DIR /srv/userscripts @@ -102,24 +101,12 @@ ENV LOGS_SUBDIR true # example. ENV SIGNATURE_SPOOFING "no" -# Generate delta files -ENV BUILD_DELTA false - # Delete old zips in $ZIP_DIR, keep only the N latest one (0 to disable) ENV DELETE_OLD_ZIPS 0 -# Delete old deltas in $DELTA_DIR, keep only the N latest one (0 to disable) -ENV DELETE_OLD_DELTAS 0 - # Delete old logs in $LOGS_DIR, keep only the N latest one (0 to disable) ENV DELETE_OLD_LOGS 0 -# Create a JSON file that indexes the build zips at the end of the build process -# (for the updates in OpenDelta). The file will be created in $ZIP_DIR with the -# specified name; leave empty to skip it. -# Requires ZIP_SUBDIR. -ENV OPENDELTA_BUILDS_JSON '' - # You can optionally specify a USERSCRIPTS_DIR volume containing these scripts: # * begin.sh, run at the very beginning # * before.sh, run after the syncing and patching, before starting the builds @@ -137,7 +124,6 @@ VOLUME $TMP_DIR VOLUME $CCACHE_DIR VOLUME $ZIP_DIR VOLUME $LMANIFEST_DIR -VOLUME $DELTA_DIR VOLUME $KEYS_DIR VOLUME $LOGS_DIR VOLUME $USERSCRIPTS_DIR @@ -154,7 +140,6 @@ RUN mkdir -p $TMP_DIR RUN mkdir -p $CCACHE_DIR RUN mkdir -p $ZIP_DIR RUN mkdir -p $LMANIFEST_DIR -RUN mkdir -p $DELTA_DIR RUN mkdir -p $KEYS_DIR RUN mkdir -p $LOGS_DIR RUN mkdir -p $USERSCRIPTS_DIR -- GitLab From 30405bb940bf77d15027aa775a530af640d104a9 Mon Sep 17 00:00:00 2001 From: Simon Polack Date: Sun, 16 Aug 2020 01:46:31 +0200 Subject: [PATCH 13/29] Fix ccache which is no longer shipped with AOSP ..by adding a ENV VAR pointing to the actual executable. Taken out of StolenHal Pull Request. --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 44c2962..a623fee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,6 +29,9 @@ ENV USE_CCACHE 1 # for no limit. ENV CCACHE_SIZE 50G +# We need to specify the ccache binary since it is no longer packaged along with AOSP +ENV CCACHE_EXEC /usr/bin/ccache + # Environment for the LineageOS branches name # See https://github.com/LineageOS/android_vendor_cm/branches for possible options ENV BRANCH_NAME 'lineage-16.0' -- GitLab From c67ff89519f0de7ae12a50b8d70f81ed049de162 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Tue, 1 Sep 2020 16:43:27 +0200 Subject: [PATCH 14/29] Remove definitely OpenJDK7 --- Dockerfile | 4 ---- build-community.sh | 17 +++++------------ src/build.sh | 8 +++++--- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1a7fd48..1477015 100644 --- a/Dockerfile +++ b/Dockerfile @@ -144,10 +144,6 @@ RUN mkdir -p $USERSCRIPTS_DIR # Install build dependencies ############################ -COPY apt_preferences /etc/apt/preferences - -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 diff --git a/build-community.sh b/build-community.sh index e5feb4d..5f096b2 100755 --- a/build-community.sh +++ b/build-community.sh @@ -157,6 +157,11 @@ for branch in ${BRANCH_NAME//,/ }; do fi android_version_major=$(cut -d '.' -f 1 <<< $android_version) + if [ "$android_version_major" -lt "7" ]; then + echo ">> [$(date)] ERROR: $branch requires a JDK version too old (< 8); aborting" + exit 1 + fi + if [ "$android_version_major" -ge "8" ]; then vendor="lineage" else @@ -204,18 +209,6 @@ for branch in ${BRANCH_NAME//,/ }; do 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 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 - # Prepare the environment echo ">> [$(date)] Preparing build environment" source build/envsetup.sh > /dev/null diff --git a/src/build.sh b/src/build.sh index 28e3964..46f5297 100755 --- a/src/build.sh +++ b/src/build.sh @@ -115,6 +115,11 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then fi android_version_major=$(cut -d '.' -f 1 <<< $android_version) + if [ "$android_version_major" -lt "7" ]; then + echo ">> [$(date)] ERROR: $branch requires a JDK version too old (< 8); aborting" + exit 1 + fi + if [ "$android_version_major" -ge "8" ]; then vendor="lineage" else @@ -137,9 +142,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 - echo ">> [$(date)] Using OpenJDK $jdk_version" - update-java-alternatives -s java-1.$jdk_version.0-openjdk-amd64 &> /dev/null - # Prepare the environment echo ">> [$(date)] Preparing build environment" source build/envsetup.sh > /dev/null -- GitLab From 3b44aeb11884b282e26ae3aafebc0d2daef2e84e Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Tue, 1 Sep 2020 16:45:07 +0200 Subject: [PATCH 15/29] Move to v1-q by default --- Dockerfile | 2 +- Dockerfile.community | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1477015..5c83f19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,7 +30,7 @@ ENV CCACHE_SIZE 50G # Environment for the /e/ branches name # See https://github.com/LineageOS/android_vendor_cm/branches for possible options -ENV BRANCH_NAME 'v1-pie' +ENV BRANCH_NAME 'v1-q' # Environment for the device # eg. DEVICE=hammerhead diff --git a/Dockerfile.community b/Dockerfile.community index db51ef4..aeb72d1 100644 --- a/Dockerfile.community +++ b/Dockerfile.community @@ -32,7 +32,7 @@ ENV CCACHE_SIZE 50G # Environment for the /e/ branches name # See https://github.com/LineageOS/android_vendor_cm/branches for possible options -ENV BRANCH_NAME 'v1-pie' +ENV BRANCH_NAME 'v1-q' # Environment for the device list (separate by comma if more than one) # eg. DEVICE_LIST=hammerhead,bullhead,angler -- GitLab From 4b9a200f6b257cda07274317a7494a719471f43a Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Tue, 1 Sep 2020 16:46:06 +0200 Subject: [PATCH 16/29] Cleaning community image --- Dockerfile.community | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Dockerfile.community b/Dockerfile.community index aeb72d1..b175ddd 100644 --- a/Dockerfile.community +++ b/Dockerfile.community @@ -157,10 +157,6 @@ RUN mkdir -p $USERSCRIPTS_DIR # Install build dependencies ############################ -COPY apt_preferences /etc/apt/preferences - -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 -- GitLab From 17bc5395159760ab4ef41573ca09c88ef92f1425 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Tue, 1 Sep 2020 16:47:16 +0200 Subject: [PATCH 17/29] Add clang --- Dockerfile | 2 +- Dockerfile.community | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5c83f19..4191374 100644 --- a/Dockerfile +++ b/Dockerfile @@ -147,7 +147,7 @@ RUN mkdir -p $USERSCRIPTS_DIR 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 bc bison bsdmainutils build-essential ccache cgpt clang 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 \ diff --git a/Dockerfile.community b/Dockerfile.community index b175ddd..6b46889 100644 --- a/Dockerfile.community +++ b/Dockerfile.community @@ -160,7 +160,7 @@ RUN mkdir -p $USERSCRIPTS_DIR 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 bc bison bsdmainutils build-essential ccache cgpt clang 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 \ -- GitLab From 13c5a7dfcde67c7a369482b301ebe35eadf735cc Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Tue, 1 Sep 2020 16:54:35 +0200 Subject: [PATCH 18/29] Add gitlab.com/the-muppets as additional source for proprietary files --- Dockerfile | 2 +- Dockerfile.community | 2 +- build-community.sh | 5 ++++ src/build.sh | 3 +++ src/build_manifest.py | 60 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 src/build_manifest.py diff --git a/Dockerfile b/Dockerfile index 4191374..e948cf6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,7 +46,7 @@ ENV REPO 'https://gitlab.e.foundation/e/os/android.git' ENV USER_NAME '/e/ robot' ENV USER_MAIL 'erobot@e.email' -# Include proprietary files, downloaded automatically from github.com/TheMuppets/ +# Include proprietary files, downloaded automatically from github.com/TheMuppets/ and gitlab.com/the-muppets/ # Only some branches are supported ENV INCLUDE_PROPRIETARY true diff --git a/Dockerfile.community b/Dockerfile.community index 6b46889..fb19690 100644 --- a/Dockerfile.community +++ b/Dockerfile.community @@ -55,7 +55,7 @@ ENV OTA_URL '' ENV USER_NAME 'LineageOS Buildbot' ENV USER_MAIL 'lineageos-buildbot@docker.host' -# Include proprietary files, downloaded automatically from github.com/TheMuppets/ +# Include proprietary files, downloaded automatically from github.com/TheMuppets/ and gitlab.com/the-muppets/ # Only some branches are supported ENV INCLUDE_PROPRIETARY true diff --git a/build-community.sh b/build-community.sh index 5f096b2..183b714 100755 --- a/build-community.sh +++ b/build-community.sh @@ -61,6 +61,8 @@ if [ "$LOCAL_MIRROR" = true ]; then 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" + /root/build_manifest.py --remote "https://gitlab.com" --remotename "gitlab_https" \ + "https://gitlab.com/the-muppets/manifest/raw/mirror/default.xml" .repo/local_manifests/proprietary_gitlab.xml fi echo ">> [$(date)] Syncing mirror repository" | tee -a "$repo_log" @@ -134,6 +136,9 @@ for branch in ${BRANCH_NAME//,/ }; do 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" + /root/build_manifest.py --remote "https://gitlab.com" --remotename "gitlab_https" \ + "https://gitlab.com/the-muppets/manifest/raw/$themuppets_branch/muppets.xml" .repo/local_manifests/proprietary_gitlab.xml + fi echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log" diff --git a/src/build.sh b/src/build.sh index 46f5297..557631f 100755 --- a/src/build.sh +++ b/src/build.sh @@ -89,6 +89,9 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then 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" + /root/build_manifest.py --remote "https://gitlab.com" --remotename "gitlab_https" \ + "https://gitlab.com/the-muppets/manifest/raw/$themuppets_branch/muppets.xml" .repo/local_manifests/proprietary_gitlab.xml + fi echo ">> [$(date)] Syncing branch repository" diff --git a/src/build_manifest.py b/src/build_manifest.py new file mode 100644 index 0000000..d24af59 --- /dev/null +++ b/src/build_manifest.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# +# Copyright (C) 2019 Nicola Corna +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from xml.dom import minidom +import xml.etree.ElementTree as ET +import argparse + +try: + from urllib.request import urlopen +except ImportError: + from urllib2 import urlopen + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='Build an Android repo manifest') + parser.add_argument('url', type=str, help='URL of the source manifest') + parser.add_argument('out', type=str, help='Output path') + parser.add_argument('--remote', type=str, help='Remote URL') + parser.add_argument('--remotename', type=str, help='Remote name') + + args = parser.parse_args() + + source_manifest = urlopen(args.url).read() + + xmlin = ET.fromstring(source_manifest) + xmlout = ET.Element("manifest") + + if args.remote: + ET.SubElement(xmlout, 'remote', attrib={"name": args.remotename, + "fetch": args.remote}) + + for child in xmlin: + if child.tag == "project": + attributes = {} + attributes["name"] = child.attrib["name"] + + if "path" in child.attrib: + attributes["path"] = child.attrib["path"] + + if args.remote: + attributes["remote"] = args.remotename + + ET.SubElement(xmlout, 'project', attrib=attributes) + + xmlstr = minidom.parseString(ET.tostring(xmlout)).toprettyxml(indent=" ", encoding="UTF-8") + with open(args.out, "w") as f: + f.write(xmlstr) -- GitLab From 4fda7d90e6d26b84d5c97c4d0c18f854d163bf99 Mon Sep 17 00:00:00 2001 From: Evan Goode Date: Sat, 11 Apr 2020 10:14:54 -0400 Subject: [PATCH 19/29] Send some User-Agent other than "Python-urllib" Looks like GitLab is using CloudFlare to block requests of raw files from user agents matching "Python-urllib*". So we'll just send a generic browser user agent instead. --- src/build_manifest.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/build_manifest.py b/src/build_manifest.py index d24af59..32f9411 100644 --- a/src/build_manifest.py +++ b/src/build_manifest.py @@ -20,9 +20,9 @@ import xml.etree.ElementTree as ET import argparse try: - from urllib.request import urlopen + from urllib.request import urlopen, Request except ImportError: - from urllib2 import urlopen + from urllib2 import urlopen, Request if __name__ == "__main__": parser = argparse.ArgumentParser(description='Build an Android repo manifest') @@ -33,7 +33,8 @@ if __name__ == "__main__": args = parser.parse_args() - source_manifest = urlopen(args.url).read() + request = Request(args.url, headers={"User-Agent": "Mozilla/5.0"}) + source_manifest = urlopen(request).read() xmlin = ET.fromstring(source_manifest) xmlout = ET.Element("manifest") -- GitLab From 7e7544dc72f56dc4acfe002aa41f7f522eee0bee Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Tue, 1 Sep 2020 17:04:50 +0200 Subject: [PATCH 20/29] Remove opendelta support --- Dockerfile | 33 ------------------------ Dockerfile.community | 33 ------------------------ build-community.sh | 29 --------------------- src/build.sh | 30 ---------------------- src/opendelta_builds_json.py | 49 ------------------------------------ 5 files changed, 174 deletions(-) delete mode 100755 src/opendelta_builds_json.py diff --git a/Dockerfile b/Dockerfile index e948cf6..f4ea80a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,6 @@ ENV SRC_DIR /srv/src ENV CCACHE_DIR /srv/ccache ENV ZIP_DIR /srv/zips ENV LMANIFEST_DIR /srv/local_manifests -ENV DELTA_DIR /srv/delta ENV KEYS_DIR /srv/keys ENV LOGS_DIR /srv/logs ENV USERSCRIPTS_DIR /srv/userscripts @@ -82,24 +81,12 @@ ENV LOGS_SUBDIR true # Backup the .img in addition to zips ENV BACKUP_IMG false -# Generate delta files -ENV BUILD_DELTA false - # Delete old zips in $ZIP_DIR, keep only the N latest one (0 to disable) ENV DELETE_OLD_ZIPS 0 -# Delete old deltas in $DELTA_DIR, keep only the N latest one (0 to disable) -ENV DELETE_OLD_DELTAS 0 - # Delete old logs in $LOGS_DIR, keep only the N latest one (0 to disable) ENV DELETE_OLD_LOGS 0 -# Create a JSON file that indexes the build zips at the end of the build process -# (for the updates in OpenDelta). The file will be created in $ZIP_DIR with the -# specified name; leave empty to skip it. -# Requires ZIP_SUBDIR. -ENV OPENDELTA_BUILDS_JSON '' - # Save recovery image ENV RECOVERY_IMG false @@ -121,7 +108,6 @@ VOLUME $SRC_DIR VOLUME $CCACHE_DIR VOLUME $ZIP_DIR VOLUME $LMANIFEST_DIR -VOLUME $DELTA_DIR VOLUME $KEYS_DIR VOLUME $LOGS_DIR VOLUME $USERSCRIPTS_DIR @@ -137,7 +123,6 @@ RUN mkdir -p $SRC_DIR RUN mkdir -p $CCACHE_DIR RUN mkdir -p $ZIP_DIR RUN mkdir -p $LMANIFEST_DIR -RUN mkdir -p $DELTA_DIR RUN mkdir -p $KEYS_DIR RUN mkdir -p $LOGS_DIR RUN mkdir -p $USERSCRIPTS_DIR @@ -165,24 +150,6 @@ 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 -################################ -RUN cd /root/ && \ - mkdir delta && \ - git clone --depth=1 https://gitlab.e.foundation/e/os/android_packages_apps_OpenDelta.git OpenDelta && \ - gcc -o delta/zipadjust OpenDelta/jni/zipadjust.c OpenDelta/jni/zipadjust_run.c -lz && \ - cp OpenDelta/server/minsignapk.jar OpenDelta/server/opendelta.sh delta/ && \ - chmod +x delta/opendelta.sh && \ - rm -rf OpenDelta/ && \ - sed -i -e 's|^\s*HOME=.*|HOME=/root|; \ - s|^\s*BIN_XDELTA=.*|BIN_XDELTA=xdelta3|; \ - s|^\s*FILE_MATCH=.*|FILE_MATCH=lineage-\*.zip|; \ - s|^\s*PATH_CURRENT=.*|PATH_CURRENT=$SRC_DIR/out/target/product/$DEVICE|; \ - s|^\s*PATH_LAST=.*|PATH_LAST=$SRC_DIR/delta_last/$DEVICE|; \ - s|^\s*KEY_X509=.*|KEY_X509=$KEYS_DIR/releasekey.x509.pem|; \ - s|^\s*KEY_PK8=.*|KEY_PK8=$KEYS_DIR/releasekey.pk8|; \ - s|publish|$DELTA_DIR|g' /root/delta/opendelta.sh - # Set the work directory ######################## WORKDIR $SRC_DIR diff --git a/Dockerfile.community b/Dockerfile.community index fb19690..9b3d6eb 100644 --- a/Dockerfile.community +++ b/Dockerfile.community @@ -10,7 +10,6 @@ ENV TMP_DIR /srv/tmp ENV CCACHE_DIR /srv/ccache ENV ZIP_DIR /srv/zips ENV LMANIFEST_DIR /srv/local_manifests -ENV DELTA_DIR /srv/delta ENV KEYS_DIR /srv/keys ENV LOGS_DIR /srv/logs ENV USERSCRIPTS_DIR /srv/userscripts @@ -97,24 +96,12 @@ ENV ZIP_SUBDIR true # Write the verbose logs to $LOGS_DIR/$codename instead of $LOGS_DIR/ ENV LOGS_SUBDIR true -# Generate delta files -ENV BUILD_DELTA false - # Delete old zips in $ZIP_DIR, keep only the N latest one (0 to disable) ENV DELETE_OLD_ZIPS 0 -# Delete old deltas in $DELTA_DIR, keep only the N latest one (0 to disable) -ENV DELETE_OLD_DELTAS 0 - # Delete old logs in $LOGS_DIR, keep only the N latest one (0 to disable) ENV DELETE_OLD_LOGS 0 -# Create a JSON file that indexes the build zips at the end of the build process -# (for the updates in OpenDelta). The file will be created in $ZIP_DIR with the -# specified name; leave empty to skip it. -# Requires ZIP_SUBDIR. -ENV OPENDELTA_BUILDS_JSON '' - # You can optionally specify a USERSCRIPTS_DIR volume containing these scripts: # * begin.sh, run at the very beginning # * before.sh, run after the syncing and patching, before starting the builds @@ -132,7 +119,6 @@ VOLUME $TMP_DIR VOLUME $CCACHE_DIR VOLUME $ZIP_DIR VOLUME $LMANIFEST_DIR -VOLUME $DELTA_DIR VOLUME $KEYS_DIR VOLUME $LOGS_DIR VOLUME $USERSCRIPTS_DIR @@ -150,7 +136,6 @@ RUN mkdir -p $TMP_DIR RUN mkdir -p $CCACHE_DIR RUN mkdir -p $ZIP_DIR RUN mkdir -p $LMANIFEST_DIR -RUN mkdir -p $DELTA_DIR RUN mkdir -p $KEYS_DIR RUN mkdir -p $LOGS_DIR RUN mkdir -p $USERSCRIPTS_DIR @@ -178,24 +163,6 @@ 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 -################################ -RUN cd /root/ && \ - mkdir delta && \ - git clone --depth=1 https://gitlab.e.foundation/e/os/android_packages_apps_OpenDelta.git OpenDelta && \ - gcc -o delta/zipadjust OpenDelta/jni/zipadjust.c OpenDelta/jni/zipadjust_run.c -lz && \ - cp OpenDelta/server/minsignapk.jar OpenDelta/server/opendelta.sh delta/ && \ - chmod +x delta/opendelta.sh && \ - rm -rf OpenDelta/ && \ - sed -i -e 's|^\s*HOME=.*|HOME=/root|; \ - s|^\s*BIN_XDELTA=.*|BIN_XDELTA=xdelta3|; \ - s|^\s*FILE_MATCH=.*|FILE_MATCH=lineage-\*.zip|; \ - s|^\s*PATH_CURRENT=.*|PATH_CURRENT=$SRC_DIR/out/target/product/$DEVICE|; \ - s|^\s*PATH_LAST=.*|PATH_LAST=$SRC_DIR/delta_last/$DEVICE|; \ - s|^\s*KEY_X509=.*|KEY_X509=$KEYS_DIR/releasekey.x509.pem|; \ - s|^\s*KEY_PK8=.*|KEY_PK8=$KEYS_DIR/releasekey.pk8|; \ - s|publish|$DELTA_DIR|g' /root/delta/opendelta.sh - # Set the work directory ######################## WORKDIR $SRC_DIR diff --git a/build-community.sh b/build-community.sh index 183b714..ab8dcbb 100755 --- a/build-community.sh +++ b/build-community.sh @@ -303,27 +303,6 @@ for branch in ${BRANCH_NAME//,/ }; do 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 [ "$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 @@ -391,14 +370,6 @@ for branch in ${BRANCH_NAME//,/ }; do fi done -# Create the OpenDelta's builds JSON file -if ! [ -z "$OPENDELTA_BUILDS_JSON" ]; then - echo ">> [$(date)] Creating OpenDelta's builds JSON file (ZIP_DIR/$OPENDELTA_BUILDS_JSON)" - if [ "$ZIP_SUBDIR" != true ]; then - echo ">> [$(date)] WARNING: OpenDelta requires zip builds separated per device! You should set ZIP_SUBDIR to true" - fi - /usr/bin/python /root/opendelta_builds_json.py "$ZIP_DIR" -o "$ZIP_DIR/$OPENDELTA_BUILDS_JSON" -fi if [ "$DELETE_OLD_LOGS" -gt "0" ]; then find "$LOGS_DIR" -maxdepth 1 -name repo-*.log | sort | head -n -$DELETE_OLD_LOGS | xargs -r rm diff --git a/src/build.sh b/src/build.sh index 557631f..4cfc987 100755 --- a/src/build.sh +++ b/src/build.sh @@ -214,27 +214,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then 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}" - cd /root/delta - if ./opendelta.sh ${DEVICE}; then - echo ">> [$(date)] Delta generation for ${DEVICE} completed" - else - 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}" - 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" - 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'" cd out/target/product/${DEVICE} @@ -298,15 +277,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then fi -# Create the OpenDelta's builds JSON file -if ! [ -z "$OPENDELTA_BUILDS_JSON" ]; then - echo ">> [$(date)] Creating OpenDelta's builds JSON file (ZIP_DIR/$OPENDELTA_BUILDS_JSON)" - if [ "$ZIP_SUBDIR" != true ]; then - echo ">> [$(date)] WARNING: OpenDelta requires zip builds separated per device! You should set ZIP_SUBDIR to true" - fi - /usr/bin/python /root/opendelta_builds_json.py "$ZIP_DIR" -o "$ZIP_DIR/$OPENDELTA_BUILDS_JSON" -fi - if [ "$DELETE_OLD_LOGS" -gt "0" ]; then find "$LOGS_DIR" -maxdepth 1 -name repo-*.log | sort | head -n -$DELETE_OLD_LOGS | xargs -r rm fi diff --git a/src/opendelta_builds_json.py b/src/opendelta_builds_json.py deleted file mode 100755 index 9ae338e..0000000 --- a/src/opendelta_builds_json.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2017 Nicola Corna -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -from sys import argv -from argparse import ArgumentParser -import os -import json - -if __name__ == "__main__": - parser = ArgumentParser(description='Generate an OpenDelta\'s builds.json ' - 'file') - parser.add_argument('path', metavar='PATH', type=str, help='the directory ' - 'containing the zips') - parser.add_argument('-o', "--output", type=str, help='output file; ' - 'if unspecified, print to stdout') - args = parser.parse_args() - - data = {} - builddirs = ['./' + s for s in os.listdir(args.path)] - for builddir in builddirs: - try: - builds = os.listdir(os.path.join(args.path, builddir)) - data[builddir] = [dict() for x in range(len(builds))] - for i in range(0, len(builds)): - data[builddir][i]["filename"] = builds[i] - data[builddir][i]["timestamp"] = int(os.path.getmtime( - os.path.join(args.path, builddir, builds[i]))) - except OSError: - pass - - if args.output: - with open(args.output, "w") as f: - f.write(json.dumps(data, separators=(',',':'))) - else: - print(json.dumps(data, separators=(',',':'))) -- GitLab From b8cbb1bb8579fab02046346801fbb892d941dd2c Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Tue, 1 Sep 2020 17:22:33 +0200 Subject: [PATCH 21/29] Define branch specifics statically instead of smart logic --- build-community.sh | 64 ++++++++++++++++----------------------------- src/build.sh | 65 ++++++++++++++++------------------------------ 2 files changed, 45 insertions(+), 84 deletions(-) diff --git a/build-community.sh b/build-community.sh index ab8dcbb..09e05cc 100755 --- a/build-community.sh +++ b/build-community.sh @@ -80,6 +80,29 @@ for branch in ${BRANCH_NAME//,/ }; do devices=${!device_list_cur_branch} if [ -n "$branch" ] && [ -n "$devices" ]; then + vendor=lineage + case "$branch" in + v1-nougat*) + vendor="cm" + themuppets_branch="cm-14.1" + android_version="7.1.2" + ;; + v1-oreo*) + themuppets_branch="lineage-15.1" + android_version="8.1" + ;; + v1-pie*) + themuppets_branch="lineage-16.0" + android_version="9" + ;; + *) + echo ">> [$(date)] Building branch $branch is not (yet) suppported" + exit 1 + ;; + esac + + android_version_major=$(cut -d '.' -f 1 <<< $android_version) + mkdir -p "$SRC_DIR/$branch_dir" cd "$SRC_DIR/$branch_dir" @@ -119,26 +142,9 @@ for branch in ${BRANCH_NAME//,/ }; do 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" - elif [[ $branch =~ q$ ]]; then - themuppets_branch=lineage-17.1 - 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" /root/build_manifest.py --remote "https://gitlab.com" --remotename "gitlab_https" \ "https://gitlab.com/the-muppets/manifest/raw/$themuppets_branch/muppets.xml" .repo/local_manifests/proprietary_gitlab.xml - fi echo ">> [$(date)] Syncing branch repository" | tee -a "$repo_log" @@ -149,30 +155,6 @@ for branch in ${BRANCH_NAME//,/ }; do 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 := //p' build/core/version_defaults.mk) - if [ -z $android_version ]; then - echo ">> [$(date)] Can't detect the android version" - exit 1 - fi - fi - fi - android_version_major=$(cut -d '.' -f 1 <<< $android_version) - - if [ "$android_version_major" -lt "7" ]; then - echo ">> [$(date)] ERROR: $branch requires a JDK version too old (< 8); aborting" - exit 1 - fi - - 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 diff --git a/src/build.sh b/src/build.sh index 4cfc987..f3799bf 100755 --- a/src/build.sh +++ b/src/build.sh @@ -37,6 +37,28 @@ branch_dir=$(sed 's/.*-\([a-zA-Z]*\)$/\1/' <<< ${BRANCH_NAME}) branch_dir=${branch_dir^^} if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then + vendor=lineage + case "$branch" in + v1-nougat*) + vendor="cm" + themuppets_branch="cm-14.1" + android_version="7.1.2" + ;; + v1-oreo*) + themuppets_branch="lineage-15.1" + android_version="8.1" + ;; + v1-pie*) + themuppets_branch="lineage-16.0" + android_version="9" + ;; + *) + echo ">> [$(date)] Building branch $branch is not (yet) suppported" + exit 1 + ;; + esac + + android_version_major=$(cut -d '.' -f 1 <<< $android_version) mkdir -p "$SRC_DIR/$branch_dir" cd "$SRC_DIR/$branch_dir" @@ -72,22 +94,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then 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" - elif [[ ${BRANCH_NAME} =~ q$ ]]; then - themuppets_branch=lineage-17.1 - 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" /root/build_manifest.py --remote "https://gitlab.com" --remotename "gitlab_https" \ "https://gitlab.com/the-muppets/manifest/raw/$themuppets_branch/muppets.xml" .repo/local_manifests/proprietary_gitlab.xml @@ -102,33 +108,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then sync_successful=false fi - android_version=$(sed -n -e 's/^\s*PLATFORM_VERSION\.QP1A := //p' build/core/version_defaults.mk) - if [ -z $android_version ]; then - 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 := //p' build/core/version_defaults.mk) - if [ -z $android_version ]; then - echo ">> [$(date)] Can't detect the android version" - exit 1 - fi - fi - fi - fi - android_version_major=$(cut -d '.' -f 1 <<< $android_version) - - if [ "$android_version_major" -lt "7" ]; then - echo ">> [$(date)] ERROR: $branch requires a JDK version too old (< 8); aborting" - exit 1 - fi - - 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 -- GitLab From 364a14eb301338d3102c2c9509db70c822b72637 Mon Sep 17 00:00:00 2001 From: Simon Polack Date: Sat, 15 Aug 2020 19:16:05 +0200 Subject: [PATCH 22/29] Add keys for networkstack Resolves error FAILED: ninja: 'user-keys/networkstack.x509.pem', needed by 'out/soong/.intermediates/packages/modules/CaptivePortalLogin/CaptivePortalLogin/android_common/CaptivePortalLogin.apk', missing and no known rule to make it See: https://android-review.googlesource.com/q/I7257a472d702e82acdadffc4e0535c63a8bd591d --- src/init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init.sh b/src/init.sh index 57656d5..977f935 100755 --- a/src/init.sh +++ b/src/init.sh @@ -35,12 +35,12 @@ git config --global user.email $USER_MAIL if [ "$SIGN_BUILDS" = true ]; then if [ -z "$(ls -A "$KEYS_DIR")" ]; then echo ">> [$(date)] SIGN_BUILDS = true but empty \$KEYS_DIR, generating new keys" - for c in releasekey platform shared media; do + for c in releasekey platform shared media networkstack; do echo ">> [$(date)] Generating $c..." /root/make_key "$KEYS_DIR/$c" "$KEYS_SUBJECT" <<< '' &> /dev/null done else - for c in releasekey platform shared media; do + for c in releasekey platform shared media networkstack; do for e in pk8 x509.pem; do if [ ! -f "$KEYS_DIR/$c.$e" ]; then echo ">> [$(date)] SIGN_BUILDS = true and not empty \$KEYS_DIR, but \"\$KEYS_DIR/$c.$e\" is missing" -- GitLab From 8840971b46cfff91fc7be5f771706aeb6643434d Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Tue, 1 Sep 2020 17:36:27 +0200 Subject: [PATCH 23/29] Add android Q support --- build-community.sh | 6 ++++++ src/build.sh | 14 +++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/build-community.sh b/build-community.sh index 09e05cc..d00280c 100755 --- a/build-community.sh +++ b/build-community.sh @@ -95,6 +95,12 @@ for branch in ${BRANCH_NAME//,/ }; do themuppets_branch="lineage-16.0" android_version="9" ;; + v1-q*) + themuppets_branch="lineage-17.1" + android_version="10" + ;; + ;; + *) echo ">> [$(date)] Building branch $branch is not (yet) suppported" exit 1 diff --git a/src/build.sh b/src/build.sh index f3799bf..93add2d 100755 --- a/src/build.sh +++ b/src/build.sh @@ -36,22 +36,26 @@ sync_successful=true branch_dir=$(sed 's/.*-\([a-zA-Z]*\)$/\1/' <<< ${BRANCH_NAME}) branch_dir=${branch_dir^^} -if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then +if [ -n "${branch_dir}" ] && [ -n "${DEVICE}" ]; then vendor=lineage - case "$branch" in - v1-nougat*) + case "$BRANCH_NAME" in + V1-NOUGAT*) vendor="cm" themuppets_branch="cm-14.1" android_version="7.1.2" ;; - v1-oreo*) + V1-OREO*) themuppets_branch="lineage-15.1" android_version="8.1" ;; - v1-pie*) + V1-PIE*) themuppets_branch="lineage-16.0" android_version="9" ;; + V1-Q*) + themuppets_branch="lineage-17.1" + android_version="10" + ;; *) echo ">> [$(date)] Building branch $branch is not (yet) suppported" exit 1 -- GitLab From d54181ad029a20728828c5d71184b8cbe5eb991c Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Tue, 1 Sep 2020 17:38:56 +0200 Subject: [PATCH 24/29] Don't include keys in PRODUCT_EXTRA_RECOVERY_KEYS, causes build signing error --- build-community.sh | 8 +++++++- src/build.sh | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/build-community.sh b/build-community.sh index d00280c..0a635bc 100755 --- a/build-community.sh +++ b/build-community.sh @@ -199,7 +199,13 @@ for branch in ${BRANCH_NAME//,/ }; do 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" + if [ "$android_version_major" -lt "10" ]; 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 "10" ]; then + sed -i "1s;^;PRODUCT_DEFAULT_DEV_CERTIFICATE := user-keys/releasekey\nPRODUCT_OTA_PUBLIC_KEYS := user-keys/releasekey\n\n;" "vendor/$vendor/config/common.mk" + fi fi # Prepare the environment diff --git a/src/build.sh b/src/build.sh index 93add2d..3037857 100755 --- a/src/build.sh +++ b/src/build.sh @@ -125,7 +125,13 @@ if [ -n "${branch_dir}" ] && [ -n "${DEVICE}" ]; 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" + if [ "$android_version_major" -lt "10" ]; 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 "10" ]; then + sed -i "1s;^;PRODUCT_DEFAULT_DEV_CERTIFICATE := user-keys/releasekey\nPRODUCT_OTA_PUBLIC_KEYS := user-keys/releasekey\n\n;" "vendor/$vendor/config/common.mk" + fi fi # Prepare the environment -- GitLab From a105dec36b40857a2b1a6f68b8a60e5834e524e3 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Tue, 1 Sep 2020 17:40:49 +0200 Subject: [PATCH 25/29] Base on Ubuntu 20.04 --- Dockerfile | 4 ++-- Dockerfile.community | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index f4ea80a..60e9aeb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:buster +FROM ubuntu:20.04 MAINTAINER Romain Hunault # Environment variables @@ -135,7 +135,7 @@ RUN apt-get -qqy upgrade RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt clang 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 \ + libncurses5-dev libsdl1.2-dev libssl-dev libxml2 \ libxml2-utils lsof lzop maven pngcrush \ procps python python3 rsync schedtool squashfs-tools software-properties-common wget xdelta3 xsltproc yasm \ zip zlib1g-dev diff --git a/Dockerfile.community b/Dockerfile.community index 9b3d6eb..a5c8514 100644 --- a/Dockerfile.community +++ b/Dockerfile.community @@ -1,4 +1,4 @@ -FROM debian:buster +FROM ubuntu:20.04 MAINTAINER Romain Hunault # Environment variables @@ -148,7 +148,7 @@ RUN apt-get -qqy upgrade RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt clang 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 \ + libncurses5-dev libsdl1.2-dev libssl-dev libxml2 \ libxml2-utils lsof lzop maven pngcrush \ procps python python3 rsync schedtool squashfs-tools software-properties-common wget xdelta3 xsltproc yasm \ zip zlib1g-dev -- GitLab From a622d3f56d6894fc9a4615f0c1691d64484ac6d9 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Tue, 1 Sep 2020 17:43:36 +0200 Subject: [PATCH 26/29] Fix ccache which is no longer shipped with AOSP --- Dockerfile | 3 +++ Dockerfile.community | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Dockerfile b/Dockerfile index 60e9aeb..d213ba2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,9 @@ ENV USE_CCACHE 1 # for no limit. ENV CCACHE_SIZE 50G +# We need to specify the ccache binary since it is no longer packaged along with AOSP +ENV CCACHE_EXEC /usr/bin/ccache + # Environment for the /e/ branches name # See https://github.com/LineageOS/android_vendor_cm/branches for possible options ENV BRANCH_NAME 'v1-q' diff --git a/Dockerfile.community b/Dockerfile.community index a5c8514..8ec19d6 100644 --- a/Dockerfile.community +++ b/Dockerfile.community @@ -29,6 +29,9 @@ ENV USE_CCACHE 1 # for no limit. ENV CCACHE_SIZE 50G +# We need to specify the ccache binary since it is no longer packaged along with AOSP +ENV CCACHE_EXEC /usr/bin/ccache + # Environment for the /e/ branches name # See https://github.com/LineageOS/android_vendor_cm/branches for possible options ENV BRANCH_NAME 'v1-q' -- GitLab From 4ab92ae31d719d5fb533b009234bcaa6bd62d32b Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Wed, 2 Sep 2020 08:48:20 +0200 Subject: [PATCH 27/29] Fix branch name --- src/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/build.sh b/src/build.sh index 3037857..f416794 100755 --- a/src/build.sh +++ b/src/build.sh @@ -36,9 +36,9 @@ sync_successful=true branch_dir=$(sed 's/.*-\([a-zA-Z]*\)$/\1/' <<< ${BRANCH_NAME}) branch_dir=${branch_dir^^} -if [ -n "${branch_dir}" ] && [ -n "${DEVICE}" ]; then +if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then vendor=lineage - case "$BRANCH_NAME" in + case "$branch_dir" in V1-NOUGAT*) vendor="cm" themuppets_branch="cm-14.1" -- GitLab From 8a0a6db06e9b4702482b0ae057fbbf1b9ca2fa33 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Wed, 2 Sep 2020 08:56:37 +0200 Subject: [PATCH 28/29] Fix the switch on branch name --- build-community.sh | 8 ++++---- src/build.sh | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build-community.sh b/build-community.sh index 0a635bc..6588bf9 100755 --- a/build-community.sh +++ b/build-community.sh @@ -82,20 +82,20 @@ for branch in ${BRANCH_NAME//,/ }; do if [ -n "$branch" ] && [ -n "$devices" ]; then vendor=lineage case "$branch" in - v1-nougat*) + *nougat*) vendor="cm" themuppets_branch="cm-14.1" android_version="7.1.2" ;; - v1-oreo*) + *oreo*) themuppets_branch="lineage-15.1" android_version="8.1" ;; - v1-pie*) + *pie*) themuppets_branch="lineage-16.0" android_version="9" ;; - v1-q*) + q*) themuppets_branch="lineage-17.1" android_version="10" ;; diff --git a/src/build.sh b/src/build.sh index f416794..24bb23d 100755 --- a/src/build.sh +++ b/src/build.sh @@ -38,21 +38,21 @@ branch_dir=${branch_dir^^} if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then vendor=lineage - case "$branch_dir" in - V1-NOUGAT*) + case "$BRANCH_NAME" in + *nougat*) vendor="cm" themuppets_branch="cm-14.1" android_version="7.1.2" ;; - V1-OREO*) + *oreo*) themuppets_branch="lineage-15.1" android_version="8.1" ;; - V1-PIE*) + *pie*) themuppets_branch="lineage-16.0" android_version="9" ;; - V1-Q*) + *q*) themuppets_branch="lineage-17.1" android_version="10" ;; -- GitLab From 69469d6469d0f34217c146b4283e2ffe14d2779a Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Wed, 2 Sep 2020 10:34:08 +0200 Subject: [PATCH 29/29] Remove signature spoofing patche --- .../android_frameworks_base-Q.patch | 88 ------------------- 1 file changed, 88 deletions(-) delete mode 100644 src/signature_spoofing_patches/android_frameworks_base-Q.patch diff --git a/src/signature_spoofing_patches/android_frameworks_base-Q.patch b/src/signature_spoofing_patches/android_frameworks_base-Q.patch deleted file mode 100644 index eaa6b77..0000000 --- a/src/signature_spoofing_patches/android_frameworks_base-Q.patch +++ /dev/null @@ -1,88 +0,0 @@ -diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml -index d79a23d5..6cf49ecd 100644 ---- a/core/res/AndroidManifest.xml -+++ b/core/res/AndroidManifest.xml -@@ -2637,6 +2637,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 0db2e140..4a42e50d 100644 ---- a/core/res/res/values/config.xml -+++ b/core/res/res/values/config.xml -@@ -1856,6 +1856,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 152b131a..f8d87a37 100644 ---- a/core/res/res/values/strings.xml -+++ b/core/res/res/values/strings.xml -@@ -827,6 +827,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 - -diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java -index 1b5a03b0..0f4f97ab 100644 ---- a/services/core/java/com/android/server/pm/PackageManagerService.java -+++ b/services/core/java/com/android/server/pm/PackageManagerService.java -@@ -4105,8 +4105,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; -@@ -4142,6 +4143,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(); -- GitLab