termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.15k stars 3.02k forks source link

[Bug]: install an alternative package #20941

Closed alexbodn closed 2 months ago

alexbodn commented 2 months ago

Problem description

i wish to create a package that is an alternative to another package, and provides the same functionality. the files in these packages conflict, naturally.

What steps will reproduce the bug?

i made a package b that "replaces" package a. it also breaks it and conflicts with it. trying to install package b, while a is installed, and d depends on a.

What is the expected behavior?

pkg install asks permission to uninstall a and d.

System information

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=26426
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages.termux.dev/apt/termux-main stable main
Updatable packages:
All packages up to date
termux-tools version:
1.43.1
Android version:
13
Kernel build information:
Linux localhost 5.4.233-qgki-g963372470dcb #1 SMP PREEMPT Wed Jun 19 13:51:57 UTC 2024 aarch64 Android
Device manufacturer:
HMD Global
Device model:
Nokia XR20
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.api versionCode:51
TomJo2000 commented 2 months ago

I think what you are asking is to break and replace a package at the same time. There's quite a lot of packages where that had to previously be done. Here's one example. https://github.com/termux/termux-packages/blob/697c89b4720b1b5bb32c1bfb549526b2f6d0853c/packages/util-linux/build.sh#L19-L20 You just need to set both TERMUX_PKG_BREAKS and TERMUX_PKG_REPLACES.

licy183 commented 2 months ago

You should set TERMUX_PKG_CONFLICTS and TERMUX_PKG_PROVIDES, and also be better to set TERMUX_PKG_REPLACES.

TomJo2000 commented 2 months ago

Are those new, or did I just miss them?

alexbodn commented 2 months ago

You should set TERMUX_PKG_CONFLICTS and TERMUX_PKG_PROVIDES, and also be better to set TERMUX_PKG_REPLACES.

thank you very much. i missed provides. this is the debian solution, indeed.

alexbodn commented 2 months ago

I think what you are asking is to break and replace a package at the same time. There's quite a lot of packages where that had to previously be done. Here's one example.

https://github.com/termux/termux-packages/blob/697c89b4720b1b5bb32c1bfb549526b2f6d0853c/packages/util-linux/build.sh#L19-L20

You just need to set both TERMUX_PKG_BREAKS and TERMUX_PKG_REPLACES.

that was my solution too, but that didn'work.