Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Apr 2014 16:47:05 -0600
From:      John Hein <john.hein@microsemi.com>
To:        Antoine Brodin <antoine@FreeBSD.org>
Cc:        Julio Merino <jmmv@freebsd.org>, python@freebsd.org
Subject:   Re: Make python27 build as an unprivileged user
Message-ID:  <21321.49769.77880.688898@gromit.timing.com>
In-Reply-To: <CAALwa8m2MetR9mUmT5K3zRc_szt-Btgq=DbYpDLa-aqWnuSy_Q@mail.gmail.com>
References:  <20140403190156.GA83695@mastodon.meroh.net> <CAALwa8koQy2U2_t=vkZ_KdpDSVyrj6mAxHnR4wqjNPyXvXV=gg@mail.gmail.com> <20140403192420.GA36985@mastodon.meroh.net> <CAALwa8mEB7wZRhBCJ5n=ejAAQcz35_J6V8OoUpVXAhAs9SvY5w@mail.gmail.com> <CAFY7cWAMZ9vy7GtoRLK-R5sogNkqq%2BtHQPVSpmduq5%2BmLhxxyQ@mail.gmail.com> <CAALwa8m2MetR9mUmT5K3zRc_szt-Btgq=DbYpDLa-aqWnuSy_Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Antoine Brodin wrote at 11:57 +0200 on Apr  4, 2014:
 > On Fri, Apr 4, 2014 at 12:51 AM, Julio Merino <jmmv@freebsd.org> wrote:
 > > On Thu, Apr 3, 2014 at 3:30 PM, Antoine Brodin <antoine@freebsd.org> 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.



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