Skip to content

Commit

Permalink
Revert "Remove <fileset-api-level> parameter from commands"
Browse files Browse the repository at this point in the history
This reverts commit dc13636.
  • Loading branch information
Lanchon committed Jul 31, 2017
1 parent dc13636 commit 462225d
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 86 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ sigspoof-ui-global-7.0-7.1

`$ ./patch-fileset`
```
usage: patch-fileset <patch-dex-dir> <fileset-dir> [ <target-dir-to-create> | --dry-run [ <dexpatcher-option> ... ] ]
usage: patch-fileset <patch-dex-dir> <fileset-api-level> <fileset-dir> [ <target-dir-to-create> | --dry-run [ <dexpatcher-option> ... ] ]
```

`$ ./patch-fileset patches/sigspoof-hook-4.1-6.0/ fs-oneplus2/`
`$ ./patch-fileset patches/sigspoof-hook-4.1-6.0/ 23 fs-oneplus2/`
```
>>> target directory: fs-oneplus2__sigspoof-hook-4.1-6.0
>>> apply patch: services.jar
>>> dexpatcher --verbose --output fs-oneplus2__sigspoof-hook-4.1-6.0/tmp/services.jar/patched-dex --multi-dex fs-oneplus2/services.jar patches/sigspoof-hook-4.1-6.0/services.jar.dex
>>> dexpatcher --api-level 23 --verbose --output fs-oneplus2__sigspoof-hook-4.1-6.0/tmp/services.jar/patched-dex --multi-dex fs-oneplus2/services.jar patches/sigspoof-hook-4.1-6.0/services.jar.dex
info: read 'fs-oneplus2/services.jar'
info: read 'patches/sigspoof-hook-4.1-6.0/services.jar.dex'
info: write 'fs-oneplus2__sigspoof-hook-4.1-6.0/tmp/services.jar/patched-dex'
Expand All @@ -136,11 +136,11 @@ The patched fileset was output to `fs-oneplus2__sigspoof-hook-4.1-6.0` by defaul

Now patch this resulting fileset again to add the core patch:

`$ ./patch-fileset patches/sigspoof-core/ fs-oneplus2__sigspoof-hook-4.1-6.0/`
`$ ./patch-fileset patches/sigspoof-core/ 23 fs-oneplus2__sigspoof-hook-4.1-6.0/`
```
>>> target directory: fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core
>>> apply patch: services.jar
>>> dexpatcher --verbose --output fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core/tmp/services.jar/patched-dex --multi-dex fs-oneplus2__sigspoof-hook-4.1-6.0/services.jar patches/sigspoof-core/services.jar.dex
>>> dexpatcher --api-level 23 --verbose --output fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core/tmp/services.jar/patched-dex --multi-dex fs-oneplus2__sigspoof-hook-4.1-6.0/services.jar patches/sigspoof-core/services.jar.dex
info: read 'fs-oneplus2__sigspoof-hook-4.1-6.0/services.jar'
info: read 'patches/sigspoof-core/services.jar.dex'
info: write 'fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core/tmp/services.jar/patched-dex'
Expand All @@ -154,11 +154,11 @@ deleting: classes.dex

Finally, add the corresponding UI patch:

