Re: [gentoo-dev] [patch] preconfig to allow user configuration before compilation

2005-07-15 Thread Jason Stubbs
On Friday 15 July 2005 12:55, Kristian Benoit wrote:
 This patch provide a new feature (preconfig).

 With this feature on, emerging an ebuild with an optional src_preconfig
 function will unpack, preconfig, compile, ... on emerge. But with
 preconfig off, it would do as usual and bypass the src_preconfig.
 src_preconfig is for interactive configuration at before src_compile
 like packages where you must make menuconfig.

 A couple things could still be done:

 - emerge could unpack every packages that define a src_preconfig,
 preconfig those packages then follow up with compile on those packages
 and normal emerge on other packages.

 - As some people dont want interactive configuration or as much hidden
 as possible, I thought of removing preconfig if set in make.conf but
 only keep it if set in environment variable.

 Hope it can help :)

 I'm also sending a patch to busybox, try it ! :)

By the way, you seemed to attach a unified diff between your modified portage 
and an empty directory. Please don't do the same for busybox.

--
Jason Stubbs


pgpTKKQVDuvfF.pgp
Description: PGP signature


Re: [gentoo-dev] [patch] preconfig to allow user configuration before compilation

2005-07-15 Thread Kristian Benoit
On Fri, 2005-07-15 at 20:13 +0900, Jason Stubbs wrote:
 By the way, you seemed to attach a unified diff between your modified
 portage and an empty directory. Please don't do the same for busybox.
 Sending a 1.4MB patch to a public mailing list is not very nice -
 especially not in one go.

I'm sincerilly truly sorry, I'll try to triple check in the futur.
I just can't believe what I did.
I ran the same command and here's the output ???

 Patches belong on bugs.gentoo.org anyway.

Sorry, I'm getting use to the LKML.
As I sent a bad patch, I'll send the correction here, but I'll send
patch in bugs.gentoo.org in the futur.

Thanks

Kristian
diff -uNrp portage-2.0.51.19/bin/ebuild.sh portage-2.0.51.19-preconfig/bin/ebuild.sh
--- portage-2.0.51.19/bin/ebuild.sh	2005-02-26 06:22:37.0 -0500
+++ portage-2.0.51.19-preconfig/bin/ebuild.sh	2005-07-14 20:21:38.0 -0400
@@ -548,6 +548,11 @@ src_unpack() {
 	fi	
 }
 
+src_preconfig() {
+	echo default preconfig
+	return `false`
+}
+
 src_compile() {
 	if [ -x ./configure ]; then
 		econf
@@ -685,6 +690,20 @@ dyn_unpack() {
 	trap SIGINT SIGQUIT
 }
 
+dyn_preconfig() {
+	echo  Preconfiguring source...
+	cd ${S}
+	local preconfigured = 1
+	echo some more stuff
+	src_preconfig  preconfigured=0 || preconfigured=1
+
+	if [ preconfigured ]; then
+		echo  Source preconfigured.
+	else
+		echo  Could not preconfigure the source.
+	fi
+}
+
 dyn_clean() {
 	if [ $USERLAND == BSD ]  type -p chflags /dev/null; then
 		chflags -R noschg,nouchg,nosappnd,nouappnd,nosunlnk,nouunlnk \
@@ -1778,7 +1797,7 @@ for myarg in $*; do
 			set +x
 		fi
 		;;
-	unpack|compile|test|clean|install)
+	unpack|preconfig|compile|test|clean|install)
 		if [ ${SANDBOX_DISABLED=0} == 0 ]; then
 			export SANDBOX_ON=1
 		else
