Skip to content

Commit

Permalink
Remove the old library with the same name as the new library from PKG…
Browse files Browse the repository at this point in the history
…COMPATDIR.
  • Loading branch information
kdeguchi committed May 14, 2024
1 parent 7369ee1 commit 526f94d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
20240614
*Remove the old library with the same name as the new library from PKGCOMPATDIR.
See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268652

20240507
*Fix handling of removed ports.

Expand Down
6 changes: 4 additions & 2 deletions pkg_replace.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" $Id: pkg_replace.1,v 1.2 2007/01/25 12:25:56 securedog Exp $
.\"
.\" Modified by Ken DEGUCHI (February 9, 2024)"
.Dd February 9, 2024
.\" Modified by Ken DEGUCHI (May 14, 2024)"
.Dd May 14, 2024
.Dt PKG_REPLACE 1
.Os
.Sh NAME
Expand Down Expand Up @@ -210,6 +210,8 @@ By default,
.Nm
preserves old shared libraries in
.Va PKGCOMPATDIR .
But if the new library and the old library have the same name, the old library is removed from
.Va PKGCOMPATDIR.
.Pp
.It Fl v
Turn on verbose output.
Expand Down
21 changes: 19 additions & 2 deletions pkg_replace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# - Cleanup Code


PKG_REPLACE_VERSION=20240507
PKG_REPLACE_VERSION=20240514
PKG_REPLACE_CONFIG=FreeBSD

usage() {
Expand Down Expand Up @@ -869,7 +869,7 @@ install_pkg_binary() {
}

install_package() {
local install_args
local install_args file
install_args=

info "Installing '$1'"
Expand All @@ -879,6 +879,23 @@ install_package() {

cd "$1" || return 1
xtry ${PKG_MAKE} ${install_args} reinstall || return 1

! isempty ${preserved_files} && {
for file in $(${PKG_QUERY} '%Fp' $(${PKG_MAKE} -V PKGNAME)); do
case ${file##*/} in
*.so.[0-9]*|*.so)
case " ${preserved_files} " in
*[[:space:]]${file}[[:space:]]*)
istrue ${opt_verbose} &&
info "Remove the same name library: '${PKGCOMPATDIR}/${file##*/}'"
xtry rm -f ${PKGCOMPATDIR}/${file##*/}
;;
esac
;;
esac
done
}

istrue ${pkg_unlock} && ${PKG_LOCK} -y $(get_pkgname_from_portdir $1)
if istrue ${opt_afterclean}; then
clean_package $1
Expand Down

0 comments on commit 526f94d

Please sign in to comment.