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

Package flags not preserved on upgrade #4

Open
jck112 opened this issue Jan 17, 2024 · 0 comments · May be fixed by #1
Open

Package flags not preserved on upgrade #4

jck112 opened this issue Jan 17, 2024 · 0 comments · May be fixed by #1

Comments

@jck112
Copy link

jck112 commented Jan 17, 2024

Currently the auto_installed flag is cleared and the user flag is set whenever a package is upgraded. This prevents upgraded dependent packages from being removed with --autoremove.

For example on a NanoPi R4S running 23.05.2:

  1. Installing vim installs the dependencies terminfo and libncurses6.
root@OpenWrt:~# opkg install vim
Installing vim (9.0-1) to root...
Downloading https://downloads.openwrt.org/releases/23.05.2/packages/aarch64_generic/packages/vim_9.0-1_aarch64_generic.ipk
Installing terminfo (6.4-2) to root...
Downloading https://downloads.openwrt.org/releases/23.05.2/packages/aarch64_generic/base/terminfo_6.4-2_aarch64_generic.ipk
Installing libncurses6 (6.4-2) to root...
Downloading https://downloads.openwrt.org/releases/23.05.2/packages/aarch64_generic/base/libncurses6_6.4-2_aarch64_generic.ipk
Configuring terminfo.
Configuring libncurses6.
Configuring vim.
  1. Initially vim has the user flag, while terminfo and libncurses6 correctly have only the auto_installed flag.
root@OpenWrt:~# sed -n '/Package: vim/,/^$/p' /usr/lib/opkg/status
Package: vim
Version: 9.0-1
Depends: libc, libncurses6
Status: install user installed
Architecture: aarch64_generic
Conffiles:
 /usr/share/vim/vimrc 3fb5e600a6c725eaf881eb70c7615d845b532ba6ee3a4b6b6786e7c19237ef92
Installed-Time: 1705510911

root@OpenWrt:~# sed -n '/Package: terminfo/,/^$/p' /usr/lib/opkg/status
Package: terminfo
Version: 6.4-2
Depends: libc
Status: install ok installed
Architecture: aarch64_generic
Installed-Time: 1705510911
Auto-Installed: yes

root@OpenWrt:~# sed -n '/Package: libncurses6/,/^$/p' /usr/lib/opkg/status
Package: libncurses6
ABIVersion: 6
Version: 6.4-2
Depends: libc, terminfo
Provides: libncursesw, libncurses, libncursesw6
Status: install ok installed
Architecture: aarch64_generic
Installed-Time: 1705510911
Auto-Installed: yes
  1. At this point running opkg remove --autoremove vim will successfully remove vim and its dependencies terminfo and libncurses6.
root@OpenWrt:~# opkg remove --autoremove vim
Removing package vim from root...
libncurses6 was autoinstalled and is now orphaned, removing.
Removing package libncurses6 from root...
terminfo was autoinstalled and is now orphaned, removing.
Removing package terminfo from root...
  1. However if we upgrade terminfo first, we can see the user flag is added and the auto_installed flag is removed.
root@OpenWrt:~# opkg upgrade terminfo
Upgrading terminfo on root from 6.4-1 to 6.4-2...
Downloading https://downloads.openwrt.org/releases/23.05.2/packages/aarch64_generic/base/terminfo_6.4-2_aarch64_generic.ipk
Configuring terminfo.

root@OpenWrt:~# sed -n '/Package: terminfo/,/^$/p' /usr/lib/opkg/status
Package: terminfo
Version: 6.4-2
Depends: libc
Status: install user installed
Architecture: aarch64_generic
Installed-Time: 1705511717
  1. Now if we run opkg remove --autoremove vim then vim and libncurses6 will be removed and its dependency terminfo will be left installed.
root@OpenWrt:~# opkg remove --autoremove vim
Removing package vim from root...
libncurses6 was autoinstalled and is now orphaned, removing.
Removing package libncurses6 from root...
jck112 added a commit to jck112/openwrt-opkg-lede that referenced this issue Jan 17, 2024
Previously the auto_installed flag was cleared and the user flag was
set whenever a package is upgraded. This prevented upgraded dependent
packages from being removed with --autoremove.

This patch preserves the auto_installed and user flags when a package
is upgraded enabling dependent packages to be identified as such after
upgrade.

Fixes: openwrt#4
Signed-off-by: Justin Klaassen <[email protected]>
@jck112 jck112 linked a pull request Jan 17, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant