Bug 49017

Summary: 'make deinstall' doesn't deinstall old version of ports
Product: Ports & Packages Reporter: Sergey Matveychuk <sem>
Component: Individual Port(s)Assignee: Port Management Team <portmgr>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
deinstall_origin.patch none

Description Sergey Matveychuk 2003-03-07 21:40:11 UTC
	
	When user do 'make deinstall' he supposes port deinstalls.
	But if he's cvsuped before and has downloaded a new version of port
	he'll get messages that port don't installed. It's discourage him.
	
	We can fix it if port will be deinstalled by ORIGIN.
	Followed patch make it on 5.0 but absolutely harmless for 4.x.

	(See also PR/48646 when I used ORIGIN in check-already-installed target)
Comment 1 corecode@corecode.ath.cx 2003-03-08 01:30:00 UTC
Lately Sergey Matveychuk told:

> --- bsd.port.mk.orig	Sun Mar  2 05:06:56 2003
> +++ bsd.port.mk	Fri Mar  7 00:37:39 2003
> @@ -3187,12 +3187,16 @@
>  # Special target to remove installation
>  
>  .if !target(deinstall)
> +deinstall_name!=${PKG_INFO} -q -O ${PKGORIGIN} 2> /dev/null || ${TRUE}
> +.if ${deinstall_name} == ""
> +deinstall_name=${PKGNAME}
> +.endif

it doesn't feel good to run pkg_info every time bsd.port.mk is used.
how about:

.if !target(deinstall)
deinstall:
 	@deinstall_name=`${PKG_INFO} -q -O ${PKGORIGIN} 2> /dev/null`; \
	${TEST} -z $${deinstall_name} && deinstall_name=${PKGNAME}; \
	${ECHO_MSG} "===>  Deinstalling for ${PKGORIGIN} ($${deinstall_name})"; \
	if ${PKG_INFO} -e $${deinstall_name}; then \
		${PKG_DELETE} -f $${deinstall_name}; \
	else \
		${ECHO_MSG} "===>   ${PKGORIGIN} not installed, skipping"; \
	fi
	@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
.endif

-- 
/"\   http://corecode.ath.cx/#donate
\ /
 \     ASCII Ribbon Campaign
/ \  Against HTML Mail and News
Comment 2 Sergey Matveychuk 2003-03-08 21:51:15 UTC
Agree. It looks much better. Thank you!

----
Sem.
Comment 3 Sergey Matveychuk 2003-03-15 23:14:23 UTC
I'v tested it. Looks good.
Here is it as patch for easy applying.

----
Sem.
Comment 4 Mark Linimon 2003-04-05 20:16:56 UTC
Shouldn't this be assigned to portmgr, not freebsd-ports-bugs?
Comment 5 Edwin Groothuis freebsd_committer freebsd_triage 2003-04-06 00:14:14 UTC
Responsible Changed
From-To: freebsd-ports-bugs->portmgr

Suggested that it is portmgr territory.
Comment 6 Kris Kennaway freebsd_committer freebsd_triage 2003-04-13 04:22:41 UTC
State Changed
From-To: open->analyzed

Currently being tested on bento
Comment 7 Kris Kennaway freebsd_committer freebsd_triage 2003-04-17 11:30:18 UTC
State Changed
From-To: analyzed->closed

Patch committed, thanks!