`$ ./patch-fileset patches/sigspoof-ui-global-4.1-6.0/ fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core/`
`$ ./patch-fileset patches/sigspoof-ui-global-4.1-6.0/ 23 fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core/`
```
>>> target directory: fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core__sigspoof-ui-global-4.1-6.0
>>> apply patch: services.jar
>>> dexpatcher --verbose --output fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core__sigspoof-ui-global-4.1-6.0/tmp/services.jar/patched-dex --multi-dex fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core/services.jar patches/sigspoof-ui-global-4.1-6.0/services.jar.dex
>>> dexpatcher --api-level 23 --verbose --output fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core__sigspoof-ui-global-4.1-6.0/tmp/services.jar/patched-dex --multi-dex fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core/services.jar patches/sigspoof-ui-global-4.1-6.0/services.jar.dex
info: read 'fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core/services.jar'
info: read 'patches/sigspoof-ui-global-4.1-6.0/services.jar.dex'
info: write 'fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core__sigspoof-ui-global-4.1-6.0/tmp/services.jar/patched-dex'
Expand All @@ -167,7 +167,7 @@ info: write 'fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core__sigspoof-ui-glob
deleting: classes.dex
adding: classes.dex (deflated 55%)
>>> apply patch: Settings.apk
>>> dexpatcher --verbose --output fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core__sigspoof-ui-global-4.1-6.0/tmp/Settings.apk/patched-dex --multi-dex fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core/Settings.apk patches/sigspoof-ui-global-4.1-6.0/Settings.apk.dex
>>> dexpatcher --api-level 23 --verbose --output fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core__sigspoof-ui-global-4.1-6.0/tmp/Settings.apk/patched-dex --multi-dex fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core/Settings.apk patches/sigspoof-ui-global-4.1-6.0/Settings.apk.dex
info: read 'fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core/Settings.apk'
info: read 'patches/sigspoof-ui-global-4.1-6.0/Settings.apk.dex'
info: write 'fs-oneplus2__sigspoof-hook-4.1-6.0__sigspoof-core__sigspoof-ui-global-4.1-6.0/tmp/Settings.apk/patched-dex'
Expand Down
11 changes: 6 additions & 5 deletions build-patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ base_suffix=.
source "$(dirname "$(readlink -f "$0")")/$base_suffix/.global"

if [ "$3" == "" ]; then
usage "build-patch <patch-source-dir> <fileset-dir> [ <target-dir-to-create> [ <java-version> ] ]"
usage "build-patch <patch-source-dir> <fileset-api-level> <fileset-dir> [ <target-dir-to-create> [ <java-version> ] ]"
fi

patch_source_dir="${1%/}"
fileset_dir="${2%/}"
patch_build_dir="${3%/}"
java_version="${4:-$default_java_version}"
api_level="$2"
fileset_dir="${3%/}"
patch_build_dir="${4%/}"
java_version="${5:-$default_java_version}"

check_dir "$patch_source_dir"
check_fileset "$fileset_dir"
Expand Down Expand Up @@ -87,6 +88,6 @@ rm -rf "$tmp_dir"
echo
echo "*** apply fileset patch (dry-run)"

"$base_dir/patch-fileset" "$patch_build_dir" "$fileset_dir" --dry-run
"$base_dir/patch-fileset" "$patch_build_dir" "$api_level" "$fileset_dir" --dry-run

echo "*** build-patch: success"
8 changes: 4 additions & 4 deletions bulk-patch-builder/build-all
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ build_one() {
echo

local patch_source_dir="$patches_source_dir/$patch_name"
#local api_level="$(cut -d '-' -f 1 <<<"$fileset_name")"
local api_level="$(cut -d '-' -f 1 <<<"$fileset_name")"
local patch_dex_dir="$patch_tmp_dir/${patch_name}__$fileset_name"
patch_dex_dirs+=( "$patch_dex_dir" )

"$base_dir/build-patch" "$patch_source_dir" "$fileset_dir" "$patch_dex_dir"
"$base_dir/build-patch" "$patch_source_dir" "$api_level" "$fileset_dir" "$patch_dex_dir"

echo

Expand Down Expand Up @@ -70,11 +70,11 @@ apply_one() {
echo

local patch_dex_dir="$patch_tmp_dir/${patch_name}__$fileset_name"
#local api_level="$(cut -d '-' -f 1 <<<"$fileset_name")"
local api_level="$(cut -d '-' -f 1 <<<"$fileset_name")"
local patched_fileset_dir="$fileset_tmp_dir/${fileset_name}__$patch_name"
#patched_fileset_dirs+=( "$patched_fileset_dir" )

"$base_dir/patch-fileset" "$patch_dex_dir" "$fileset_dir" "$patched_fileset_dir"
"$base_dir/patch-fileset" "$patch_dex_dir" "$api_level" "$fileset_dir" "$patched_fileset_dir"

if [ -d "$fileset_dir/dedex" ]; then
ln -s -t "$patched_fileset_dir" "$fileset_dir/dedex"
Expand Down
15 changes: 8 additions & 7 deletions patch-fileset
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ source "$(dirname "$(readlink -f "$0")")/$base_suffix/.global"
dry_run_option="--dry-run"

if [ "$3" == "" ]; then
usage "patch-fileset <patch-dex-dir> <fileset-dir> [ <target-dir-to-create> | $dry_run_option [ <dexpatcher-option> ... ] ]"
usage "patch-fileset <patch-dex-dir> <fileset-api-level> <fileset-dir> [ <target-dir-to-create> | $dry_run_option [ <dexpatcher-option> ... ] ]"
fi

patch_dex_dir="${1%/}"
fileset_dir="${2%/}"
patched_filterset_dir="${3%/}"
global_dexpatcher_options=( "${@:4}" )
api_level="$2"
fileset_dir="${3%/}"
patched_filterset_dir="${4%/}"
global_dexpatcher_options=( "${@:5}" )

check_dir "$patch_dex_dir"
check_fileset "$fileset_dir"
Expand Down Expand Up @@ -53,7 +54,7 @@ apply_patch_part() {

echo ">>> apply patch: $name"

local dexpatcher_options=( "${global_dexpatcher_options[@]}" --verbose )
local dexpatcher_options=( "${global_dexpatcher_options[@]}" --api-level "$api_level" --verbose )

if $wet_run; then

Expand Down Expand Up @@ -105,9 +106,9 @@ apply_patch_part() {

else

#if (( "$api_level" >= 21 )); then
if (( "$api_level" >= 21 )); then
dexpatcher_options+=( --multi-dex )
#fi
fi
run_dexpatcher "${dexpatcher_options[@]}" "$fileset_dir/$name" "$patch_dex_dir/${name}.dex"

if $wet_run; then
Expand Down
Loading

0 comments on commit 462225d

Please sign in to comment.