Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unzip-silent-owerwrite-true #1556

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

unzip-silent-owerwrite-true #1556

wants to merge 1 commit into from

Conversation

Ratgor
Copy link

@Ratgor Ratgor commented Jan 31, 2023

in non-ineractive mode unzipping android ndk failed as no confirm for overwrite nor skip duplicate paths

in non-ineractive mode unzipping android ndk failed as no confirm for overwrite nor skip duplicate paths
@misl6
Copy link
Member

misl6 commented Feb 12, 2023

Hi @Ratgor !

When that is happening? (the overwriting)
Do you have a log to attach?

@Julian-O
Copy link
Contributor

I plan to replace this line of code with the new buildops library that uses Python's ZipFile rather than bash's unzip.

@Ratgor
Copy link
Author

Ratgor commented May 26, 2024

sorry for the late reply, the issue still exists

with the latest version of buildozer, I still need the fix (actually two fixes)
to build anything on Windows or via WSL on Ubuntu (latest try)

some logs below, and the fixes code

prepare image for builds

12:53:44 subprocess INFO: Executing command: docker run --rm --mount type=bind,source="/mnt/c/MyFiles/.../kivy_buider/build_android_work",destination=/home/user/hostcwd --mount type=bind,source="/mnt/c/MyFiles/.../kivy_buider/.buildozer",destination=/home/user/.buildozer --name build-android-container buildozer-image --version
12:53:44 subprocess INFO: Buildozer 1.5.1.dev0
12:53:45 subprocess INFO:
12:53:45 subprocess INFO: Subprocess run finished OK.

run the image

12:53:45 subprocess INFO: Executing command: docker run --mount type=bind,source="/mnt/c/MyFiles/.../kivy_buider/build_android_work",destination=/home/user/hostcwd --mount type=bind,source="/mnt/c/MyFiles/.../kivy_buider/.buildozer",destination=/home/user/.buildozer --name build-android-container buildozer-image android debug
<...>
12:54:29 subprocess INFO: # Android SDK is missing, downloading
12:54:29 subprocess INFO: # Downloading https://dl.google.com/android/repository/commandlinetools-linux-6514223_latest.zip
# Unpacking Android SDKO: - Download 1.21%
12:54:50 subprocess INFO: # Extracting commandlinetools-linux-6514223_latest.zip to /home/user/.buildozer/android/platform/android-sdk
12:54:50 subprocess INFO: # Run 'unzip -q -o /home/user/.buildozer/android/platform/android-sdk/commandlinetools-linux-6514223_latest.zip' ...
12:54:50 subprocess INFO: # Cwd /home/user/.buildozer/android/platform/android-sdk
12:54:50 subprocess INFO: # Android SDK tools base installation done.
12:54:50 subprocess INFO: # Recommended android's NDK version by p4a is: 25b
12:54:50 subprocess INFO: # Android NDK is missing, downloading
12:54:50 subprocess INFO: # Downloading https://dl.google.com/android/repository/android-ndk-r25-linux.zip

And, that's it. The process hangs waiting user input to confirm unpacking. It is not interactive in my case.

To cope with that I'm using the next fix (the latest version, the PR code is outdated) :

uni_file_patcher(file_path=cfg.cwd/'buildozer/buildozer/buildops.py', replace_map=[
    (142,  # <-- the line number, followed by current code and the replacement
     """                ["unzip", "-q", join(cwd, archive)], cwd=cwd, env=env\n""",
     """                ["unzip", "-q", "-o", join(cwd, archive)], cwd=cwd, env=env\n""")
])

One more fix, similar issue. Not so clean, just to know it is needed in my case too.

uni_file_patcher(file_path=cfg.cwd/'buildozer/buildozer/__init__.py', replace_map=[
    (718,
     """        if sys.stdin.readline().lower()[0] == 'y':\n""",
     """\n        if 'distclean' in sys.argv and '--yes' in sys.argv:
    buildozer_dir_parts = list(os.path.split(self.global_buildozer_dir))
    #buildozer_dir = os.path.abspath(os.path.join(*buildozer_dir_parts[:-1],'hostcwd',buildozer_dir_parts[-1]))
    buildozer_dir = os.path.abspath(self.global_buildozer_dir)
    self.info(f'[Patched] Clean the global build directory ({buildozer_dir} exists {exists(buildozer_dir)})')
    if exists(buildozer_dir):
        rmtree(buildozer_dir)
        return
    \n        if ('distclean' in sys.argv and '--yes' in sys.argv) \\
                      or sys.stdin.readline().lower()[0] == 'y':\n"""),
    (719,
     """            self.logger.info('Clean the global build directory')\n""",
     """            self.logger.info(f'Clean the global build directory """
     """({self.global_buildozer_dir} exists {exists(self.global_buildozer_dir)})')\n""")
])

Julian-O commented on Jul 30, 2023: I plan to replace this line of code with the new buildops library that uses Python's ZipFile rather than bash's unzip.

I think it would be a nice solution (instead of the first my fix)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants