Patchwork plan9 updates for new cpython fork

login
register
mail settings
Submitter jas@corpus-callosum.com
Date July 15, 2013, 5:04 p.m.
Message ID <40FC16B5-711E-415E-B96F-19768ECE16AE@corpus-callosum.com>
Download mbox | patch
Permalink /patch/1903/
State Changes Requested, archived
Headers show

Comments

jas@corpus-callosum.com - July 15, 2013, 5:04 p.m.
plan9: support new cpython fork for Plan 9

A new CPython fork has been created at http://bitbucket.org/jas/cpython
specifically to update the Plan 9 Python version to v2.7.5 and add new
architectures beyond 386.  The new Python v2.7.5 port supports a more
typical `python setup.py` configuration which allows us to modify the
mercurial build process for the platform.



# HG changeset patch
# User Jeff Sickel <jas@corpus-callosum.com>
# Date 1373318098 18000
#      Mon Jul 08 16:14:58 2013 -0500
# Branch stable
# Node ID 09613e3b3a179c026658398fb12e6b4016434d85
# Parent  009794acc6e37a650f0fae37872e733382ac1c0c
imported patch plan9
Augie Fackler - July 16, 2013, 3:16 p.m.
On Mon, Jul 15, 2013 at 12:04:10PM -0500, Jeff Sickel wrote:
> plan9: support new cpython fork for Plan 9
>
> A new CPython fork has been created at http://bitbucket.org/jas/cpython
> specifically to update the Plan 9 Python version to v2.7.5 and add new
> architectures beyond 386.  The new Python v2.7.5 port supports a more
> typical `python setup.py` configuration which allows us to modify the
> mercurial build process for the platform.

I see at least 4 patches here:

1) 9mail: new script to add support for upas/marshal
2) 9diff: update path to 9diff for $REASON
3) plan9: update setup.py and mkfile to support new cpython
4) factotum: not sure offhand what this patch is

Please split the commit into more workable chunks along lines like
this and resend the series. Thanks!

>
>
>
> # HG changeset patch
> # User Jeff Sickel <jas@corpus-callosum.com>
> # Date 1373318098 18000
> #      Mon Jul 08 16:14:58 2013 -0500
> # Branch stable
> # Node ID 09613e3b3a179c026658398fb12e6b4016434d85
> # Parent  009794acc6e37a650f0fae37872e733382ac1c0c
> imported patch plan9
>
> diff -r 009794acc6e3 -r 09613e3b3a17 contrib/plan9/9mail
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/contrib/plan9/9mail	Mon Jul 08 16:14:58 2013 -0500
> @@ -0,0 +1,26 @@
> +#!/bin/rc
> +# 9mail - Mercurial email wrapper for upas/marshal
> +
> +fn usage {
> +	echo >[1=2] usage: mercurial/9mail -f from to [cc]
> +	exit usage
> +}
> +
> +from=()
> +cc=()
> +to=()
> +
> +switch($1){
> +case -f
> +	from=$2
> +case *
> +	usage
> +}
> +
> +to=($3)
> +if(~ $#* 4)
> +	cc=(-C $4)
> +
> +upasname=$from
> +upas/marshal $cc $to
> +
> diff -r 009794acc6e3 -r 09613e3b3a17 contrib/plan9/hgrc.d/9diff.rc
> --- a/contrib/plan9/hgrc.d/9diff.rc	Mon Jul 01 11:09:29 2013 -0300
> +++ b/contrib/plan9/hgrc.d/9diff.rc	Mon Jul 08 16:14:58 2013 -0500
> @@ -4,4 +4,4 @@
>  extdiff =
>
>  [extdiff]
> -9diff = 9diff -cm $parent $child $root
> +9diff = /bin/mercurial/9diff -cm $parent $child $root
> diff -r 009794acc6e3 -r 09613e3b3a17 contrib/plan9/hgrc.d/9mail.rc
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/contrib/plan9/hgrc.d/9mail.rc	Mon Jul 08 16:14:58 2013 -0500
> @@ -0,0 +1,4 @@
> +# The 9mail to support patchbomb and other email wrappers
> +[email]
> +method = /bin/mercurial/9mail
> +
> diff -r 009794acc6e3 -r 09613e3b3a17 contrib/plan9/mkfile
> --- a/contrib/plan9/mkfile	Mon Jul 01 11:09:29 2013 -0300
> +++ b/contrib/plan9/mkfile	Mon Jul 08 16:14:58 2013 -0500
> @@ -3,8 +3,6 @@
>
>  PYTHON=python
>  PYTHONBIN=/rc/bin
> -SH=ape/psh
> -
>  PURE=--pure
>  ROOT=../..
>
> @@ -15,23 +13,28 @@
>  build:VQ:
>       @{
>               cd $ROOT
> -		$SH -c '$PYTHON setup.py $PURE build_py build_scripts'
> +		$PYTHON setup.py $PURE build_py build_scripts
>       }
>
>  clean:VQ:
>       @{
>               cd $ROOT
> -		$SH -c '$PYTHON setup.py $PURE clean --all'
> +		$PYTHON setup.py $PURE clean --all
> +		rm -f */*.pyc
> +		rm mercurial/__version__.py
>       }
>
>  install:VQ:	build
>       @{
>               cd $ROOT
> -		$SH -c '$PYTHON setup.py $PURE install \
> +		$PYTHON setup.py $PURE install \
> +			--prefix /sys \
>                       --install-scripts $PYTHONBIN \
>                       --skip-build \
> -			--force'
> +			--force
>       }
>       mkdir -p /lib/mercurial/hgrc.d
> -	dircp hgrc.d /lib/mercurial/hgrc.d/
> -	cp 9diff /rc/bin/
> +	mkdir -p /rc/bin/mercurial
> +	dircp hgrc.d /lib/mercurial/hgrc.d
> +	cp -x 9diff /rc/bin/mercurial
> +	cp -x 9mail /rc/bin/mercurial
> diff -r 009794acc6e3 -r 09613e3b3a17 contrib/plan9/proto
> --- a/contrib/plan9/proto	Mon Jul 01 11:09:29 2013 -0300
> +++ b/contrib/plan9/proto	Mon Jul 08 16:14:58 2013 -0500
> @@ -5,19 +5,20 @@
>                       factotum.rc	- sys sys
>  rc	- sys sys
>       bin	- sys sys
> -		9diff	- sys sys
> +		mercurial - sys sys
> +			9diff	- sys sys
> +			9mail	- sys sys
>               hg	- sys sys
>  sys	- sys sys
>       lib	- sys sys
> -		python	- sys sys
> +		python2.7	- sys sys
>                       lib	- sys sys
> -				python2.5	- sys sys
> -					site-packages	- sys sys
> -						hgext	- sys sys
> -							+	- sys sys
> -						mercurial	- sys sys
> -							+	- sys sys
> -						mercurial-VERSION-py2.5.egg-info	- sys sys
> +				site-packages	- sys sys
> +					hgext	- sys sys
> +						+	- sys sys
> +					mercurial	- sys sys
> +						+	- sys sys
> +						mercurial-VERSION-py2.7.egg-info	- sys sys
>       src	- sys sys
>               cmd	- sys sys
>                       hg	- sys sys
> diff -r 009794acc6e3 -r 09613e3b3a17 hgext/factotum.py
> --- a/hgext/factotum.py	Mon Jul 01 11:09:29 2013 -0300
> +++ b/hgext/factotum.py	Mon Jul 08 16:14:58 2013 -0500
> @@ -101,7 +101,7 @@
>          user, passwd = auth.get('username'), auth.get('password')
>      if not user or not passwd:
>          if not prefix:
> -            prefix = '*'
> +            prefix = realm.split(' ')[0].lower()
>          params = 'service=%s prefix=%s' % (_service, prefix)
>          if user:
>              params = '%s user=%s' % (params, user)
> diff -r 009794acc6e3 -r 09613e3b3a17 setup.py
> --- a/setup.py	Mon Jul 01 11:09:29 2013 -0300
> +++ b/setup.py	Mon Jul 08 16:14:58 2013 -0500
> @@ -129,7 +129,7 @@
>      py2exeloaded = False
>
>  def runcmd(cmd, env):
> -    if sys.platform == 'plan9':
> +    if sys.platform == 'plan9' and (sys.version_info[0] == 2 and sys.version_info[1] < 7):
>          # subprocess kludge to work around issues in half-baked Python
>          # ports, notably bichued/python:
>          _, out, err = os.popen3(cmd)
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
jas@corpus-callosum.com - Aug. 12, 2013, 8:26 p.m.
On Jul 16, 2013, at 10:47 AM, Kevin Bullock <kbullock+mercurial@ringworld.org> wrote:

> On 16 Jul 2013, at 10:16 AM, Augie Fackler wrote:
> 
>> On Mon, Jul 15, 2013 at 12:04:10PM -0500, Jeff Sickel wrote:
>>> plan9: support new cpython fork for Plan 9
>>> 
>>> A new CPython fork has been created at http://bitbucket.org/jas/cpython
>>> specifically to update the Plan 9 Python version to v2.7.5 and add new
>>> architectures beyond 386.  The new Python v2.7.5 port supports a more
>>> typical `python setup.py` configuration which allows us to modify the
>>> mercurial build process for the platform.
>> 
>> I see at least 4 patches here:
>> 
>> 1) 9mail: new script to add support for upas/marshal
>> 2) 9diff: update path to 9diff for $REASON
>> 3) plan9: update setup.py and mkfile to support new cpython
>> 4) factotum: not sure offhand what this patch is
	http://plan9.bell-labs.com/magic/man2html/4/factotum

Yes, I've been using mq and have saved off the various patches in my
own patch queue and tried to submit them per one of the MQ docs on
the mercurial wiki.

>> Please split the commit into more workable chunks along lines like
>> this and resend the series. Thanks!
> 
> Please also see <http://mercurial.selenic.com/wiki/ContributingChanges> (and note that Augie has kindly written the first line of each of your commit messages for you).

I'll review these and make the appropriate changes.

> Also, does this break the build for people using the old CPython on plan9? That's probably undesirable. We take backward compatibility very seriously.


There are three issues here:

 1) The patch to setup.py addresses the install issue for both the
    old python2.5 version and this new python2.7 port
    (https://bitbucket.org/jas/cpython).

 2) Plan 9 does not have dynamic libraries (shlibs/.so) so any rebuild
    of CPython would be based on the latest release as the older Python
    2.5 port is no longer viable on recent Plan 9 kernels.  This latest
    release also uses the built-in mercurial C modules instead of the
    pure python modules, providing a desirable performance increase from
    the prior port.

 2) The old Plan 9 CPython 2.5 port has not been updated or rebuilt for
    four years and only supports 386.  The latest 2.7 release supports
    the recent Plan 9 kernels with viable targets for 386, amd64, arm,
    mips, and powerpc.

We in the Plan 9 community take compatibility very seriously as well.
That said, we also know when to let something go when it no longer serves
the installed base.

Jeff

Patch

diff -r 009794acc6e3 -r 09613e3b3a17 contrib/plan9/9mail
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/plan9/9mail	Mon Jul 08 16:14:58 2013 -0500
@@ -0,0 +1,26 @@ 
+#!/bin/rc
+# 9mail - Mercurial email wrapper for upas/marshal
+
+fn usage {
+	echo >[1=2] usage: mercurial/9mail -f from to [cc]
+	exit usage
+}
+
+from=()
+cc=()
+to=()
+
+switch($1){
+case -f
+	from=$2
+case *
+	usage
+}
+
+to=($3)
+if(~ $#* 4)
+	cc=(-C $4)
+
+upasname=$from
+upas/marshal $cc $to
+
diff -r 009794acc6e3 -r 09613e3b3a17 contrib/plan9/hgrc.d/9diff.rc
--- a/contrib/plan9/hgrc.d/9diff.rc	Mon Jul 01 11:09:29 2013 -0300
+++ b/contrib/plan9/hgrc.d/9diff.rc	Mon Jul 08 16:14:58 2013 -0500
@@ -4,4 +4,4 @@ 
 extdiff =
 
 [extdiff]
-9diff = 9diff -cm $parent $child $root
+9diff = /bin/mercurial/9diff -cm $parent $child $root
diff -r 009794acc6e3 -r 09613e3b3a17 contrib/plan9/hgrc.d/9mail.rc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/plan9/hgrc.d/9mail.rc	Mon Jul 08 16:14:58 2013 -0500
@@ -0,0 +1,4 @@ 
+# The 9mail to support patchbomb and other email wrappers
+[email]
+method = /bin/mercurial/9mail
+
diff -r 009794acc6e3 -r 09613e3b3a17 contrib/plan9/mkfile
--- a/contrib/plan9/mkfile	Mon Jul 01 11:09:29 2013 -0300
+++ b/contrib/plan9/mkfile	Mon Jul 08 16:14:58 2013 -0500
@@ -3,8 +3,6 @@ 
 
 PYTHON=python
 PYTHONBIN=/rc/bin
-SH=ape/psh
-
 PURE=--pure
 ROOT=../..
 
@@ -15,23 +13,28 @@ 
 build:VQ:
 	@{
 		cd $ROOT
-		$SH -c '$PYTHON setup.py $PURE build_py build_scripts'
+		$PYTHON setup.py $PURE build_py build_scripts
 	}
 
 clean:VQ:
 	@{
 		cd $ROOT
-		$SH -c '$PYTHON setup.py $PURE clean --all'
+		$PYTHON setup.py $PURE clean --all
+		rm -f */*.pyc
+		rm mercurial/__version__.py
 	}
 
 install:VQ:	build
 	@{
 		cd $ROOT
-		$SH -c '$PYTHON setup.py $PURE install \
+		$PYTHON setup.py $PURE install \
+			--prefix /sys \
 			--install-scripts $PYTHONBIN \
 			--skip-build \
-			--force'
+			--force
 	}
 	mkdir -p /lib/mercurial/hgrc.d
-	dircp hgrc.d /lib/mercurial/hgrc.d/
-	cp 9diff /rc/bin/
+	mkdir -p /rc/bin/mercurial
+	dircp hgrc.d /lib/mercurial/hgrc.d
+	cp -x 9diff /rc/bin/mercurial
+	cp -x 9mail /rc/bin/mercurial
diff -r 009794acc6e3 -r 09613e3b3a17 contrib/plan9/proto
--- a/contrib/plan9/proto	Mon Jul 01 11:09:29 2013 -0300
+++ b/contrib/plan9/proto	Mon Jul 08 16:14:58 2013 -0500
@@ -5,19 +5,20 @@ 
 			factotum.rc	- sys sys
 rc	- sys sys
 	bin	- sys sys
-		9diff	- sys sys
+		mercurial - sys sys
+			9diff	- sys sys
+			9mail	- sys sys
 		hg	- sys sys
 sys	- sys sys
 	lib	- sys sys
-		python	- sys sys
+		python2.7	- sys sys
 			lib	- sys sys
-				python2.5	- sys sys
-					site-packages	- sys sys
-						hgext	- sys sys
-							+	- sys sys
-						mercurial	- sys sys
-							+	- sys sys
-						mercurial-VERSION-py2.5.egg-info	- sys sys
+				site-packages	- sys sys
+					hgext	- sys sys
+						+	- sys sys
+					mercurial	- sys sys
+						+	- sys sys
+						mercurial-VERSION-py2.7.egg-info	- sys sys
 	src	- sys sys
 		cmd	- sys sys
 			hg	- sys sys
diff -r 009794acc6e3 -r 09613e3b3a17 hgext/factotum.py
--- a/hgext/factotum.py	Mon Jul 01 11:09:29 2013 -0300
+++ b/hgext/factotum.py	Mon Jul 08 16:14:58 2013 -0500
@@ -101,7 +101,7 @@ 
         user, passwd = auth.get('username'), auth.get('password')
     if not user or not passwd:
         if not prefix:
-            prefix = '*'
+            prefix = realm.split(' ')[0].lower()
         params = 'service=%s prefix=%s' % (_service, prefix)
         if user:
             params = '%s user=%s' % (params, user)
diff -r 009794acc6e3 -r 09613e3b3a17 setup.py
--- a/setup.py	Mon Jul 01 11:09:29 2013 -0300
+++ b/setup.py	Mon Jul 08 16:14:58 2013 -0500
@@ -129,7 +129,7 @@ 
     py2exeloaded = False
 
 def runcmd(cmd, env):
-    if sys.platform == 'plan9':
+    if sys.platform == 'plan9' and (sys.version_info[0] == 2 and sys.version_info[1] < 7):
         # subprocess kludge to work around issues in half-baked Python
         # ports, notably bichued/python:
         _, out, err = os.popen3(cmd)