Bug 180725 - [PATCH] bsd.port.mk: Allow builds to fail when package dependencies do not exist
Summary: [PATCH] bsd.port.mk: Allow builds to fail when package dependencies do not exist
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Bryan Drewery
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-21 18:50 UTC by Chris Rees
Modified: 2013-09-03 14:00 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Rees 2013-07-21 18:50:02 UTC
	I'm working on improving the dependency code of Tinderbox, and it now
uses USE_PACKAGE_DEPENDS with make [step]-depends to install the dependencies
of a port that's building.

	Unfortunately, there is sometimes a dependency missing and although
the error message is easy to recognise if you understand it, I'd prefer to have
a more obvious error; compare the two logs below:

Without patch:
http://www.bayofrum.net/~crees/scratch/log.log

With USE_PACKAGE_DEPENDS_ONLY=yes:
http://www.bayofrum.net/~crees/scratch/loglog.log

This will be set internally in Tinderbox, but I can't think of a way to do it
without modifying the ports tree.

Fix: Add a USE_PACKAGE_DEPENDS_ONLY switch to force building to fail if a
package for a dependency does not exist.

While here, correct archaic and unclear style
([ X$v != X ] should be [ -n "$v" ])



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.--h5lC4uJNjOEHrEi6zv1ykeo9hmKYAbHCoLyDFzHPBtCRuCvL
Content-Type: text/plain; name="use-package-depends-only.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="use-package-depends-only.diff"

Index: bsd.port.mk
===================================================================
--- bsd.port.mk	(revision 323405)
+++ bsd.port.mk	(working copy)
@@ -4903,7 +4903,7 @@
 .endif
 
 _INSTALL_DEPENDS=	\
