Skip site navigation (1)Skip section navigation (2)
Date:      18 Apr 2003 02:14:44 -0400
From:      Joe Marcus Clarke <marcus@marcuscom.com>
To:        Kris Kennaway <kris@obsecurity.org>
Cc:        ports@freebsd.org
Subject:   Re: Recent bsd.port.mk changes
Message-ID:  <1050646484.58286.108.camel@shumai.marcuscom.com>
In-Reply-To: <20030418045754.GA94741@rot13.obsecurity.org>
References:  <1050640352.58286.22.camel@shumai.marcuscom.com> <20030418045754.GA94741@rot13.obsecurity.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-EV4J1CM8vOysuuTdwzbt
Content-Type: multipart/mixed; boundary="=-unoyvTcUpUSGvpvD8q8f"


--=-unoyvTcUpUSGvpvD8q8f
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Fri, 2003-04-18 at 00:57, Kris Kennaway wrote:
> On Fri, Apr 18, 2003 at 12:32:32AM -0400, Joe Marcus Clarke wrote:
> > Kris, I don't think I agree with one of the changes that went in to
> > bsd.port.mk today.  I'm trying to do an upgrade of libgtkhtml from 2.2.=
2
> > to 2.2.3.  When I do such things, I install the new port to an alternat=
e
> > PREFIX while keeping the old version around.  With the recent changes, =
I
> > can no longer do this.  The ports system informs me that:
> >=20
> > =3D=3D=3D>  Installing for libgtkhtml-2.2.3
> > =3D=3D=3D>  libgtkhtml-2.2.3 is already installed - perhaps an older ve=
rsion?
> >       If so, you may wish to ``make deinstall'' and install
> >       this port again by ``make reinstall'' to upgrade it properly.
> >       If you really wish to overwrite the old port of libgtkhtml-2.2.3
> >       without deleting it first, set the variable "FORCE_PKG_REGISTER"
> >       in your environment or the "make install" command line.
> > *** Error code 1
> >=20
> > When, in fact, it is not installed.  libgtkhtml-2.2.2 is installed.  Th=
e
> > change in question is at line 2879 (the check to see if another port
> > with this ports origin is installed [ports/48646]).  Yes, I can set
> > FORCE_PKG_REGISTER, but when I go to make deinstall, it now removes
> > _both_ ports.  I'd like to request this, and possibly the smarter make
> > deinstall be backed out.
>=20
> Hmm..but previously if you had libgtkhtml-2.2.3 installed (i.e. the
> same version) this would also have failed.

Right, and I accept that.  Except this wasn't the case, nor is it
usually in what I do.

>=20
> The major benefit of this change is that it prevents people from
> installing one copy of the port over an older version, thereby
> screwing up their /var/db/pkg and possibly leaving orphan files lying
> around.  I think that is important enough that it should stay in, in
> some form.

Yes, I can see the advantage, but it now adds extra work (for me, maybe
others).  The reason I Cc'd ports was to get an idea if others thought
the same way I did.

>=20
> In your case since the PREFIX is different they don't actually
> conflict so one might argue that it should be allowed.  I suppose
> that's something that could be checked in bsd.port.mk by extracting
> the prefix for the existing package from the contents file and
> comparing to PREFIX.

This would be acceptable.  However, the make deinstall would still
remove both versions.  What about keeping make deinstall the same as it
was with one exception: if you type make deinstall in a port directory,
and the version specified by that port's Makefile is not installed (but
another version with the same origin is), then the other version would
be deinstalled.  However, if a package is found that matches the version
specified in the port's Makefile, then only that version is removed.  We
could then add a make deinstall-all target to handle deinstalling all
packages with the same origin.  Something like what's attached.

Joe

>=20
> Kris
--=20
PGP Key : http://www.marcuscom.com/pgp.asc

--=-unoyvTcUpUSGvpvD8q8f
Content-Disposition: attachment; filename=bsd.port.mk.diff
Content-Type: text/plain; name=bsd.port.mk.diff; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

--- bsd.port.mk.orig	Fri Apr 18 00:22:02 2003
+++ bsd.port.mk	Fri Apr 18 02:11:53 2003
@@ -2875,12 +2875,24 @@
 .if !target(check-already-installed)
 check-already-installed:
 .if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER)
