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

[Enhancement]: Suggest changing non core dependencies to recommended #21068

Closed
1q23lyc45 opened this issue Aug 7, 2024 · 22 comments · Fixed by #21072
Closed

[Enhancement]: Suggest changing non core dependencies to recommended #21068

1q23lyc45 opened this issue Aug 7, 2024 · 22 comments · Fixed by #21072
Labels
enhancement php Issue is about PHP related stuff

Comments

@1q23lyc45
Copy link
Contributor

1q23lyc45 commented Aug 7, 2024

No description provided.

@Biswa96
Copy link
Member

Biswa96 commented Aug 7, 2024

Could you provide any example which would help to understand the situation better?

@1q23lyc45
Copy link
Contributor Author

1q23lyc45 commented Aug 7, 2024

Could you provide any example which would help to understand the situation better?

Let me give you an example.

~ $ apt autopurge php
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  brotli* fontconfig* freetype* gdk-pixbuf* giflib*
  glib* libandroid-posix-semaphore* libaom*
  libdav1d* libde265* libffi* libgd* libheif*
  libicu* libjpeg-turbo* libpng* librav1e*
  libresolv-wrapper* libsqlite* libtiff* libwebp*
  libx265* libxml2* libxslt* libzip* oniguruma*
  php* php-fpm* tidy* ttf-dejavu*
0 upgraded, 0 newly installed, 30 to remove and 0 not upgraded.
After this operation, 187 MB disk space will be freed.
Do you want to continue? [Y/n] n

The following packages should be changed to recommended:

brotli fontconfig freetype gdk-pixbuf libx265 libde265 libzip libjpeg-turbo libwebp libpng 

I only need PHP to build a statistical API backend, I don't need these at all.

Of course, this is a circular dependency, and I don't know which package introduced the x11 software I mentioned.

Additionally, I declare that I have not installed x11-repo!

@Biswa96
Copy link
Member

Biswa96 commented Aug 7, 2024

The following packages should be changed to recommended:

Some of those are not direct dependencies of php. Also, none of the above dependencies are from x11 repository. Please see the x11-packages directory in this git repository.

@truboxl
Copy link
Contributor

truboxl commented Aug 7, 2024

php depends libgd depends libheif which pulls in the codec stuffs

@1q23lyc45
Copy link
Contributor Author

php depends libgd depends libheif which pulls in the codec stuffs

I just built an API, I don't need a codec at all

@TomJo2000
Copy link
Member

So you suggest breaking the PHP package because you didn't need part of it.

@1q23lyc45
Copy link
Contributor Author

Who said it was deleted? I meant to change it to recommendation, not deleted

@TomJo2000
Copy link
Member

Who said it was deleted? I meant to change it to recommendation, not deleted

We'd prefer all parts of the PHP package to work out of the box.
If you want to break your PHP, you can go manually uninstall the non-absolute dependencies you mentioned above.

@TomJo2000
Copy link
Member

There is also the mandatory dependency clang for Python pin.

If there is, I cannot find it.

TERMUX_PKG_DEPENDS="gdbm, libandroid-posix-semaphore, libandroid-support, libbz2, libcrypt, libexpat, libffi, liblzma, libsqlite, ncurses, ncurses-ui-libs, openssl, readline, zlib"
TERMUX_PKG_BUILD_DEPENDS="tk"
TERMUX_PKG_RECOMMENDS="python-ensurepip-wheels, python-pip"
TERMUX_PKG_SUGGESTS="python-tkinter"

python-pip depends on clang since it is needed to build modules containing native C code.

TERMUX_PKG_DEPENDS="clang, make, pkg-config, python (>= 3.11.1-1)"

But that's a recommended package for python, not a dependency.

@Biswa96
Copy link
Member

Biswa96 commented Aug 7, 2024

Well, in this specific case, the gd php module could be split into a separate sub-package. For example,

@TomJo2000
Copy link
Member

DEPEND equals RECOMMEND? WTF! May I ask if you know any English words?

  1. You do not get to talk to me like that.
  2. Please read the documentation1 before making such claims.
    TERMUX_PKG_DEPENDS are packages that need to be installed for the package to function correctly.
    TERMUX_PKG_RECOMMENDS are packages that are usually used with the current one.
    TERMUX_PKG_SUGGESTS are packages that are related to or enhance the current one.

