Changeset - 3bd101344e8e
[Not reviewed]
default
0 2 2
Nathan Brink (binki) - 16 years ago 2009-08-01 18:08:09
ohnobinki@ohnopublishing.net
added confuse with relative includes patch
4 files changed with 123 insertions and 2 deletions:
0 comments (0 inline, 0 general)
dev-libs/confuse/ChangeLog
Show inline comments
 
# ChangeLog for dev-libs/confuse
 
# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
 
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
 
# $Header: /var/cvsroot/gentoo-x86/dev-libs/confuse/ChangeLog,v 1.39 2008/12/17 22:09:10 maekke Exp $
 

	
 
  01 Aug 2009; Nathan Brink <ohnobinki@gentoo.org> +confuse-2.6-r4.ebuild,
 
  +files/confuse-2.6-relativeincludes.patch:
 
  Added relative includes patch
 

	
 
  28 Feb 2009; Nathan Phillip Brink <ohnobinki@ohnopublishing.net> -confuse-2.6.ebuild, -confuse-2.6-r2.ebuild, 
 
  Initial import into ohnobinki_overlay from Gentoo Portage, disabled building of non-installed/unused examples to support crosscompiling to mingw32
 
	
 
  17 Dec 2008; Markus Meier <maekke@gentoo.org> confuse-2.6-r3.ebuild:
 
  amd64 stable, bug #246143
 

	
dev-libs/confuse/Manifest
Show inline comments
 
AUX confuse-2.6-O0.patch 492 RMD160 29fd2ba5a9c2fec7d23f1586b25de4fdda30e720 SHA1 1a6c59611dd013e429e44ebf886a60e0a30ecec1 SHA256 64a6d0df44f72d3f514a4678a16f1f887e417250f7990b64631fe0a3999215ff
 
AUX confuse-2.6-noexamples.patch 1097 RMD160 77dc01c65b1f7c00e4d460ab8feb15af88bf4685 SHA1 eb278dfb91a3c707517acc3772b08eb198ff4d23 SHA256 860b1459e499588186d5b0e0d8e614ffe160ff935dd3a4db461a1b9071df90f7
 
AUX confuse-2.6-relativeincludes.patch 1562 RMD160 099b59694450e377fe057bed1b6150cde1dac24f SHA1 fb53dce15875c34d081cfbb6accf97cf88ba73c8 SHA256 17f23a048492fa6b038c7ec114fb6d477cfc411eefc88ffcc2c7b28dbf460a84
 
AUX confuse-2.6-solaris.patch 572 RMD160 e43927f1688fb99e283d919b4d6f7bce7de18bb2 SHA1 bbe8a4071c8961b965cd37f2ce9b295ff17129dc SHA256 00dc757a617db9fc5832ec4435ef581b49286621cf300a89b318151a1bfd15c5
 
DIST confuse-2.6.tar.gz 504017 RMD160 11f987089c533573482a427c7ad2ae8e155389b7 SHA1 e9e5510abf1eb3159a6439fd52aa5cec94811aff SHA256 e8d653159b152f3850a7224b3eb604955795dbd3fd6603816ee46411ea53e84a
 
EBUILD confuse-2.6-r3.ebuild 1191 RMD160 033c7062f7ce617aef42b19294c1024b3af138f9 SHA1 91574a27afc4cd0d5a31d0e777089c01951daf11 SHA256 7c1b910922cac96acfaa0a90eab55661071dcc382ffcb9529ae7730e74afb5c7
 
MISC ChangeLog 5162 RMD160 8054505e53247f43cf2145c6b59fa4d7d688de2a SHA1 3f7548ffabe04a204ff13756884ed78d225fc3ba SHA256 4c84192f67ad33061c7eff3dfecf211d85bfedae581d59b9e43db215fb7a3d89
 
EBUILD confuse-2.6-r4.ebuild 1581 RMD160 37c99b72457bc2a9cbd1fb68d73f8f049eef0859 SHA1 5a39c860d218363d6f35a7e1f1f57b65d6a98199 SHA256 9af50fa8d4d0aecdbed609be27110206d0be934f9f83ca2800a168cb008935ca
 
MISC ChangeLog 5315 RMD160 2ac751fcab57d0de0e2ddc30201c09f5fb40e783 SHA1 8f827df311f972601a6144339f51bb8cf52355c1 SHA256 c159c0360277a8ab10e5af1bb1746d0b9661a4d3ecbc7a9a1abb5295f3aa1d58
 
MISC metadata.xml 222 RMD160 23efe87c16ebc9fbeb91e894ab372cc3bb66bc49 SHA1 a5d1e2317ae207bbd664aebe986687948fdd984a SHA256 38ef3457fd14e6872985f0e100fde79d0b8a9dbc4fc39ceef780c8c5abc5f337
dev-libs/confuse/confuse-2.6-r4.ebuild
Show inline comments
 