-		if [ X${USE_PACKAGE_DEPENDS} != "X" ]; then \
+		if [ -n "${USE_PACKAGE_DEPENDS}" ]; then \
 			subpkgfile=`(cd $$dir; ${MAKE} $$depends_args -V PKGFILE)`; \
 			subpkgname=$${subpkgfile%-*} ; \
 			subpkgname=$${subpkgname\#\#*/} ; \
@@ -4917,6 +4917,10 @@
 				else \
 					${PKG_ADD} $${subpkgfile}; \
 				fi; \
+			elif [ -n "${USE_PACKAGE_DEPENDS_ONLY}" ]; then \
+				${ECHO_MSG} "===>   ${PKGNAME} depends on package: $${subpkgfile} - not found"; \
+				${ECHO_MSG} "===>   USE_PACKAGE_DEPENDS_ONLY set - will not build from source"; \
+				exit 1; \
 			else \
 			  (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) ; \
 			fi; \
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-07-21 18:50:14 UTC
Responsible Changed
From-To: freebsd-ports-bugs->portmgr

bsd.port.mk is portmgr territory (via the GNATS Auto Assign Tool)
Comment 2 Bryan Drewery freebsd_committer freebsd_triage 2013-08-08 16:53:57 UTC
Responsible Changed
From-To: portmgr->bdrewery

I'll take it.
Comment 3 Bryan Drewery freebsd_committer freebsd_triage 2013-08-31 14:56:19 UTC
State Changed
From-To: open->closed

Committed, with minor changes. Thanks!
Comment 4 dfilter service freebsd_committer freebsd_triage 2013-08-31 14:56:21 UTC
Author: bdrewery
Date: Sat Aug 31 13:56:08 2013
New Revision: 325807
URL: http://svnweb.freebsd.org/changeset/ports/325807

Log:
  - Add USE_PACKAGE_DEPENDS_ONLY which will try installing dependencies
    from existing packages and not fallback on building from source.
  
    This is useful for package building tools such as poudriere and tinderbox
    to avoid building from source and confusing the build log, if a dependency
    failed to build for some reason.
  
    NOTE: USE_PACKAGE_DEPENDS has not changed here. It has always
          reverted to source if the package was not present.
  
  PR:		ports/180725
  Submitted by:	crees
  With hat:	portmgr

Modified:
  head/CHANGES
  head/Mk/bsd.port.mk

Modified: head/CHANGES
==============================================================================
--- head/CHANGES	Sat Aug 31 13:26:26 2013	(r325806)
+++ head/CHANGES	Sat Aug 31 13:56:08 2013	(r325807)
@@ -10,6 +10,13 @@ in the release notes and/or placed into 
 
 All ports committers are allowed to commit to this file.
 
+20130831:
+AUTHOR: bdrewery@FreeBSD.org
+
+  crees has added USE_PACKAGE_DEPENDS_ONLY which works like
+  USE_PACKAGE_DEPENDS but will not fallback on source if a
+  package is missing.
+
 20130731:
 AUTHOR: bapt@FreeBSD.org
 

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Sat Aug 31 13:26:26 2013	(r325806)
+++ head/Mk/bsd.port.mk	Sat Aug 31 13:56:08 2013	(r325807)
@@ -1084,8 +1084,11 @@ FreeBSD_MAINTAINER=	portmgr@FreeBSD.org
 #				  a different checksum and you intend to verify if
 #				  the port still works with it.
 # USE_PACKAGE_DEPENDS
-#				- Install dependencies from existing packages instead
-#				  of building the port from scratch.
+#				- Try to install dependencies from existing packages instead
+#				  of building the port from scratch. Fallback on source
+#				  if an existing package is not present.
+# USE_PACKAGE_DEPENDS_ONLY
+#				- Like USE_PACKAGE_DEPENDS, but do not fallback on source.
 # INSTALL_AS_USER
 #				- Define this to install as the current user, intended
 #				  for systems where you have no root access.
@@ -4906,7 +4909,7 @@ _DEPEND_ALWAYS=	0
 .endif
 
 _INSTALL_DEPENDS=	\
-		if [ X${USE_PACKAGE_DEPENDS} != "X" ]; then \
+		if [ -n "${USE_PACKAGE_DEPENDS}" -o -n "${USE_PACKAGE_DEPENDS_ONLY}" ]; then \
 			subpkgfile=`(cd $$dir; ${MAKE} $$depends_args -V PKGFILE)`; \
 			subpkgname=$${subpkgfile%-*} ; \
 			subpkgname=$${subpkgname\#\#*/} ; \
@@ -4920,6 +4923,10 @@ _INSTALL_DEPENDS=	\
 				else \
 					${PKG_ADD} $${subpkgfile}; \
 				fi; \
+			elif [ -n "${USE_PACKAGE_DEPENDS_ONLY}" ]; then \
+				${ECHO_MSG} "===>   ${PKGNAME} depends on package: $${subpkgfile} - not found"; \
+				${ECHO_MSG} "===>   USE_PACKAGE_DEPENDS_ONLY set - will not build from source"; \
+				exit 1; \
 			else \
 			  (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) ; \
 			fi; \
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 5 dfilter service freebsd_committer freebsd_triage 2013-09-03 13:50:55 UTC
Author: bdrewery
Date: Tue Sep  3 12:50:47 2013
New Revision: 326143
URL: http://svnweb.freebsd.org/changeset/ports/326143

Log:
  - Followup to r325807, with USE_PACKAGE_DEPENDS_ONLY, still allow
    ports framework to use the port for *_DEPENDS= ${NONEXISTENT}:PORT:target
    dependencies
  
    An example port is irc/gseen.mod, it depends on another port being
    extracted, not an installed pkg.
  
  PR:		ports/180725
  Reported by:	antoine
  With hat:	portmgr

Modified:
  head/Mk/bsd.port.mk

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Tue Sep  3 12:50:18 2013	(r326142)
+++ head/Mk/bsd.port.mk	Tue Sep  3 12:50:47 2013	(r326143)
@@ -4923,7 +4923,7 @@ _INSTALL_DEPENDS=	\
 				else \
 					${PKG_ADD} $${subpkgfile}; \
 				fi; \
-			elif [ -n "${USE_PACKAGE_DEPENDS_ONLY}" ]; then \
+			elif [ -n "${USE_PACKAGE_DEPENDS_ONLY}" -a "$${target}" = "${DEPENDS_TARGET}" ]; then \
 				${ECHO_MSG} "===>   ${PKGNAME} depends on package: $${subpkgfile} - not found"; \
 				${ECHO_MSG} "===>   USE_PACKAGE_DEPENDS_ONLY set - will not build from source"; \
 				exit 1; \
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"