The future of Gentoo ports

Kövesdán Gábor gabor.kovesdan at t-hosting.hu
Sun Jun 11 12:43:00 UTC 2006


Alexander Leidinger wrote:
> Quoting Kövesdán Gábor <gabor.kovesdan at t-hosting.hu> (from Fri, 09 Jun 
> 2006 10:57:25 +0200):
>
>> My idea is to repocopy and rename these ports like:
>> emulators/linux_base-gentoo-stage1 -> emulators/linux_dist-gentoo-stage1
>
> Since you are introducing a new class of linux ports, I like to take 
> the opportunity to ask for a bikeshed color...
>
> We have a mix of naming styles. linux-foo, linux_foo and 
> linux_foo-bar. Does it make sense to use an underscore here instead of 
> a minus sign? Should we read it as 'this is a "linux dist" port of 
> "gento" "stage1"', or should we read it as 'this is a "linux" port, it 
> is a "dist"ribution of "gentoo" "stage1"?
>
> The former is some kind of semantic-view, that later is more like a 
> consistent naming scheme.
>
>> This introduces a new group of ports (linux_dist*) that are complete
>> linux environment for cross-development, etc. At the same time a
>
> Sounds good.
>
>> WITH_LINUXBASE macro should be added for installing them into
>> ${LINUXBASE} and this requires a conditional CONFLICTS with another
>> linux_base ports.
>
> One of the first thoughts I had here is: via OPTIONS or not, what 
> would be better? And if using OPTIONS, is it possible to still use 
> CONFLICTS (evaluation order may be important here)?
>
> But I think you will solve this problem. :-)
>
>> If this has been accomplished, I also want to add then three metaports
>> as emulators/linux_base-gentoo-stage[123] for the old functionality,
>> this would install the ports with WITH_LINUXBASE set, but these
>> metaports can be set DEPRECATED without an EXPIRATION_DATE to just note
>> that the use of these are discouraged.
>
> There should be a comment explaining it near DEPRECATED then, so that 
> a committer doesn't decides to axe those ports.
>
>> Ideas and opinions from the lists are welcome!
>
> Sounds good. The pkg-descr should be changed to a sensible explanation 
> then. I try to come up with a good one for the default linux base port 
> which mentions the differences compared to the linux_dist port then.
>
So, here's the patch for linux_base-gentoo-stage1, I'll make patches for 
the other gentoo ports if you find it appropriate. As we discussed, the 
port should be repocopied to emulators/linux_dist-gentoo-stage1 first, 
and the this patch should be applied.
If WITH_LINUXBASE is unset, the package is called 
linux_dist-gentoo-stage1 and everything goes to ${PREFIX}/gentoo-stage1. 
If WITH_LINUXBASE is set it's called linux_base-gentoo-stage1 and 
installed under ${LINUXBASE} and in this case it conflicts with other 
linux_base ports. It works as intended in both cases, I've tested it in 
tinderbox, but if WITH_LINUXBASE is unset, tinderbox gives a warning but 
that doesn't make any sense, I suppose it is due to the dynamic plist, 
but that's correct, there aren't any left alone files after deinstalling 
this.

Gabor Kovesdan
-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /usr/cvs/ports/emulators/linux_base-gentoo-stage1/Makefile,v
retrieving revision 1.31
diff -u -r1.31 Makefile
--- Makefile	5 Jun 2006 21:06:33 -0000	1.31
+++ Makefile	11 Jun 2006 11:44:39 -0000
@@ -5,9 +5,9 @@
 # $FreeBSD: ports/emulators/linux_base-gentoo-stage1/Makefile,v 1.31 2006/06/05 21:06:33 erwin Exp $
 #
 
-PORTNAME=	linux_base-gentoo-stage1
+PORTNAME=	gentoo-stage1
 PORTVERSION=	2006.0
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	emulators linux
 MASTER_SITES=	${MASTER_SITE_GENTOO}
 
@@ -16,21 +16,31 @@
 
 RESTRICTED=	binaries licensed under GNU GPL without accompanying source
 
-CONFLICTS=	linux_base-7* linux_base-8* linux_base-debian* \
-		linux_base-rh* linux_base-suse* linux_base-fc* \
-		linux_base-gentoo-stage[23]-*
-
+USE_BZIP2=		YES
 DIST_SUBDIR=		gentoo-linux
 NO_BUILD=		YES
 NO_FILTER_SHLIBS=	YES
 NO_MTREE=		YES
 ONLY_FOR_ARCHS=		alpha amd64 i386
 PLIST=			${WRKDIR}/pkg-plist
