Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Nov 2005 11:56:47 -0800
From:      "Michael C. Shultz" <ringworm01@gmail.com>
To:        freebsd-ports-bugs@freebsd.org, vd@datamax.bg
Cc:        Pav Lucistnik <pav@freebsd.org>
Subject:   Re: ports/89164: [PATCH] /var/db/pkg/{portname}/+CONTENTS files sometimes contain wrong data
Message-ID:  <200511171156.48357.ringworm01@gmail.com>
In-Reply-To: <20051117193353.GA53615@qlovarnika.bg.datamax>
References:  <200511171540.jAHFeJSL017500@freefall.freebsd.org> <1132245985.79514.32.camel@localhost> <20051117193353.GA53615@qlovarnika.bg.datamax>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 17 November 2005 11:33, Vasil Dimov wrote:
> On Thu, Nov 17, 2005 at 05:46:25PM +0100, Pav Lucistnik wrote:
> > Yes, there is a long standing problem and we're aware of it. Sadly, no
> > workable solution was submitted so far (at least I haven't found any PR
> > filed against it).
>
> Hmmz, what about the following:
>
> --- bsd.port.mk_dep.diff begins here ---
> --- bsd.port.mk.orig	Thu Nov 17 21:04:11 2005
> +++ bsd.port.mk.dep	Thu Nov 17 21:18:21 2005
> @@ -4638,7 +4638,7 @@
>  		dir=$$(${REALPATH} $$dir); \
>  		if [ -d $$dir ]; then \
>  			if (${ECHO_CMD} $$checked | ${GREP} -qwv "$$dir"); then \
> -				childout=$$(cd $$dir; ${MAKE} CHILD_DEPENDS=yes
> PARENT_CHECKED="$$checked" package-depends-list); \ +				childout=$$(cd
							^^^^^^^^^^^^^^^^^^^^^^^^
I don't even pretend to understand scripting, but this line looks like a 
problem, if you are using "package-depends-list" as a data source it
will fail the test I proposed in this PR's How To Repeat section because
results can be modified with WITH_* values placed into the environment.

To get the +CONTENTS file right need to gather the data like this:

port being registered = cd /usr/ports/cat/port;make -V PKGNAME

get first level dependencies then from

cd /usr/ports/cat/port;make -V RUN_DEPENDS -V LIB_DEPENDS -V DEPENDS

then each dependency returned go to it's /var/db/pkg/+CONTENTS file and
gather each dependency recorded when it was installed (this works recursively)


looking from bottom up at how to gather the information:

depPortLevel4 -=> no dpenedencies recodfed at install time

depPortLevel3 -=> 	make -V RUN_DEPENDS -V LIB_DEPENDS -V DEPENDS
				returns depPortLevel4 so depPortLevel4 goes to +CONTENTS file

			+CONTENTS=depPortLevel4

depPortLevel2 -=> make -V RUN_DEPENDS -V LIB_DEPENDS -V DEPENDS
				returns depPortLevel3  so depPortLevel3 goes to +CONTENTS file
				a look at depPortLevel3's +CONTENTS file reveils depPortLevel4 so

			+CONTENTS=depPortLevel3
			+CONTENTS=depPortLevel4


depPortLevel1 -=> make -V RUN_DEPENDS -V LIB_DEPENDS -V DEPENDS
				returns depPortLevel2 and a look at
				depPortLevel2's +CONTENTS file returns depPortLevel3
				and depPortLevel4 so

			+CONTENTS=depPortLevel2
			+CONTENTS=depPortLevel3
			+CONTENTS=depPortLevel4

-Mike



> $$dir ; pkgnm=`${MAKE} -V PKGNAME` ; if [ -d ${PKG_DBDIR}/$$pkgnm ] ; then
> for p in $$pkgnm `${PKG_INFO} -qr ${PKG_DBDIR}/$$pkgnm |${CUT} -f 2 -d ' '`
> ; do porigin=`pkg_info -qo /var/db/pkg/$$p` ; ${ECHO_CMD} "$$p
> ${PORTSDIR}/$$porigin $$porigin" ; done ; else ${MAKE} CHILD_DEPENDS=yes
> PARENT_CHECKED="$$checked" package-depends-list; fi); \ set -- $$childout;
> \
>  				childdir=""; \
>  				while [ $$\# != 0 ]; do \
> @@ -4651,7 +4651,7 @@
>  		else \
>  			${ECHO_MSG} "${PKGNAME}: \"$$dir\" non-existent -- dependency list
> incomplete" >&2; \ fi; \
> -	done
> +	done | ${SORT} -u
>
>  # Print out package names.
>
> --- bsd.port.mk_dep.diff ends here ---
>
> The idea is to check if the port is installed and get necessary
> info with `pkg_info -r', instead of `make package-depends-list'
>
> Looks quite ugly, some part of the sh code can be extracted
> into separate make variable or at least that 380+ bytes line can be
> broken down into shorter lines.



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