[Checkins] SVN: zc.buildout/branches/buildroot/src/zc/buildout/ Added buildroot var, although, I'm not sure that I'm going to pursue

Jim Fulton jim at zope.com
Thu Nov 9 12:03:25 EST 2006


Log message for revision 71101:
  Added buildroot var, although, I'm not sure that I'm going to pursue
  this.
  

Changed:
  U   zc.buildout/branches/buildroot/src/zc/buildout/buildout.py
  A   zc.buildout/branches/buildroot/src/zc/buildout/system-packaging.txt
  U   zc.buildout/branches/buildroot/src/zc/buildout/tests.py

-=-
Modified: zc.buildout/branches/buildroot/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/branches/buildroot/src/zc/buildout/buildout.py	2006-11-09 12:18:08 UTC (rev 71100)
+++ zc.buildout/branches/buildroot/src/zc/buildout/buildout.py	2006-11-09 17:03:25 UTC (rev 71101)
@@ -110,6 +110,26 @@
             options[option] = value
                 # The egg dire
 
+
+        # initialize some attrs and buildout directories.
+        options = data['buildout']
+        buildroot = options.get('buildroot')
+        if buildroot:
+            options['virtual-directory'] = options['directory']
+            options['directory'] = buildroot + options['directory']
+            os.makedirs(options['directory'])
+        
+        self._buildout_dir = options['directory']
+        for name in ('bin', 'parts', 'eggs', 'develop-eggs'):
+            d = options[name+'-directory']
+            if buildroot:
+                options['virual-'+name+'-directory'] = os.path.join(
+                    options['virtual-directory'], d)
+            options[name+'-directory'] = os.path.join(options['directory'], d)
+
+        options['installed'] = os.path.join(options['directory'],
+                                            options['installed'])
+
         # do substitutions
         converted = {}
         for section, options in data.iteritems():
@@ -124,20 +144,10 @@
         for section, options in data.iteritems():
             self[section] = Options(self, section, options)
         
-        # initialize some attrs and buildout directories.
-        options = self['buildout']
 
         links = options.get('find-links', '')
         self._links = links and links.split() or ()
 
-        self._buildout_dir = options['directory']
-        for name in ('bin', 'parts', 'eggs', 'develop-eggs'):
-            d = self._buildout_path(options[name+'-directory'])
-            options[name+'-directory'] = d
-
-        options['installed'] = os.path.join(options['directory'],
-                                            options['installed'])
-
         self._setup_logging()
 
     def _dosubs(self, section, option, value, data, converted, seen):

Added: zc.buildout/branches/buildroot/src/zc/buildout/system-packaging.txt
===================================================================
--- zc.buildout/branches/buildroot/src/zc/buildout/system-packaging.txt	2006-11-09 12:18:08 UTC (rev 71100)
+++ zc.buildout/branches/buildroot/src/zc/buildout/system-packaging.txt	2006-11-09 17:03:25 UTC (rev 71101)
@@ -0,0 +1,71 @@
+Experimental Support for System Packaging
+=========================================
+
+Buildout has an experimental feature to support system packaging.
+Often, after developing an application with buildout, you want to
+deploy it using system packages, such as RPMs or Debian packages.
+To build such packages, especially to build them as an ordinary user,
+it is helpful to be able to install to a temporary location, but write
+files as if they were going to be installed with the base part of the
+temporary location removed.  This is done by providing a buildout
+buildroot option.  When a buildroot is specified, the buildroot is
+added to the buildout directories and a set of extra buildout options
+are defined with the original directories.  To see how this works,
+we'll jusr run the sample empty buildout, specifying some options on
+the command line:
+
+    >>> root = tmpdir('sample_root')
+    >>> print system(join('bin', 'buildout')
+    ...              + ' buildout:directory=/opt/foo'
+    ...              + ' buildout:buildroot='+root
+    ...              + ' -v'
+    ...              ),
+    Configuration data:
+    [buildout]
+    bin-directory = /sample_root/opt/foo/bin
+    buildroot = /sample_root
+    develop-eggs-directory = /sample_root/opt/foo/develop-eggs
+    directory = /sample_root/opt/foo
+    eggs-directory = /sample_root/opt/foo/eggs
+    executable = /usr/local/bin/python2.4
+    installed = /sample_root/opt/foo/.installed.cfg
+    log-format = %%(name)s: %%(message)s
+    log-level = INFO
+    parts = 
+    parts-directory = /sample_root/opt/foo/parts
+    python = buildout
+    verbosity = 10
+    virtual-directory = /opt/foo
+    virual-bin-directory = /opt/foo/bin
+    virual-develop-eggs-directory = /opt/foo/develop-eggs
+    virual-eggs-directory = /opt/foo/eggs
+    virual-parts-directory = /opt/foo/parts
+    <BLANKLINE>
+    buildout: Creating directory /sample_root/opt/foo/bin
+    buildout: Creating directory /sample_root/opt/foo/parts
+    buildout: Creating directory /sample_root/opt/foo/eggs
+    buildout: Creating directory /sample_root/opt/foo/develop-eggs
+    zc.buildout.easy_install: Installing ['zc.buildout', 'setuptools']
+    zc.buildout.easy_install: We have a develop egg for zc.buildout
+    zc.buildout.easy_install: We have the best distribution that satisfies
+    setuptools
+
+Here we see that the buildout directory was prefixed with the
+buildroot. We also see that a set of options, starting with "virual-"
+was generated with the locations without the buildroot.
+
+If we look at the buildroot, we specify, we can see that we generated
+the various directories:
+
+    >>> ls(root)
+    d  opt
+
+    >>> ls(root, 'opt')
+    d  foo
+
+    >>> ls(root, 'opt', 'foo')
+    -  .installed.cfg
+    d  bin
+    d  develop-eggs
+    d  eggs
+    d  parts


Property changes on: zc.buildout/branches/buildroot/src/zc/buildout/system-packaging.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: zc.buildout/branches/buildroot/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/branches/buildroot/src/zc/buildout/tests.py	2006-11-09 12:18:08 UTC (rev 71100)
+++ zc.buildout/branches/buildroot/src/zc/buildout/tests.py	2006-11-09 17:03:25 UTC (rev 71101)
@@ -880,7 +880,7 @@
     import zc.buildout.testselectingpython
     suite = unittest.TestSuite((
         doctest.DocFileSuite(
-            'buildout.txt', 'runsetup.txt',
+            'buildout.txt', 'runsetup.txt', 'system-packaging.txt',
             setUp=zc.buildout.testing.buildoutSetUp,
             tearDown=zc.buildout.testing.buildoutTearDown,
             checker=renormalizing.RENormalizing([



More information about the Checkins mailing list