-PREFIX=			${LINUXBASE}
-USE_BZIP2=		YES
+SUB_FILES=		pkg-message
+SUB_LIST+=		PREFIX_SUBDIR=${PREFIX_SUBDIR}
+PKGMESSAGE=		${WRKDIR}/pkg-message
 
 .include <bsd.port.pre.mk>
 
+.if defined(WITH_LINUXBASE)
+PKGNAMEPREFIX=  linux_base-
+CONFLICTS=      linux_base-7* linux_base-8* linux_base-debian* \
+		linux_base-rh* linux_base-suse* linux_base-fc* \
+		linux_base-gentoo-stage[23]-*
+PREFIX=         ${LINUXBASE}
+PREFIX_SUBDIR=
+.else
+PKGNAMEPREFIX=  linux_dist-
+PREFIX_SUBDIR=  gentoo-stage1/
+.endif
+
 .if (${ARCH} == "amd64")
 LATEST_LINK=	${PORTNAME:C/linux_base/linux32_base/}
 .endif
@@ -45,25 +55,53 @@
 MD5_FILE=       	${MASTERDIR}/distinfo.i386
 .endif
 
+pre-fetch:
+.if defined(WITH_LINUXBASE)
+	@${ECHO_MSG} ""
+	@${ECHO_MSG} "Note that this port doesn't completely suit our ports"
+	@${ECHO_MSG} "infrastructure.  It's very good for a standalone Linux"
+	@${ECHO_MSG} "distribution on a FreeBSD system you can use for"
+	@${ECHO_MSG} "cross-developing and cross-building, etc., but using it as a"
+	@${ECHO_MSG} "linux_base port is not quite adequate."
+	@${ECHO_MSG} "If you experience troubles with it, please use the"
+	@${ECHO_MSG} "default linux_base port."
+	@${ECHO_MSG} ""
+.else
+	@${ECHO_MSG} ""
+	@${ECHO_MSG} "This port is a complete Linux distribution you can use"
+	@${ECHO_MSG} "on a FreeBSD system.  The use of this port as a linux_base"
+	@${ECHO_MSG} "port is very discouraged but you can enforce it to install"
+	@${ECHO_MSG} "as a linux_base if you set WITH_LINUXBASE."
+	@${ECHO_MSG} ""
+.endif
+
 do-extract:
+	@${MKDIR} ${PREFIX}/${PREFIX_SUBDIR}
 	@${MKDIR} ${WRKSRC}
 	@${TAR} --exclude=./dev --exclude=./proc -xpy -C ${WRKSRC} \
 		-f ${DISTDIR}/${DIST_SUBDIR}/${DISTFILES}
-	@${ECHO_CMD} etc/resolv.conf > ${PLIST}
-	@cd ${WRKSRC} && ${FIND} * -type f -o -type l >> ${PLIST} \
-		&& ${FIND} * -type d | ${SORT} -r | ${SED} -e 's:^:@dirrm :' \
+	@${ECHO_CMD} ${PREFIX_SUBDIR}etc/resolv.conf > ${PLIST}
+	@cd ${WRKSRC} && ${FIND} * -type f -o -type l | ${SED} -e 's:^:${PREFIX_SUBDIR}:' \
+		>> ${PLIST} \
+		&& ${FIND} * -type d | ${SORT} -r | ${SED} -e 's:^:@dirrm ${PREFIX_SUBDIR}:' \
 		>> ${PLIST}
+.if defined(PREFIX_SUBDIR)
+	@${ECHO_CMD} '@dirrmtry ${PREFIX_SUBDIR}' >> ${PLIST}
+.endif
 	@${RM} -fr ${WRKSRC}
 
 do-install:
