bug 539938 - Make L10n nightly updates work (for SeaMonkey), make generatesnippet.py accept a branch argument, r=armenzg
authorRobert Kaiser <kairo@kairo.at>
Tue, 19 Jan 2010 18:49:07 +0100
changeset 37317 96557e1413a197c06a14b75869eb81efb97cc100
parent 37316 0f2db07ea587da258b7c704b92481b0ff4525244
child 37318 57e0aaffc860c670a6f676e6e152ffc7d4efd83a
push idunknown
push userunknown
push dateunknown
reviewersarmenzg
bugs539938
milestone1.9.3a1pre
bug 539938 - Make L10n nightly updates work (for SeaMonkey), make generatesnippet.py accept a branch argument, r=armenzg
tools/update-packaging/generatesnippet.py
--- a/tools/update-packaging/generatesnippet.py
+++ b/tools/update-packaging/generatesnippet.py
@@ -65,16 +65,20 @@ def main():
                       "--product",
                       action="store",
                       dest="product",
                       help="[Required] This option is used to generate the URL to download the MAR file.")
     parser.add_option("--platform",
                       action="store",
                       dest="platform",
                       help="[Required] This option is used to indicate which target platform.")
+    parser.add_option("--branch",
+                      action="store",
+                      dest="branch",
+                      help="This option is used to indicate which branch name to use for FTP file names.")
     parser.add_option("--download-base-URL",
                       action="store",
                       dest="downloadBaseURL",
                       help="This option indicates under which.")
     parser.add_option("-v",
                       "--verbose",
                       action="store_true",
                       dest="verbose",
@@ -87,41 +91,45 @@ def main():
                      ('product', "specify a product."),
                      ('platform', "specify the platform.")):
         if not hasattr(options, req):
             parser.error('You must specify %s' % msg)
 
     if not options.downloadBaseURL or options.downloadBaseURL == '':
         options.downloadBaseURL = 'http://ftp.mozilla.org/pub/mozilla.org/%s/nightly' % options.product
 
+    if not options.branch or options.branch == '':
+        options.branch = None
+
     snippet = generateSnippet(options.marPath,
                               options.applicationIniFile,
                               options.locale,
                               options.downloadBaseURL,
                               options.product,
-                              options.platform)
+                              options.platform,
+                              options.branch)
     f = open(os.path.join(options.marPath, 'complete.update.snippet'), 'wb')
     f.write(snippet)
     f.close()
 
     if options.verbose:
         # Show in our logs what the contents of the snippet are
         print snippet
 
 def generateSnippet(abstDistDir, applicationIniFile, locale,
-                    downloadBaseURL, product, platform):
+                    downloadBaseURL, product, platform, branch):
     # Let's extract information from application.ini
     c = ConfigParser()
     try:
         c.readfp(open(applicationIniFile))
     except IOError, (stderror):
        sys.exit(stderror) 
     buildid = c.get("App", "BuildID")
     appVersion = c.get("App", "Version")
-    branchName = c.get("App", "SourceRepository").split('/')[-1]
+    branchName = branch or c.get("App", "SourceRepository").split('/')[-1]
 
     marFileName = '%s-%s.%s.%s.complete.mar' % (
         product,
         appVersion,
         locale,
         platform)
     # Let's determine the hash and the size of the MAR file
     # This function exits the script if the file does not exist