ports/56389: [PATCH] port sysutils/pkg_install: fix `make deinstall' and compilation on systems <= 4.4

Oliver Eikemeier eikemeier at fillmore-labs.com
Thu Sep 4 01:00:36 UTC 2003


>Number:         56389
>Category:       ports
>Synopsis:       [PATCH] port sysutils/pkg_install: fix `make deinstall' and compilation on systems <= 4.4
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 03 18:00:33 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Eikemeier
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
Fillmore Labs - http://www.fillmore-labs.com
>Environment:
System: FreeBSD nuuk.fillmore-labs.com 4.8-STABLE

>Description:

- fix compilation on systems <= 4.4 (PR ports/56324)
  PERL is in the base system on those systems, REINPLACE_CMD not

- enable `make deinstall' of this port or other ports if this port
  is not installed

- use pkg_info from the port if it is installed on all systems
  (enables 4.7 users to use conflict checking)

- package does not change, so no PORTREVISION bump.

It does not address problems with PACKAGE-DEPENDS-LIST if the
port is not installed, but hey, leave the port in place or
upgrade your system.

>How-To-Repeat:
>Fix:

--- pkg_install.patch begins here ---
--- sysutils/pkg_install/Makefile.orig	Tue Sep  2 04:07:22 2003
+++ sysutils/pkg_install/Makefile	Thu Sep  4 02:38:55 2003
@@ -24,34 +24,15 @@
 
 .include <bsd.port.pre.mk>
 
-.if ${OSVERSION} < 460102
-check-already-installed:
-.if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER)
-	@if [ -d ${PKG_DBDIR}/${PKGNAME} ]; then \
-		${ECHO_CMD} "===>  ${PKGNAME} is already installed - perhaps an older version?"; \
-		${ECHO_CMD} "      If so, you may wish to \`\`make deinstall'' and install"; \
-		${ECHO_CMD} "      this port again by \`\`make reinstall'' to upgrade it properly."; \
-		${ECHO_CMD} "      If you really wish to overwrite the old port of ${PKGNAME}"; \
-		${ECHO_CMD} "      without deleting it first, set the variable \"FORCE_PKG_REGISTER\""; \
-		${ECHO_CMD} "      in your environment or the \"make install\" command line."; \
-		exit 1; \
-	fi
-.else
-	@${DO_NADA}
-.endif
+.if ${OSVERSION} < 440001 || ( ${OSVERSION} >= 500000 && ${OSVERSION} < 500024 )
+post-patch:
+	@${FIND} ${WRKSRC} -name '*.c' \
+		| ${XARGS} ${PERL} -pi.orig -e 's/__FBSDID\(("[^"]*")\)/static const char rcsid[] = $$1/'
 .endif
 
 pre-configure:
 	@${SED} -e 's,%%PREFIX%%,${PREFIX},g' \
 		-e 's,%%MANPREFIX%%,${MANPREFIX},g' \
 		${FILESDIR}/Makefile.inc > ${WRKDIR}/Makefile.inc
-
-deinstall:
-	@if ${PKG_INFO} -e ${PKGNAME}; then \
-		${PKG_DELETE} -f ${PKGNAME}; \
-	else \
-		${ECHO_MSG} "===> ${PKGNAME} not installed; skipping"; \
-	fi
-	@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
 
 .include <bsd.port.post.mk>
--- pkg_install.patch ends here ---

--- bsd.port.mk.patch begins here ---
--- /usr/ports/Mk/bsd.port.mk.orig	Thu Sep  4 02:05:03 2003
+++ /usr/ports/Mk/bsd.port.mk	Thu Sep  4 02:30:48 2003
@@ -1,7 +1,7 @@
 #-*- mode: makefile; tab-width: 4; -*-
 # ex:ts=4
 #
-# $FreeBSD: ports/Mk/bsd.port.mk,v 1.468 2003/09/03 19:50:24 obrien Exp $
+# $FreeBSD: ports/Mk/bsd.port.mk,v 1.466 2003/08/29 02:26:02 marcus Exp $
 #	$NetBSD: $
 #
 #	bsd.port.mk - 940820 Jordan K. Hubbard.
@@ -1777,24 +1777,26 @@
 PKGORIGIN?=		${PKGCATEGORY}/${PORTDIRNAME}
 .endif
 
-.if ${OSVERSION} < 460102 && ${PKGORIGIN} != "sysutils/pkg_install"
+.if (${OSVERSION} < 460102 || ( ${OSVERSION} >= 500000 && ${OSVERSION} < 500035 )) && ${PKGORIGIN} != "sysutils/pkg_install"
 BUILD_DEPENDS+=	${LOCALBASE}/sbin/pkg_info:${PORTSDIR}/sysutils/pkg_install
+.endif
+
 .if exists(${LOCALBASE}/sbin/pkg_info)
 PKG_CMD?=		${LOCALBASE}/sbin/pkg_create
 PKG_ADD?=		${LOCALBASE}/sbin/pkg_add
-PKG_DELETE?=	${LOCALBASE}/sbin/pkg_delete
+PKG_DELETE?=		${LOCALBASE}/sbin/pkg_delete
 PKG_INFO?=		${LOCALBASE}/sbin/pkg_info
 .else
 PKG_CMD?=		/usr/sbin/pkg_create
 PKG_ADD?=		/usr/sbin/pkg_add
-PKG_DELETE?=	/usr/sbin/pkg_delete
+PKG_DELETE?=		/usr/sbin/pkg_delete
 PKG_INFO?=		/usr/sbin/pkg_info
 .endif
-.else
-PKG_CMD?=		/usr/sbin/pkg_create
-PKG_ADD?=		/usr/sbin/pkg_add
-PKG_DELETE?=	/usr/sbin/pkg_delete
-PKG_INFO?=		/usr/sbin/pkg_info
+
+# Does pkg_info support listing all packages with the same origin?
+_ORIGIN_FAILED!=	${PKG_INFO} -q -O "sysutils/portupgrade" >/dev/null 2>&1 || ${ECHO_CMD} YES
+.if ${_ORIGIN_FAILED:U} == YES
+DISABLE_ORIGIN=		YES
 .endif
 
 # Does the pkg_create tool support conflict checking?
@@ -3108,6 +3110,7 @@
 .if !target(check-already-installed)
 check-already-installed:
 .if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER)
+.if !defined(DISABLE_ORIGIN)
 		@${ECHO_MSG} "===>  Checking if ${PKGORIGIN} already installed"
 		@${MKDIR} ${PKG_DBDIR}
 		@already_installed=`${PKG_INFO} -q -O ${PKGORIGIN} 2> /dev/null`; \
@@ -3122,7 +3125,8 @@
 								fi; \
 						fi; \
 				done; \
-		fi; \
+		fi
+.endif
 		if [ -d ${PKG_DBDIR}/${PKGNAME} -o -n "$${found_package}" ]; then \
 				if [ -d ${PKG_DBDIR}/${PKGNAME} ]; then \
 						${ECHO_CMD} "===>   ${PKGNAME} is already installed"; \
@@ -3504,6 +3508,7 @@
 
 .if !target(deinstall)
 deinstall:
+.if !defined(DISABLE_ORIGIN)
 	@${ECHO_MSG} "===>  Deinstalling for ${PKGORIGIN}"
 	@found_names=`${PKG_INFO} -q -O ${PKGORIGIN} 2> /dev/null`; \
 	for p in $${found_names}; do \
@@ -3521,6 +3526,14 @@
 	if [ -z "$${found_names}" ]; then \
 			${ECHO_MSG} "===>   ${PKGBASE} not installed, skipping"; \
 	fi
+.else
+	@${ECHO_MSG} "===>  Deinstalling for ${PKGNAME}"
+	@if ${PKG_INFO} -e ${PKGNAME}; then \
+		${PKG_DELETE} -f ${PKGNAME}; \
+	else \
+		${ECHO_MSG} "===>   ${PKGNAME} not installed, skipping"; \
+	fi
+.endif
 	@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
 .endif
 
--- bsd.port.mk.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list