-	- ${MKDIR} ${PREFIX}
+	@${MKDIR} ${PREFIX}
 	@${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
-	@${TAR} --exclude=./dev -xpy --exclude=./proc -C ${PREFIX} \
+	@${TAR} --exclude=./dev -xpy --exclude=./proc -C ${PREFIX}/${PREFIX_SUBDIR} \
 		-f ${DISTDIR}/${DIST_SUBDIR}/${DISTFILES}
-	${FIND} ${PREFIX} \! -path "/compat/linux/proc*" -type d -exec ${CHMOD} 755 \{\} \;
-	@${CP} -p /etc/resolv.conf ${PREFIX}/etc/
-	@${BRANDELF} -t Linux ${PREFIX}/sbin/ldconfig ${PREFIX}/sbin/sln
+	@${CP} -p /etc/resolv.conf ${PREFIX}/${PREFIX_SUBDIR}/etc/
+	@${BRANDELF} -t Linux ${PREFIX}/${PREFIX_SUBDIR}/sbin/ldconfig \
+		${PREFIX}/${PREFIX_SUBDIR}/sbin/sln
 	@${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+	@${ECHO_MSG} ""
+	@${ECHO_MSG} "Running linux ldconfig..."
+	@${PREFIX}/${PREFIX_SUBDIR}sbin/ldconfig -r ${PREFIX}/${PREFIX_SUBDIR}
 	@${CAT} ${PKGMESSAGE}
 
 .include <bsd.port.post.mk>
Index: pkg-install
===================================================================
RCS file: /usr/cvs/ports/emulators/linux_base-gentoo-stage1/pkg-install,v
retrieving revision 1.2
diff -u -r1.2 pkg-install
--- pkg-install	10 May 2006 12:16:21 -0000	1.2
+++ pkg-install	10 Jun 2006 19:29:23 -0000
@@ -23,20 +23,6 @@
 			echo '+++ Please mount linprocfs manually! +++'
 		fi
 	fi
-	if [ ! -f ${PKG_PREFIX}/etc/nsswitch.conf ]; then
-		cp ${PKG_PREFIX}/etc/nsswitch.conf.dist \
-			${PKG_PREFIX}/etc/nsswitch.conf
-	fi
-	if [ ! -f ${PKG_PREFIX}/etc/yp.conf ]; then
-		cp ${PKG_PREFIX}/etc/yp.conf.sample ${PKG_PREFIX}/etc/yp.conf
-	fi
-#
-# This is needed for updating to ensure that
-# already installed libraries get to ${PKG_PREFIX}/etc/ld.so.cache
-#
-	echo ''
-	echo 'Running linux ldconfig...'
-	${PKG_PREFIX}/sbin/ldconfig -r ${PKG_PREFIX}
 	;;
 esac
 
Index: pkg-message
===================================================================
RCS file: pkg-message
diff -N pkg-message
--- pkg-message	6 Jun 2006 17:34:46 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,23 +0,0 @@
-* The port/package has attempted to enable Linux compatibility mode by loading
-* the linux.ko kernel module.  You can load the module manually as root with the
-* command "kldload linux" or have it load automatically at boot time by adding
-* to /etc/rc.conf the line:
-*
-*   linux_enable="YES"
-*
-* You may wish to enable emulation of the Linux proc filesystem.  See the
-* linprocfs(5) man page.
-*
-* Note that this port is not the default linux_base port.  We do a big effort
-* to make all linux_base ports work properly with the ports infrastructure,
-* but we can't guarantee that all of then will work in every cases.  If
-* you experience problems, please use the default linux_base port.
-*
-* To download Portage, do "chroot /compat/linux emerge sync" as root.  Then you
-* may want to do "chroot /compat/linux /usr/portage/scripts/bootstrap.sh" to
-* rebuild binutils, gcc, gettext, and glibc.  See
-* <URL:http://www.gentoo.org/doc/en/gentoo-alpha-install.xml> or
-* <URL:http://www.gentoo.org/doc/en/gentoo-x86-install.xml> for more complete 
-* instructions.
-*
-* Do not do "emerge portage" in stage 1.
Index: files/pkg-message.in
===================================================================
RCS file: files/pkg-message.in
diff -N files/pkg-message.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/pkg-message.in	10 Jun 2006 23:00:59 -0000
@@ -0,0 +1,18 @@
+* The port/package has attempted to enable Linux compatibility mode by loading
+* the linux.ko kernel module.  You can load the module manually as root with the
+* command "kldload linux" or have it load automatically at boot time by adding
+* to /etc/rc.conf the line:
+*
+*   linux_enable="YES"
+*
+* You may wish to enable emulation of the Linux proc filesystem.  See the
+* linprocfs(5) man page.
+*
+* To download Portage, do "chroot %%PREFIX%%/%%PREFIX_SUBDIR%% emerge sync" as root.  Then you
+* may want to do "chroot %%PREFIX%%/%%PREFIX_SUBDIR%% /usr/portage/scripts/bootstrap.sh" to
+* rebuild binutils, gcc, gettext, and glibc.  See
+* <URL:http://www.gentoo.org/doc/en/gentoo-alpha-install.xml> or
+* <URL:http://www.gentoo.org/doc/en/gentoo-x86-install.xml> for more complete 
+* instructions.
+*
+* Do not do "emerge portage" in stage 1.


More information about the freebsd-emulation mailing list