I recognize I should not have used the shorthand "depends" and "recommends" for the specific build script variables.

Footnotes

  1. https://github.com/termux/termux-packages/wiki/Creating-new-package#table-of-available-package-control-fields

@truboxl truboxl added enhancement php Issue is about PHP related stuff labels Aug 7, 2024
@1q23lyc45
Copy link
Contributor Author

PHP is a scripting language, not a video codec.

@TomJo2000
Copy link
Member

PHP is a scripting language, not a video codec.

A scripting language with features for interacting with web content, such as video streams.

@1q23lyc45
Copy link
Contributor Author

PHP is a scripting language, not a video codec.

A scripting language with features for interacting with web content, such as video streams.

I just need to build a PHP based backend API. I believe that a program should only do its own thing and do it well.

@1q23lyc45
Copy link
Contributor Author

My phone storage is too low. With only 2GB RAM and 16GB ROM, Android 10 takes up 9GB of ROM, along with necessary apps and cache, leaving less than 3GB. After installing a slightly larger package, the notification bar keeps popping up about insufficient storage space, and the phone keeps trying to automatically clean up junk in the background, seriously slowing down CPU speed. I really don't have any storage space to waste.

@TomJo2000
Copy link
Member

Just because you don't use all the features in PHPs standard library doesn't mean we should ship a PHP package with some of them broken out of the box.

If you'd like to remove a dependency and break your PHP;
You can use apt download php to download the PHP package without installing it,
and then manually disregard the dependencies you don't think you need using:

dpkg -i --ignore-depends=brotli,fontconfig,freetype,gdk-pixbuf,libx265,libde265,libzip,libjpeg-turbo,libwebp,libpng php_8.3.8_aarch64.deb

We do not offer any support for doing that, and you will end up with a broken PHP package.
I can appreciate your space constraints but they do not justify breaking PHP for everybody else as well.

@1q23lyc45 1q23lyc45 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 7, 2024
@1q23lyc45 1q23lyc45 changed the title [Enhancement]: Suggest changing non core dependencies to recommended . Aug 7, 2024
@Biswa96 Biswa96 changed the title . [Enhancement]: Suggest changing non core dependencies to recommended Aug 7, 2024
@licy183
Copy link
Member

licy183 commented Aug 7, 2024

There is also the mandatory dependency clang for Python pin.

The environment of Termux determines that it is much different from other distributions. As you know, other Linux distributions, such as Ubuntu, will not list C/C++ compilers (such as gcc/clang) in Depends. This is because pip has its own binary distribution PyPI. Many wheels, such as numpy/scipy, can be installed through PyPI on a normal Linux distribution. pip will automatically download the whl file of the specified tag according to the platform (such as libc version and so on) and install it. However, Termux's libc is Android's Bionic libc, and binary interpreter is /system/bin/linker(64). This causes that non-pure Python packages on PyPI cannot run on Termux. They will be compiled on device, so python-pip on Termux needs to Depends/Recommends clang. As for why it is Depends instead of Recommends, it is because Termux's apt repository provides lots packages about some well-known python wheels, and these python wheels packaged as debs need to install some python dependencies in the postinst script. Almost every of them requires C/C++ compilers, so clang must be specified as Depends, otherwise the installation will fail and the functionality of this package will break.

这个问题我来回答一下吧。Termux 的环境决定了它与其它二进制发行版有所不同。其它 Linux 发行版,例如 Ubuntu,确实没有将 C/C++ 编译器 (例如 gcc/clang) 等列入 Depends,这是因为 pip 本身存在二进制发行源 PyPI。你所见到的很多软件包,例如 numpy/scipy 等,这些都可以通过 PyPI 进行安装,pip 会根据平台的环境(比如 glibc 的版本等),自动下载指定 Tag 的 whl 文件进行安装。但是,众所周知,Termux 的 libc 是安卓原生的 Bionic libc,它的二进制解释器是来自系统的 /system/bin/linker(64),这也就造成了 PyPI 上的非纯 Python 包不能在 Termux 上运行,它们会在 Termux 上就地编译,因此 Termux 上的 python-pip 需要依赖于/建议安装 clang。至于为什么它是 Depends 而不是 Recommends,这是因为现在 Termux 打包了许多 Python Wheels,而这些被打包成 deb 包的 Python Wheels 会在 postinst 脚本中安装一些依赖,这些依赖几乎都是需要 C/C++ 编译器的,因此这里必须指定为 Depends,否则安装将会失败,影响它们正常运行。