-	@if [ -d ${PKG_DBDIR}/${PKGNAME} -o \
-	    "x`${PKG_INFO} -q -O ${PKGORIGIN} 2> /dev/null`" !=3D "x" ]; then \
-		${ECHO_CMD} "=3D=3D=3D>  ${PKGNAME} is already installed - perhaps an ol=
der version?"; \
+	@already_installed=3D`${PKG_INFO} -q -O ${PKGORIGIN} 2> /dev/null`; \
+	found_package=3D""; \
+	check_name=3D""; \
+	if [ -n "$${already_installed}" ]; then \
+		for p in $${already_installed}; do \
+			if [ "x${PREFIX}" =3D "x`${PKG_INFO} -q -p $${p} | ${SED} -e 's|^@cwd |=
|'`" ]; then \
+				found_package=3D$${p}; \
+				check_name=3D$${p}; \
+			fi; \
+		done; \
+	fi; \
+	${TEST} -z $${check_name} && check_name=3D${PKGNAME}; \
+	if [ -d ${PKG_DBDIR}/${PKGNAME} -o \
+		-n "$${found_package}" ]; then \
+		${ECHO_CMD} "=3D=3D=3D>  ${PKGORIGIN} is already installed ($${check_nam=
e})- perhaps an older version?"; \
 		${ECHO_CMD} "      If so, you may wish to \`\`make deinstall'' and insta=
ll"; \
 		${ECHO_CMD} "      this port again by \`\`make reinstall'' to upgrade it=
 properly."; \
-		${ECHO_CMD} "      If you really wish to overwrite the old port of ${PKG=
NAME}"; \
+		${ECHO_CMD} "      If you really wish to overwrite the old port of ${PKG=
ORIGIN}"; \
 		${ECHO_CMD} "      without deleting it first, set the variable \"FORCE_P=
KG_REGISTER\""; \
 		${ECHO_CMD} "      in your environment or the \"make install\" command l=
ine."; \
 		exit 1; \
@@ -3228,14 +3240,34 @@
=20
 .if !target(deinstall)
 deinstall:
+	@if ${PKG_INFO} -e ${PKGNAME}; then \
+	    deinstall_name=3D${PKGNAME}; \
+	else \
+	    deinstall_name=3D`${PKG_INFO} -q -O ${PKGORIGIN} 2> /dev/null`; \
+	fi; \
+	${ECHO_MSG} "=3D=3D=3D>  Deinstalling for ${PKGORIGIN} ($${deinstall_name=
})"; \
+	if ${PKG_INFO} -e $${deinstall_name}; then \
+	    ${PKG_DELETE} -f $${deinstall_name}; \
+	else \
+	    ${ECHO_MSG} "=3D=3D=3D>   ${PKGORIGIN} not installed, skipping"; \
+	fi
+	@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
+.endif
+
+# Deinstall-all
+#
+# Special target to remove installation of all ports of the same origin
+
+.if !target(deinstall-all)
+deinstall-all:
 	@deinstall_name=3D`${PKG_INFO} -q -O ${PKGORIGIN} 2> /dev/null`; \
 	${TEST} -z $${deinstall_name} && deinstall_name=3D${PKGNAME}; \
 	${ECHO_MSG} "=3D=3D=3D>  Deinstalling for ${PKGORIGIN} ($${deinstall_name=
})"; \
 	if ${PKG_INFO} -e $${deinstall_name}; then \
 		${PKG_DELETE} -f $${deinstall_name}; \
-	 else \
-	    ${ECHO_MSG} "=3D=3D=3D>   ${PKGORIGIN} not installed, skipping"; \
-	 fi
+	else \
+		${ECHO_MSG} "=3D=3D=3D>   ${PKGORIGIN} not installed, skipping"; \
+	fi
 	@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
 .endif
=20

--=-unoyvTcUpUSGvpvD8q8f--

--=-EV4J1CM8vOysuuTdwzbt
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQA+n5fUb2iPiv4Uz4cRAuEpAJ97QlcxbEyueRS7kV18FzbBQF0ghgCfQqLB
0HQ4j2mqYDWCVzeE+AOi+M8=
=s7Pj
-----END PGP SIGNATURE-----

--=-EV4J1CM8vOysuuTdwzbt--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1050646484.58286.108.camel>