r2132 - in zope2.12/branches/with-revived-tarball/debian (3 files)

pumazi-guest at users.alioth.debian.org pumazi-guest at users.alioth.debian.org
Fri Nov 12 01:29:03 UTC 2010


    Date: Friday, November 12, 2010 @ 01:29:00
  Author: pumazi-guest
Revision: 2132

Adding a python interpreter template file. This changeset provides a successful build against the tarball trunk. I've had success creating and running a zope2 instance by manually calling the scripts. We'll need to update zope-common in order for zope2.12-sandbox to complete the postinst configuration process.

Added:
  zope2.12/branches/with-revived-tarball/debian/python_interpreter_template.in
Modified:
  zope2.12/branches/with-revived-tarball/debian/patches/debian-changes-2.12.10-1
  zope2.12/branches/with-revived-tarball/debian/rules

Modified: zope2.12/branches/with-revived-tarball/debian/patches/debian-changes-2.12.10-1
===================================================================
--- zope2.12/branches/with-revived-tarball/debian/patches/debian-changes-2.12.10-1	2010-11-10 03:47:50 UTC (rev 2131)
+++ zope2.12/branches/with-revived-tarball/debian/patches/debian-changes-2.12.10-1	2010-11-12 01:29:00 UTC (rev 2132)
@@ -149,280 +149,3 @@
 +echo "The testcase was successful"
 +exit 0
 \ No newline at end of file
