[Checkins] SVN: keas.build/trunk/src/keas/build/ - new tag-layout setting

Adam Groszer agroszer at gmail.com
Thu Sep 3 11:54:13 EDT 2009


Log message for revision 103506:
  - new tag-layout setting
  - Stop if no buildout-server given
  add those to docs
  

Changed:
  U   keas.build/trunk/src/keas/build/build.py
  U   keas.build/trunk/src/keas/build/index.txt
  U   keas.build/trunk/src/keas/build/package.py

-=-
Modified: keas.build/trunk/src/keas/build/build.py
===================================================================
--- keas.build/trunk/src/keas/build/build.py	2009-09-03 13:22:56 UTC (rev 103505)
+++ keas.build/trunk/src/keas/build/build.py	2009-09-03 15:54:13 UTC (rev 103506)
@@ -79,6 +79,13 @@
         version = builder.runCLI(configFile, True)
         projectParser.set('versions', pkg, version)
 
+    # Stop if no buildout-server given
+    try:
+        config.get(base.BUILD_SECTION, 'buildout-server')
+    except ConfigParser.NoOptionError:
+        logger.info('No buildout-server, stopping')
+        return
+
     # Write the new configuration file to disk
     projectName = config.get(base.BUILD_SECTION, 'name')
     defaultVersion = configVersion = config.get(base.BUILD_SECTION, 'version')

Modified: keas.build/trunk/src/keas/build/index.txt
===================================================================
--- keas.build/trunk/src/keas/build/index.txt	2009-09-03 13:22:56 UTC (rev 103505)
+++ keas.build/trunk/src/keas/build/index.txt	2009-09-03 15:54:13 UTC (rev 103506)
@@ -175,6 +175,13 @@
   correct versions of each of the ``twollow.*`` packages.  More on
   this later.
 
+- **tag-layout** - Choose from ``flat`` or ``subfolder``
+
+  - **flat** Tags will be created in svn as /tags/package-version
+    This is the default setting.
+
+  - **subfolder** Tags will be created in svn as /tags/package/version
+
 - **upload-type** - Choose from ``internal`` or ``setup.py``
 
   - **internal** Upload packages to a WebDAV enabled web server using the
@@ -186,7 +193,8 @@
 
 - **package-index** - The url to a WebDAV [#webdav]_ enabled web
   server where generated eggs for each of the ``twollow.*`` packages
-  should be uploaded. Used only if ``upload-type`` is ``internal``.
+  should be uploaded. Used for upload only if ``upload-type`` is ``internal``.
+  Also used to check/get existing versions of packages.
 
 - **package-index-username** - The username for accessing the WebDAV
   server
@@ -196,6 +204,7 @@
 
 - **buildout-server** - The url to a WebDAV enabled web
   server where generated buildout files should be uploaded.
+  If not given, the process stops after releasing the packages.
 
 - **buildout-server-username** - The username for accessing the WebDAV
   server

Modified: keas.build/trunk/src/keas/build/package.py
===================================================================
--- keas.build/trunk/src/keas/build/package.py	2009-09-03 13:22:56 UTC (rev 103505)
+++ keas.build/trunk/src/keas/build/package.py	2009-09-03 15:54:13 UTC (rev 103506)
@@ -42,6 +42,7 @@
     customPath = None
     options = None
 
+    uploadType = 'internal'
     packageIndexUrl = None
     packageIndexUsername = None
     packageIndexPassword = None
@@ -50,17 +51,25 @@
     svnRepositoryUsername = None
     svnRepositoryPassword = None
 
+    tagLayout = 'flat'
+
     def __init__(self, pkg, options):
         self.pkg = pkg
         self.options = options
 
     def getTagURL(self, version):
         reposUrl = self.svnRepositoryUrl
+        separator = '-'
+        if self.tagLayout == 'flat':
+            separator = '-'
+        elif self.tagLayout == 'subfolder':
+            separator = '/'
         if self.customPath:
             reposUrl = urllib.basejoin(reposUrl, self.customPath)
-            tagUrl = reposUrl.split('%s')[0] + 'tags/%s-%s' %(self.pkg, version)
+            tagUrl = reposUrl.split('%s')[0] + 'tags/%s%s%s' %(
+                self.pkg, separator, version)
         else:
-            tagUrl = reposUrl + 'tags/%s-%s' %(self.pkg, version)
+            tagUrl = reposUrl + 'tags/%s%s%s' %(self.pkg, separator, version)
         logger.debug('Tag URL: ' + tagUrl)
         return tagUrl
 
@@ -104,6 +113,7 @@
 
         soup = BeautifulSoup.BeautifulSoup(urllib2.urlopen(req).read())
         #TODO: handle real pypi index page!
+        #right now this supports only a flat list of all packages
 
         VERSION = re.compile(self.pkg+r'-(\d\.\d(\.\d)?)')
 
@@ -177,12 +187,14 @@
         branchUrl = self.getBranchURL(branch)
         tagUrl = self.getTagURL(version)
 
+        #TODO: destination folder might not exist... create it
         base.do('svn cp -m "Create release tag" %s %s' %(branchUrl, tagUrl))
 
         # 2. Download tag
         buildDir = tempfile.mkdtemp()
         tagDir = os.path.join(buildDir, '%s-%s' %(self.pkg, version))
-        base.do('svn co %s %s' %(tagUrl, tagDir))
+        # depth = don't get the whole tree, but works only with svn 1.5+
+        base.do('svn co --depth=files %s %s' %(tagUrl, tagDir))
 
         # 3. Create release
         # 3.1. Remove setup.cfg
@@ -217,6 +229,8 @@
         elif self.uploadType == 'setup.py':
             # 3.4. Create distribution and upload in one step
             base.do('cd %s && python setup.py sdist register upload' %(tagDir))
+        else:
+            logger.warn('Unknown uploadType: ' + self.uploadType)
 
         # 5. Update the start branch to the next devel version
         if not self.options.noBranchUpdate:
@@ -265,6 +279,12 @@
         except ConfigParser.NoOptionError:
             self.uploadType = 'internal'
 
+        try:
+            self.tagLayout = config.get(
+                base.BUILD_SECTION, 'tag-layout')
+        except ConfigParser.NoOptionError:
+            self.tagLayout = 'flat'
+
         # 1.3. Determine the possibly custom path.
         for pkg in config.get(base.BUILD_SECTION, 'packages').split():
             if pkg.startswith(self.pkg):



More information about the checkins mailing list