diff -uNrp portage-2.0.51.19/pym/portage.py portage-2.0.51.19-preconfig/pym/portage.py
--- portage-2.0.51.19/pym/portage.py	2005-03-03 11:45:01.0 -0500
+++ portage-2.0.51.19-preconfig/pym/portage.py	2005-07-14 20:53:15.0 -0400
@@ -2253,9 +2253,14 @@ def spawnebuild(mydo,actionmap,mysetting
 			retval=spawnebuild(actionmap[mydo][dep],actionmap,mysettings,debug,alwaysdep=alwaysdep,logfile=logfile)
 			if retval:
 return retval
+
+	# Do not log for preconfig as it break interactivity.
+	if mydo==preconfig:
+		logfile=None
+
 	# spawn ebuild.sh
 	mycommand = EBUILD_SH_BINARY +  
-	if selinux_enabled and (sesandbox in features) and (mydo in [unpack,compile,test,install]):
+	if selinux_enabled and (sesandbox in features) and (mydo in [unpack,preconfig,compile,test,install]):
 		con=selinux.getcontext()
 		con=string.replace(con,mysettings[PORTAGE_T],mysettings[PORTAGE_SANDBOX_T])
 		selinux.setexec(con)
@@ -2295,7 +2300,7 @@ def doebuild(myebuild,mydo,myroot,mysett
 
 	validcommands = [help,clean,prerm,postrm,preinst,postinst,
 	config,setup,depend,fetch,digest,
-	unpack,compile,test,install,rpm,qmerge,merge,
+	unpack,preconfig,compile,test,install,rpm,qmerge,merge,
 	package,unmerge, manifest]
 
 	if mydo not in validcommands:
@@ -2533,7 +2538,7 @@ def doebuild(myebuild,mydo,myroot,mysett
 			return unmerge(mysettings[CATEGORY],mysettings[PF],myroot,mysettings)
 
 	# if any of these are being called, handle them -- running them out of the sandbox -- and stop now.
-	if mydo==clean:
+	if mydo in [clean,config]:
 		logfile=None
 	if mydo in [help,clean,setup]:
 		return spawn(EBUILD_SH_BINARY+ +mydo,mysettings,debug=debug,free=1,logfile=logfile)
@@ -2623,13 +2628,18 @@ def doebuild(myebuild,mydo,myroot,mysett
 			  depend: { args:(0,1)}, # sandbox  / portage
 			  setup:  { args:(1,0)}, # without  / root
 			 unpack:  {dep:setup,   args:(0,1)}, # sandbox  / portage
-			compile:  {dep:unpack,  args:(nosandbox,1)}, # optional / portage
+		  preconfig:  {dep:unpack,  args:(nosandbox,1)}, # optional / portage
 			   test:  {dep:compile, args:(nosandbox,1)}, # optional / portage
 			install:  {dep:test,args:(0,0)}, # sandbox  / root
 			rpm:  {dep:install, args:(0,0)}, # sandbox  / root
 	package:  {dep:install, args:(0,0)}, # sandbox  / root
 	}
-	
+
+	if preconfig in mysettings[FEATURES].split():
+		actionmap[compile] =  {dep:preconfig,  args:(nosandbox,1)} # optional / portage
+	else:
+		actionmap[compile] =  {dep:unpack,  args:(nosandbox,1)} # optional / portage
+
 	if mydo in actionmap.keys():	
 		if mydo==package:
 			for x in [,/+mysettings[CATEGORY],/All]:
--- busybox-1.00-r4.ebuild	2005-07-14 20:39:47.0 -0400
+++ busybox-1.00-r6.ebuild	2005-07-14 20:38:51.0 -0400
@@ -91,6 +91,7 @@ src_unpack() {
 		done
 		if [[ -r ${S}/.config ]] ; then
 			einfo Found your ${configfile} and using it.
+			touch ${BUILDDIR}/.preconfigured
 			return 0
 		fi
 	fi
@@ -136,7 +137,20 @@ src_unpack() {
 	make oldconfig  /dev/null
 }
 
+src_preconfig() {
+	emake CROSS=${CROSS} menuconfig
+	touch 

Re: [gentoo-dev] [patch] preconfig to allow user configuration before compilation

2005-07-15 Thread Mike Frysinger
On Friday 15 July 2005 09:02 am, Kristian Benoit wrote:
 On Fri, 2005-07-15 at 20:13 +0900, Jason Stubbs wrote:
  By the way, you seemed to attach a unified diff between your modified
  portage and an empty directory. Please don't do the same for busybox.
  Sending a 1.4MB patch to a public mailing list is not very nice -
  especially not in one go.

 I'm sincerilly truly sorry, I'll try to triple check in the futur.
 I just can't believe what I did.
 I ran the same command and here's the output ???

live and learn; do it again and we take your fingers

  Patches belong on bugs.gentoo.org anyway.

 Sorry, I'm getting use to the LKML.
 As I sent a bad patch, I'll send the correction here, but I'll send
 patch in bugs.gentoo.org in the futur.

other than the fact the bash coding style needs to be fixed up, the idea is 
pretty sound i think ...

perhaps the better list to hammer this out is gentoo-portage ?
-mike
-- 
gentoo-dev@gentoo.org mailing list