---- zope2.12-2.12.10.orig/configuration/buildout.cfg
-+++ zope2.12-2.12.10/configuration/buildout.cfg
-@@ -10,11 +10,11 @@ dists = Zope2
- # Exclude Setuptools, because it is a prerequisite of the build
- exclude-dists =
-     distribute
--dists-location = /home/mrm41/z2tar/testcase-env/lib/python2.6/site-packages
--scripts-location = /home/mrm41/z2tar/testcase-env/bin
--pth-location = /home/mrm41/z2tar/testcase-env/lib/python2.6/site-packages
-+dists-location = /usr/lib/zope2.12/lib/python
-+scripts-location = /usr/lib/zope2.12/bin
-+pth-location = /usr/lib/zope2.12/lib/python
- # Do we really need this if we are adjusting the path in rules build anyhow?
--executable = /home/mrm41/z2tar/testcase-env/bin/python
-+executable = python
- # We definitely want to stage it locally, because the installation process
- # takes care of putting the "stuff" in it's final location.
- exclude-own-pth = true
---- zope2.12-2.12.10.orig/source/docutils/extras/docutils.egg-info/top_level.txt
-+++ zope2.12-2.12.10/source/docutils/extras/docutils.egg-info/top_level.txt
-@@ -1,2 +1 @@
- docutils
--roman
---- zope2.12-2.12.10.orig/source/Zope2/build/lib.linux-i686-2.6/webdav/davcmds.py
-+++ zope2.12-2.12.10/source/Zope2/build/lib.linux-i686-2.6/webdav/davcmds.py
-@@ -173,7 +173,7 @@ class PropFind:
-                     if dflag:
-                         ob._p_deactivate()
-                 elif hasattr(ob, '__dav_resource__'):
--                    uri = urljoin(url, absattr(ob.getId()))
-+                    uri = urljoin(url, quote(absattr(ob.getId())))
-                     depth = depth=='infinity' and depth or 0
-                     self.apply(ob, uri, depth, result, top=0)
-                     if dflag:
---- zope2.12-2.12.10.orig/source/Zope2/build/lib.linux-i686-2.6/Zope2/utilities/copyzopeskel.py
-+++ zope2.12-2.12.10/source/Zope2/build/lib.linux-i686-2.6/Zope2/utilities/copyzopeskel.py
-@@ -1,3 +1,5 @@
-+#!/usr/bin/env python
-+
- ##############################################################################
- #
- # Copyright (c) 2002 Zope Foundation and Contributors.
-@@ -162,7 +164,7 @@ def main():
- 
-     copyskel(sourcedir, targetdir, uid, gid, **replacements)
- 
--def copyskel(sourcedir, targetdir, uid, gid, **replacements):
-+def copyskel(sourcedir, targetdir, uid, gid, layout='zope', **replacements):
-     """ This is an independent function because we'd like to
-     import and call it from mkzopeinstance """
-     # Create the top of the instance:
-@@ -174,13 +176,22 @@ def copyskel(sourcedir, targetdir, uid,
-     # with it.
-     pwd = os.getcwd()
-     os.chdir(sourcedir)
--    try:
-+    ##try:
-+    if True:
-         try:
-             os.path.walk(os.curdir, copydir,
-                          (targetdir, replacements, uid, gid))
-+            if layout == 'fhs':
-+                movedir(os.path.join(targetdir, 'etc'),
-+                        os.path.join('/etc/zope2.12', os.path.basename(targetdir)),
-+                        uid, gid)
-+                movedir(os.path.join(targetdir, 'log'),
-+                        os.path.join('/var/log/zope2.12', os.path.basename(targetdir)),
-+                        uid, gid)
-         finally:
-             os.chdir(pwd)
--    except (IOError, OSError), msg:
-+    ##except (IOError, OSError), msg:
-+    else:
-         print >>sys.stderr, msg
-         sys.exit(1)
- 
-@@ -240,6 +251,39 @@ def copyin(src, dst, replacements, uid,
-     if uid is not None:
-         os.chown(dst, uid, gid)
- 
-+def movedir(sourcedir, targetdir, uid, gid):
-+    try:
-+        os.makedirs(os.path.dirname(targetdir))
-+        if uid is not None:
-+            os.chown(os.path.dirname(targetdir), uid, gid)
-+    except:
-+        pass
-+    if not os.path.isdir(targetdir):
-+        shutil.move(sourcedir, targetdir)
-+    elif os.path.islink(sourcedir):
-+        return
-+    else:
-+        import glob
-+        for src in glob.glob(sourcedir + '/*') + glob.glob(targetdir + '/.*'):
-+            base = os.path.basename(src)
-+            target = os.path.join(targetdir, base)
-+            if os.path.exists(target):
-+                backup = target + '.old'
-+                if os.path.exists(backup):
-+                    if os.path.isdir(backup):
-+                        shutil.rmtree(backup, ignore_errors=True)
-+                    else:
-+                        os.unlink(backup)
-+                os.rename(target, backup)
-+            shutil.move(src, target)
-+        shutil.rmtree(sourcedir, ignore_errors=True)
-+    if uid is not None:
-+        os.chown(targetdir, uid, gid)
-+        for root, dirs, files in os.walk(targetdir):
-+            for name in files + dirs:
-+                os.chown(os.path.join(root, name), uid, gid)
-+    os.symlink(targetdir, sourcedir)
-+
- def usage(stream, msg=None):
-     if msg:
-         print >>stream, msg
---- zope2.12-2.12.10.orig/source/Zope2/build/lib.linux-i686-2.6/Zope2/utilities/mkzopeinstance.py
-+++ zope2.12-2.12.10/source/Zope2/build/lib.linux-i686-2.6/Zope2/utilities/mkzopeinstance.py
-@@ -1,3 +1,5 @@
-+#!/usr/bin/env python
-+
- ##############################################################################
- #
- # Copyright (c) 2002 Zope Foundation and Contributors.
-@@ -21,11 +23,16 @@ Options:
- -u/--user NAME:PASSWORD -- set the user name and password of the initial user
- -s/--skelsrc -- the dir from which skeleton files should be copied
- -p/--python -- the Python interpreter to use
-+-l/--layout -- layout to use while copying the skeleton files (`fhs' or `zope')
-+--service-user -- system user to be used to run this instance (user:group)
-+--service-port -- HTTP port used to run this instance
-+--zeo-server HOST:PORT -- use a ZEO server instead of a local ZODB database
- 
- When run without arguments, this script will ask for the information necessary
- to create a Zope instance home.
- """
- 
-+import re
- import getopt
- import os
- import sys
-@@ -34,8 +41,8 @@ import copyzopeskel
- def main():
-     try:
-         opts, args = getopt.getopt(sys.argv[1:],
--            "hu:d:s:p:",
--            ["help", "user=", "dir=", "skelsrc=", "python="]
-+            "hu:d:s:p:l:",
-+            ["help", "user=", "dir=", "skelsrc=", "python=", "layout=", "service-user=", "service-port=", "zeo-server="]
-             )
-     except getopt.GetoptError, msg:
-         usage(sys.stderr, msg)
-@@ -47,6 +54,10 @@ def main():
-     skeltarget = None
-     skelsrc = None
-     python = None
-+    layout = 'zope'
-+    srvuser = 'zope:zope'
-+    srvport = 9673
-+    zeoserver = None
- 
-     if check_buildout(script_path):
-         python = os.path.join(script_path, 'zopepy')
-@@ -78,6 +89,36 @@ def main():
-                 usage(sys.stderr, "user must be specified as name:password")
-                 sys.exit(2)
-             user, password = arg.split(":", 1)
-+        if opt in ("--layout",):
-+            if not arg or arg not in ('fhs', 'zope'):
-+                usage(sys.stderr, "layout to use while copying the skeleton files (`fhs' or `zope')")
-+                sys.exit(2)
-+            layout = arg
-+        if opt in ("--service-user",):
-+            if not arg:
-+                usage(sys.stderr, "service user must not be empty")
-+                sys.exit(2)
-+            if not ":" in arg:
-+                usage(sys.stderr, "service user must be specified as user:group")
-+                sys.exit(2)
-+            srvuser = arg
-+        if opt in ("--service-port",):
-+            if not arg:
-+                usage(sys.stderr, "service port must not be empty")
-+                sys.exit(2)
-+            try:
-+                srvport = int(arg)
-+            except ValueError:
-+                usage(sys.stderr, "service port must be an integer")
-+                sys.exit(2)
-+        if opt in ("--zeo-server",):
-+            if not arg:
-+                usage(sys.stderr, "zeo server must not be empty")
-+                sys.exit(2)
-+            if not ":" in arg:
-+                usage(sys.stderr, "zeo server must be specified as host:port")
-+                sys.exit(2)
-+            zeoserver = arg
- 
-     if not skeltarget:
-         # interactively ask for skeltarget and initial user name/passwd.
-@@ -129,12 +170,28 @@ def main():
-         "INSTANCE_HOME": instancehome,
-         "ZOPE_SCRIPTS": script_path,
-         "ZOPE2PATH": zope2path,
-+        "ZOPE_USER": srvuser.split(":")[0],
-+        "ZOPE_HTTPPORT": str(srvport),
-+        "ZEO_SERVER": zeoserver or 'localhost:8100',
-         }
- 
--    copyzopeskel.copyskel(skelsrc, skeltarget, None, None, **kw)
-+    import pwd, grp
-+    uid = pwd.getpwnam(srvuser.split(":")[0])
-+    if uid: uid = uid[2]
-+    gid = grp.getgrnam(srvuser.split(":")[1])
-+    if gid: gid = gid[2]
-+
-+    copyzopeskel.copyskel(skelsrc, skeltarget, uid, gid, layout, **kw)
-     if user and password:
-         write_inituser(inituser, user, password)
- 
-+    zope_conf = os.path.join(skeltarget, 'etc', 'zope.conf')
-+    re_zodb = re.compile('^# %s: ' % (zeoserver and 'ZEO' or 'ZODB')).sub
-+    output = []
-+    for r in open(zope_conf).readlines():
-+        output.append(re_zodb('', r))
-+    open(zope_conf, 'w').write(''.join(output))
-+
- def usage(stream, msg=None):
-     if msg:
-         print >>stream, msg
---- zope2.12-2.12.10.orig/source/Zope2/build/lib.linux-i686-2.6/Zope2/utilities/skel/etc/zope.conf.in
-+++ zope2.12-2.12.10/source/Zope2/build/lib.linux-i686-2.6/Zope2/utilities/skel/etc/zope.conf.in
-@@ -23,6 +23,9 @@
- # ZConfig "defines" used for later textual substitution
- 
- %define INSTANCE <<INSTANCE_HOME>>
-+%define HTTPPORT <<ZOPE_HTTPPORT>>
-+%define ZOPE_USER <<ZOPE_USER>>
-+%define ZEO_SERVER <<ZEO_SERVER>>
- 
- # Directive: instancehome
- #
-@@ -146,7 +149,7 @@ instancehome $INSTANCE
- # Example:
- #
- #    effective-user chrism
--
-+effective-user $ZOPE_USER
- 
- # Directive: enable-product-installation
- #
-@@ -964,7 +967,7 @@ instancehome $INSTANCE
- 
- <http-server>
-   # valid keys are "address" and "force-connection-close"
--  address 8080
-+  address $HTTPPORT
- 
-   # force-connection-close on
-   #
-@@ -1065,7 +1068,7 @@ instancehome $INSTANCE
- #   <zeoclient>
- #     # See .../ZODB/component.xml for directives (sectiontype
- #     # "zeoclient").
--#     server localhost:8100
-+#     server $ZEO_SERVER
- #     storage 1
- #     name zeostorage
- #     var $INSTANCE/var
---- zope2.12-2.12.10.orig/source/ZODB3/build/lib.linux-i686-2.6/ZODB/scripts/analyze.py
-+++ zope2.12-2.12.10/source/ZODB3/build/lib.linux-i686-2.6/ZODB/scripts/analyze.py
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python2.4
-+#!/usr/bin/env python
- 
- # Based on a transaction analyzer by Matt Kromer.
- 

Added: zope2.12/branches/with-revived-tarball/debian/python_interpreter_template.in
===================================================================
--- zope2.12/branches/with-revived-tarball/debian/python_interpreter_template.in	                        (rev 0)
+++ zope2.12/branches/with-revived-tarball/debian/python_interpreter_template.in	2010-11-12 01:29:00 UTC (rev 2132)
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+import sys
+import site
+
+site.addsitedir('/usr/lib/zope at ZVER@/lib/python')
+
+_interactive = True
+if len(sys.argv) > 1:
+    _options, _args = __import__("getopt").getopt(sys.argv[1:], 'ic:m:')
+    _interactive = False
+    for (_opt, _val) in _options:
+        if _opt == '-i':
+            _interactive = True
+        elif _opt == '-c':
+            exec _val
+        elif _opt == '-m':
+            sys.argv[1:] = _args
+            _args = []
+            __import__("runpy").run_module(
+                 _val, {}, "__main__", alter_sys=True)
+
+    if _args:
+        sys.argv[:] = _args
+        __file__ = _args[0]
+        del _options, _args
+        execfile(__file__)
+
+if _interactive:
+    del _interactive
+    __import__("code").interact(banner="", local=globals())
\ No newline at end of file

Modified: zope2.12/branches/with-revived-tarball/debian/rules
===================================================================
--- zope2.12/branches/with-revived-tarball/debian/rules	2010-11-10 03:47:50 UTC (rev 2131)
+++ zope2.12/branches/with-revived-tarball/debian/rules	2010-11-12 01:29:00 UTC (rev 2132)
@@ -16,9 +16,7 @@
 
 # TODO:
 #  - Bring back lsb-release for Ubuntu support
-#  - sys.path insertion will happen in the upstream tarball. The feature was
-#    temporarily removed during the zc.buildout removal.
-#  - 
+#  - ...
 
 %:
 	dh $@ 
@@ -56,6 +54,8 @@
 
 override_dh_auto_install:
 	make install PYTHON=python DESTDIR=$(DEBIAN)/$(ZOPE)
+	sed -i '/^#!.*$$/a\import site; site.addsitedir("/usr/lib/$(ZOPE)/lib/python")' $$(find $(DEBIAN)/$(ZOPE)/usr/lib/$(ZOPE)/bin -type f ! -type l)
+	cp $(DEBIAN)/python_interpreter_template $(DEBIAN)/$(ZOPE)/usr/lib/$(ZOPE)/bin/python
 
 override_dh_fixperms:
 	dh_fixperms --
@@ -65,5 +65,6 @@
 	find $(DEBIAN)/$(ZOPE)/usr/lib/$(ZOPE)/lib/python -type f -a \
 		\( -name \*.gif -o -name \*.html -o -name \*.dtml -o -name \*.txt -o -name \*.bat -o -name \*.jpg \) -exec chmod 644 {} \;
 	chmod 644 $(DEBIAN)/$(ZOPE)/usr/lib/$(ZOPE)/lib/python/Zope2-*/Zope2/utilities/reindex_catalog.py
+	chmod 755 $(DEBIAN)/$(ZOPE)/usr/lib/$(ZOPE)/bin/python
 
 .PHONY: override_dh_auto_clean override_dh_auto_configure override_dh_auto_build override_dh_prep override_dh_installdirs override_dh_auto_install override_dh_fixperms




More information about the pkg-zope-developers mailing list