PHP is a scripting language, not a video codec.

Termux, like other binary distributions, provides as complete functionality as possible for each package. But diffrent from other distribution, in order to save maintenance time, packages, like python, php and so on, are not splitted as finely as other distributions. For example, python3 on Debian is splitted into python3-minimal, libpython3-stdlib, libpython3-minimal, python3-venv and python3. This is why php inevitably depends on some packages that it may seem unrelated to.

Termux 和其它二进制发行版一样,会为每个软件包提供尽可能完整的功能。但是和其它发行版不同的是,为了节省维护的时间成本,类似 python, php 等类似的包并没有像其它发行版一样分的太细,比如 python3 在 Debian 上就分为了 python3-minimal, libpython3-stdlib, libpython3-minimal, python3-venvpython3。这也就造成了 php 会不可避免地依赖一些看上去可能和它没有什么关系的包。

DEPEND equals RECOMMEND? WTF! May I ask if you know any English words?

最后,我就不翻译了吧。在开源仓库提 issue 这很正常,但是如果用这种质问的语气提出来的 issue 真的让人非常不舒服。如果想对仓库进行贡献可以 PR,可以友好地提 issue,但用这种很冲的语气和别人说话实在是不应该。

@Biswa96
Copy link
Member

Biswa96 commented Aug 7, 2024

I have created a pull request to split gd module in separate package. I hope this will help to reduce the dependencies with php package.

@2096779623
Copy link
Member

I have created a pull request to split gd module in separate package. I hope this will help to reduce the dependencies with php package.

It only saves 967kb in total. My suggestion is to let this user change to a new device. Using a too old device is not a good thing.

~ $ pkg inf libgd
Package: libgd
Version: 1:2.3.3-4
Maintainer: @termux
Installed-Size: 688 kB
Depends: fontconfig, freetype, libheif, libiconv, libjpeg-turbo, libpng, libtiff, libwebp, zlib
Breaks: libgd-dev
Replaces: libgd-dev
Homepage: https://libgd.github.io/
Download-Size: 125 kB
APT-Sources: https://mirrors.ustc.edu.cn/termux/termux-main stable/main aarch64 Packages
Description: GD is an open source code library for the dynamic creation of images by programmers

~ $ pkg inf php-gd
Package: php-gd
Version: 8.3.8-1
Maintainer: @termux
Installed-Size: 131 kB
Depends: libgd, php (= 8.3.8-1)
Homepage: https://php.net
Download-Size: 23.0 kB
APT-Sources: https://mirrors.ustc.edu.cn/termux/termux-main stable/main aarch64 Packages
Description: gd module for PHP

@agnostic-apollo
Copy link
Member

If space is an issue when installing a package with lot of dependencies or doing apt upgrade, you can install dependencies/packages manually first one by one, so that apt doesn't download all the required package and their dependencies to cache before installing and only the package being currently installed gets downloaded and installed. You still need enough final space for all the required packages.

If you device supports an sd card, you may want to look at https://www.reddit.com/r/termux/comments/12hty88/comment/jfuv5mg/

@1q23lyc45
Copy link
Contributor Author

apt update;apt upgrade -y;apt autopurge -y
Saved 69MB. Thank you, @Biswa96 .
Now I have added this file to '/data/data/com. termux/files/usr/etc/apt/apt.conf.d/02norecommend' for use.

APT::Install-Suggests "false";
APT::Install-Recommends "false";
APT::Get::Install-Suggests "false";
APT::Get::Install-Recommends "false";

Actually, I just used two outdated knockoff phones to flash Android 7 or above, plugged in an SD card, and used it as a PHP backend server. The phone I am currently using has 128GB storage space, but due to some reasons, it is inevitable to switch IP frequently. I couldn't use it to launch the PHP website backend.

@freebrowser1
Copy link

But why not make a 'php light' for devices with low storage without all these php libraries and a 'full' php including these libraries as 8.3.8 or earlier ?
Now the gd library is broken (thanks to @Biswa96 he found a workaround in #21262) since these enhancements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement php Issue is about PHP related stuff
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants