nmeum / android-tools

Unoffical CMake-based build system for android command line utilities
Apache License 2.0
191 stars 57 forks source link

zsh completions are broken #38

Closed lilydjwg closed 3 years ago

lilydjwg commented 3 years ago

Please don't install bash completion scripts to zsh. They don't work. Zsh itself already ships a _adb completion script which works great.

Broken by #23.

nmeum commented 3 years ago

Please don't install bash completion scripts to zsh.

Actually, these completion files should be compatible with both zsh and bash. See https://github.com/nmeum/android-tools/issues/22#issuecomment-813098533

lilydjwg commented 3 years ago

I've heard zsh has a bash completion utility. With some changes and enabling it, it does work, and like bash....

I still prefer the _adb that comes with zsh. It provides more native experience.

Zsh itself doesn't have a _fastboot completion so the bash one is useful.

anatol commented 3 years ago

Using native _adb zsh completion sounds fine to me.

@lilydjwg could you please send a patch for it?

anatol commented 3 years ago

So I just made a simple patch for it.

Unfortunately I cannot test the build as master is in a weird state for me now:

Applying: libsepol: fix inclusion of dso.h header file
-- Applying patches for: e2fsprogs
Applying: linux/types.h seem to already define __bitwise
-- Applying patches for: incremental_delivery
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
CMake Error at vendor/CMakeLists.txt:30 (message):
  Couldn't apply patches for incremental_delivery
nmeum commented 3 years ago

Strange, works here is the incremental_delivery submodule in a clean state?

anatol commented 3 years ago

I make the state clean with git reset --hard --recurse-submodules. git status show the clean state, I run build with cmake -G Ninja -S . -B build, it fails with the error above and at this point I have a dirty tree state:

➜  android-tools git:(master) git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

You are in the middle of an am session.
  (fix conflicts and then run "git am --continue")
  (use "git am --skip" to skip this patch)
  (use "git am --abort" to restore the original branch)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   vendor/adb (new commits)
    modified:   vendor/base (new commits)
    modified:   vendor/core (new commits)
    modified:   vendor/e2fsprogs (new commits)
    modified:   vendor/extras (new commits)
    modified:   vendor/libbase (new commits)
    modified:   vendor/libziparchive (new commits)
    modified:   vendor/logging (new commits)
    modified:   vendor/native (new commits)
    modified:   vendor/selinux (new commits)
nmeum commented 3 years ago

I make the state clean with git reset --hard --recurse-submodules. git status show the clean state, I run build with cmake -G Ninja -S . -B build, it fails with the error above and at this point I have a dirty tree state:

Hm, weird. What does the git status output in vendor/incremental_delivery look like?

Otherwise: Try cd vendor/incremental_delivery/ and manually apply the patches there with git am ../../patches/incremental_delivery/*.patch. That's basically what the CMake file does automatically, running these commands manually might ease debugging your problem.

anatol commented 3 years ago

git submodules behave weird for me. And TBH i've never fully understand the logic behind the submodules operations.

Anyway I checked out vendor/incremental_delivery manually and now it build/installs fine:

➜  build git:(master) DESTDIR=1 ninja install
[0/1] Install the project...
-- Install configuration: ""
-- Installing: 1/usr/local/share/bash-completion/completions/adb
-- Installing: 1/usr/local/share/bash-completion/completions/fastboot
-- Installing: 1/usr/local/share/zsh/site-functions/_fastboot
-- Installing: 1/usr/local/bin/adb
-- Installing: 1/usr/local/bin/fastboot
-- Installing: 1/usr/local/bin/mke2fs.android
-- Installing: 1/usr/local/bin/simg2img
-- Installing: 1/usr/local/bin/img2simg
-- Installing: 1/usr/local/bin/append2simg
-- Installing: 1/usr/local/share/android-tools/completions/adb
-- Installing: 1/usr/local/share/android-tools/completions/fastboot
anatol commented 3 years ago

fastboot zsh completion neither works for me. Though it works fine with bash.