From owner-freebsd-python@FreeBSD.ORG Sat Apr 12 22:47:22 2014 Return-Path: Delivered-To: python@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1E450CB4; Sat, 12 Apr 2014 22:47:22 +0000 (UTC) Received: from duck.symmetricom.us (duck.symmetricom.us [206.168.13.214]) by mx1.freebsd.org (Postfix) with ESMTP id E653D179D; Sat, 12 Apr 2014 22:47:21 +0000 (UTC) Received: from gromit.timing.com (gromit.timing.com [206.168.13.209]) by duck.symmetricom.us (8.14.6/8.14.6) with ESMTP id s3CMl9X1038622; Sat, 12 Apr 2014 16:47:21 -0600 (MDT) (envelope-from jhein@symmetricom.com) Received: from gromit.timing.com (localhost [127.0.0.1]) by gromit.timing.com (8.14.7/8.14.5) with ESMTP id s3CMl5KW063021; Sat, 12 Apr 2014 16:47:05 -0600 (MDT) (envelope-from jhein@gromit.timing.com) Received: (from jhein@localhost) by gromit.timing.com (8.14.7/8.14.7/Submit) id s3CMl5Bh063020; Sat, 12 Apr 2014 16:47:05 -0600 (MDT) (envelope-from jhein) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <21321.49769.77880.688898@gromit.timing.com> Date: Sat, 12 Apr 2014 16:47:05 -0600 From: John Hein To: Antoine Brodin Subject: Re: Make python27 build as an unprivileged user In-Reply-To: References: <20140403190156.GA83695@mastodon.meroh.net> <20140403192420.GA36985@mastodon.meroh.net> X-Mailer: VM 8.2.0b-trunk-1484 under 24.3.1 (i386-portbld-freebsd8.3) Cc: Julio Merino , python@freebsd.org X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Apr 2014 22:47:22 -0000 Antoine Brodin wrote at 11:57 +0200 on Apr 4, 2014: > On Fri, Apr 4, 2014 at 12:51 AM, Julio Merino wrote: > > On Thu, Apr 3, 2014 at 3:30 PM, Antoine Brodin wrote: > >> koobs' new python34 port (not committed yet) packages fine as non > >> root, so it seems doable. > > > > Sorry but I don't see how that's relevant. Python 3.4 is a much more > > modern package than 2.7 and many things may have changed in its build > > infrastructure. > > > > Yes, fixing the root cause is doable for sure, and I agree with you > > that, ideally, this should be properly fixed. But: I don't think it's > > worth our time considering that: 1) this is for the "old" 2.x branch > > and 2) some knowledgeable people have already tried and failed at > > doing so. > > > > As things currently are, the python27 package is broken when building > > from ports as non-root. (Which by the way is annoying for > > architectures without prebuilt packages; I have found this problem > > under powerpc64!) > > > > What I'm proposing is that we trivially workaround the problem by > > *temporarily* defining NEED_ROOT and later investigating the failure. > > Doing the former does not preclude the latter, but at least fixes the > > obvious bug. > > > > I don't want to put words on your mouth, but what I think you are > > proposing is that we leave the package broken for an arbitrary > > (possibly infinite) amount of time until someone decides to track and > > fix the root cause. If you are offering to investigate this relatively > > soon as the maintainer that's perfect though. > > > > So up to you really! If you do not agree with the workaround, I will > > at least file a PR for proper tracking. > > Try attached patch. > > Cheers, > > Antoine > Allow staging python27 as a regular user: > > - when compiling, don't compile the running command otherwise it fails to compile modules imported by the running command > > Sorry [Errno 13] Permission denied: '/wrkdirs/usr/ports/lang/python27/work/stage/usr/local/lib/python2.7/getopt.pyc' > Sorry [Errno 13] Permission denied: '/wrkdirs/usr/ports/lang/python27/work/stage/usr/local/lib/python2.7/py_compile.pyc' > Sorry [Errno 13] Permission denied: '/wrkdirs/usr/ports/lang/python27/work/stage/usr/local/lib/python2.7/struct.pyc' > Sorry [Errno 13] Permission denied: '/wrkdirs/usr/ports/lang/python27/work/stage/usr/local/lib/python2.7/getopt.pyo' > Sorry [Errno 13] Permission denied: '/wrkdirs/usr/ports/lang/python27/work/stage/usr/local/lib/python2.7/py_compile.pyo' > Sorry [Errno 13] Permission denied: '/wrkdirs/usr/ports/lang/python27/work/stage/usr/local/lib/python2.7/struct.pyo' > > - ranlib before installing read only > > Index: lang/python27/files/patch-Makefile.pre.in > =================================================================== > --- lang/python27/files/patch-Makefile.pre.in (revision 350060) > +++ lang/python27/files/patch-Makefile.pre.in (working copy) > @@ -1,6 +1,6 @@ > ---- ./Makefile.pre.in.orig 2013-04-06 18:02:34.000000000 +0400 > -+++ ./Makefile.pre.in 2013-04-07 22:30:19.000000000 +0400 > -@@ -281,9 +281,9 @@ > +--- ./Makefile.pre.in.orig 2013-11-10 07:36:41.000000000 +0000 > ++++ ./Makefile.pre.in 2014-04-04 09:16:00.000000000 +0000 > +@@ -285,9 +285,9 @@ > > ########################################################################## > # AST > @@ -12,3 +12,28 @@ > AST_C= $(AST_C_DIR)/Python-ast.c > AST_ASDL= $(srcdir)/Parser/Python.asdl > > +@@ -1006,12 +1006,12 @@ > + $(DESTDIR)$(LIBDEST)/distutils/tests ; \ > + fi > + PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ > +- $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ > ++ $(PYTHON_FOR_BUILD) -B -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ > + -d $(LIBDEST) -f \ > + -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ > + $(DESTDIR)$(LIBDEST) > + PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ > +- $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ > ++ $(PYTHON_FOR_BUILD) -B -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ > + -d $(LIBDEST) -f \ > + -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ > + $(DESTDIR)$(LIBDEST) > +@@ -1089,8 +1089,8 @@ > + if test "$(SO)" = .dll; then \ > + $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ > + else \ > ++ $(RANLIB) $(LIBRARY) ; \ > + $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ > +- $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ > + fi; \ > + else \ > + echo Skip install of $(LIBRARY) - use make frameworkinstall; \ I'm a little late, but I've had this patch ever since python was staged. I _always_ build the 'stage' stage of ports as non-root (and I think tinderbox, et. al., should do so, too - but that's a bit beyond scope for this email thread): @@ -975,6 +975,7 @@ echo $(INSTALL_DATA) $$i $(LIBDEST); \ fi; \ done + chmod u+w $(DESTDIR)$(LIBDEST)/*.py @for d in $(LIBSUBDIRS); \ do \ a=$(srcdir)/Lib/$$d; \ @@ -1090,6 +1091,7 @@ $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ else \ $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ + chmod u+w $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ fi; \ else \ Antoine's patch is even better.