new file 100644
 
# Copyright 1999-2009 Gentoo Foundation
 
# Distributed under the terms of the GNU General Public License v2
 
# $Header: /var/cvsroot/gentoo-x86/dev-libs/confuse/confuse-2.6-r3.ebuild,v 1.6 2008/12/17 22:09:10 maekke Exp $
 

	
 
inherit eutils autotools
 

	
 
DESCRIPTION="a configuration file parser library"
 
HOMEPAGE="http://www.nongnu.org/confuse/"
 
SRC_URI="http://bzero.se/confuse/${P}.tar.gz"
 

	
 
LICENSE="LGPL-2"
 
SLOT="0"
 
KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~sparc-fbsd x86 ~x86-fbsd"
 
IUSE="nls"
 

	
 
DEPEND="sys-devel/flex
 
	sys-devel/libtool
 
	dev-util/pkgconfig
 
	nls? ( sys-devel/gettext )"
 
RDEPEND="nls? ( virtual/libintl )"
 

	
 
pkg_setup() {
 
	ewarn "This copy of confuse has a patch that causes cfg_include"
 
	ewarn "to include files relative to the file calling cfg_include."
 
	ewarn "This may break packages designed for vanilla confuse. Please"
 
	ewarn "bug me at https://ohnopublishing.net/bugs/ if you have problems"
 
	ewarn "with this."
 
}
 

	
 
src_unpack() {
 
	unpack ${A}
 
	cd "${S}"
 
	# bug #236347
 
	epatch "${FILESDIR}"/${P}-O0.patch
 
	# bug 239020
 
	epatch "${FILESDIR}"/${P}-solaris.patch
 
	# don't compile examples:
 
	epatch "${FILESDIR}"/${P}-noexamples.patch
 
	#relative cfg_include()s
 
	epatch "${FILESDIR}"/${P}-relativeincludes.patch
 
	# drop -Werror, bug #208095
 
	sed -i -e 's/-Werror//' */Makefile.* || die
 

	
 
	eautoreconf
 
}
 

	
 
src_compile() {
 
	econf --enable-shared --disable-examples || die
 
	emake || die
 
}
 

	
 
src_install() {
 
	emake DESTDIR="${D}" install || die
 

	
 
	doman doc/man/man3/*.3
 
	dodoc AUTHORS NEWS README
 
	dodoc examples/*.c examples/*.conf
 
	dohtml doc/html/* || die
 
}
dev-libs/confuse/files/confuse-2.6-relativeincludes.patch
Show inline comments
 
new file 100644
 
--- a/src/lexer.l
 
+++ b/src/lexer.l
 
@@ -298,12 +298,51 @@ int cfg_lexer_include(cfg_t *cfg, const char *filename)
 
     cfg_include_stack[cfg_include_stack_ptr].line = cfg->line;
 
     cfg_include_stack_ptr++;
 
 
 
-    xfilename = cfg_tilde_expand(filename);
 
+    xfilename = NULL;
 
+
 
+    if(filename[0] != '/'
 
+       && filename[0] != '~'
 
+       /* ensure that the existing file has directories in it */
 
+#ifdef _WIN32
 
+       && (strchr(cfg->filename, '\\')
 
+	   || strchr(cfg->filename, '/'))
 
+#else
 
+       && cfg->filename[0] == '/'
 
+#endif
 
+       )
 
+      /* then this path is relative to the file it was included from */
 
+      {
 
+	char *lastslash;
 
+	size_t prefixlen;
 
+
 
+	lastslash = strrchr(cfg->filename, '/');
 
+#ifdef _WIN32
 
+	{
 
+	  char *win32slash;
 
+
 
+	  win32slash = strrchr(cfg->filename, '\\');
 
+	  if(!lastslash
 
+	     || win32slash > lastslash)
 
+	    lastslash = win32slash;
 
+	}
 
+#endif
 
+	assert(lastslash);
 
+	prefixlen = lastslash - cfg->filename + 1; /* length of prefix including slash */
 
+	xfilename = malloc(prefixlen
 
+			   + strlen(filename)
 
+			   + 1); /* NULL terminator */
 
+	assert(xfilename);
 
+	strncpy(xfilename, cfg->filename, prefixlen);
 
+	strcpy(xfilename + prefixlen, filename);
 
+      }
 
+
 
+    if(!xfilename)
 
+      xfilename = cfg_tilde_expand(filename);
 
 
 
     cfg_yyin = fopen(xfilename, "r");
 
 
 
     if(!cfg_yyin) {
 
-        cfg_error(cfg, "%s: %s", xfilename, strerror(errno));
 
+        cfg_error(cfg, "%s (expanded from %s): %s", xfilename, filename, strerror(errno));
 
         free(xfilename);
 
         return 1;
 
     }
0 comments (0 inline, 0 general)