Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Jul 2012 20:28:38 -0400
From:      Steve Wills <swills@FreeBSD.org>
To:        ruby@FreeBSD.org
Subject:   patching rubygems
Message-ID:  <501483B6.6080905@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------020503070008020401050703
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

I've done some more work on the issue of patching rubygems and have
produced the attached patch. I'm doing some testing by building all the
rubygem- ports on 9.0 with both 1.9 and 1.8 as default ruby. The build
with ruby 1.9 finished and the patch has only caused issues building the
following ports:

devel/rubygem-analogger
devel/rubygem-clio
devel/rubygem-rapt
graphics/rubygem-captcha
japanese/rubygem-jpmobile
net-im/rubygem-earthquake
science/rubygem-ai4r
security/rubygem-ezcrypto
www/rubygem-scrubyt

The batch with ruby 1.9 hasn't finished yet, but I don't expect it to
find many more issues.

The basic idea is we extract and then build the gem rather than just
installing the built gem. This gives us a chance to patch the gem in
between the extract and build. We could for example change the
dependencies of a port of we know it works with newer version of the
other gems it depends on. This would make updating some gems much easier
and should only make the build time very slightly longer.

We'd of course want to get an exp-run done before committing this, and
at this point I'm not sure if there's time to get this in before 9.1 or
not, but it would be nice.

Comments?

Thanks,
Steve

--------------020503070008020401050703
Content-Type: text/plain; charset=us-ascii;
 name="gem_patching.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="gem_patching.diff"

Index: Mk/bsd.ruby.mk
===================================================================
--- Mk/bsd.ruby.mk	(revision 301657)
+++ Mk/bsd.ruby.mk	(working copy)
@@ -203,6 +203,8 @@
 
 RUBY_WRKSRC=		${WRKDIR}/ruby-${RUBY_DISTVERSION}
 
+GEM_ENV?=		LC_CTYPE=UTF-8
+
 RUBY_CONFIGURE_ARGS+=	--with-rubyhdrdir="${PREFIX}/include/ruby-1.9/" \
 			--with-rubylibprefix="${PREFIX}/lib/ruby" \
 			--docdir="${RUBY_DOCDIR}" \
@@ -387,8 +389,7 @@
 EXTRACT_ONLY=
 DIST_SUBDIR=	rubygem
 
-NO_BUILD=	yes
-
+EXTRACT_DEPENDS+=	${RUBYGEMBIN}:${PORTSDIR}/devel/ruby-gems
 GEMS_BASE_DIR=	lib/ruby/gems/${RUBY_VER}
 GEMS_DIR=	${GEMS_BASE_DIR}/gems
 DOC_DIR=	${GEMS_BASE_DIR}/doc
@@ -428,10 +429,23 @@
 RUBYGEM_ARGS+=	--no-rdoc
 .endif
 
+do-extract:
+	@${RM} -rf ${WRKDIR}
+	@${MKDIR} ${WRKDIR}
+	${SETENV} ${GEM_ENV} ${RUBYGEMBIN} unpack --target=${WRKDIR} ${DISTDIR}/${DIST_SUBDIR}/${GEMFILES}
+	${TAR} -xOzf ${DISTDIR}/${DIST_SUBDIR}/${GEMFILES} metadata.gz | ${GZCAT} > ${BUILD_WRKSRC}/${GEMFILES}spec
+
+do-build:
+	(cd ${BUILD_WRKSRC}; if ! ${SETENV} ${GEM_ENV} ${RUBYGEMBIN} build --force ${GEMFILES}spec ; then \
+		if [ x != x${BUILD_FAIL_MESSAGE} ] ; then \
+			${ECHO_MSG} "===> Compilation failed unexpectedly."; \
+			(${ECHO_CMD} ${BUILD_FAIL_MESSAGE}) | ${FMT} 75 79 ; \
+			fi; \
+		${FALSE}; \
+		fi)
+
 do-install:
-.for _D in ${GEMFILES}
-	${SETENV} ${GEM_ENV} ${RUBYGEMBIN} install ${RUBYGEM_ARGS} ${DISTDIR}/${DIST_SUBDIR}/${_D} -- --build-args ${CONFIGURE_ARGS}
-.endfor
+	@(cd ${BUILD_WRKSRC}; ${SETENV} ${GEM_ENV} ${RUBYGEMBIN} install ${RUBYGEM_ARGS} ${GEMFILES} -- --build-args ${CONFIGURE_ARGS})
 
 . if defined(RUBYGEM_AUTOPLIST)
 .  if !target(post-install-script)

--------------020503070008020401050703--



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