Bug 673834 - Obsolete ReleaseRepackFactory, fold logic into CCReleaseRepackFactory seamonkey-production
authorJustin Wood <Callek@gmail.com>
Sun, 24 Jul 2011 23:29:54 -0400
branchseamonkey-production
changeset 1696 7eafdcab63b51e605735c801adf36699ca0a728d
parent 1689 b263c3e9eb9efd451f3de7d1ccde56db2a8546ae
child 1697 29b848b92de90b0eb137da3a131319eb2025e0ef
push id1201
push userCallek@gmail.com
push dateMon, 25 Jul 2011 03:30:18 +0000
bugs673834
Bug 673834 - Obsolete ReleaseRepackFactory, fold logic into CCReleaseRepackFactory
process/factory.py
--- a/process/factory.py
+++ b/process/factory.py
@@ -2641,20 +2641,16 @@ class BaseRepackFactory(MozillaBuildFact
             # L10NBASEDIR is relative to MOZ_OBJDIR
             self.env.update({'MOZ_OBJDIR': objdir,
                              'L10NBASEDIR':  '../../%s' % self.l10nRepoPath})            
 
         if platform == 'macosx64':
             # use "mac" instead of "mac64" for macosx64
             self.env.update({'MOZ_PKG_PLATFORM': 'mac'})
 
-        # Configure step gets executed before the downloadBuilds and we can't
-        # render at that point of execution the environment variable 'srcdir'
-        self.configure_env = self.env.copy()
-
         self.uploadEnv = self.env.copy() # pick up any env variables in our subclass
         self.uploadEnv.update({
             'AB_CD': WithProperties('%(locale)s'),
             'UPLOAD_HOST': stageServer,
             'UPLOAD_USER': stageUsername,
             'UPLOAD_TO_TEMP': '1',
             'POST_UPLOAD_CMD': self.postUploadCmd # defined in subclasses
         })
@@ -2766,17 +2762,17 @@ class BaseRepackFactory(MozillaBuildFact
         # a mozconfig for now. This will be fixed in bug 518359
         if self.platform.startswith('wince'):
             self.addStep(ShellCommand,
              name='configure',
              command=['make -f client.mk configure'], 
              description='configure',
              descriptionDone='configure done',
              haltOnFailure=True,
-             env = self.configure_env,
+             env = self.env,
              workdir='%s/%s' % (self.baseWorkDir, self.origSrcDir)
             )
         else:
             # For backward compatibility where there is no mozconfig
             self.addStep(ShellCommand, **self.processCommand(
              name='configure',
              command=['sh', '--',
                       './configure', '--enable-application=%s' % self.appName,
@@ -3412,20 +3408,27 @@ class ReleaseFactory(MozillaBuildFactory
     def makeLongVersion(self, version, usePretty=True):
         if not usePretty:
            return version
         version = re.sub('a([0-9]+)$', ' Alpha \\1', version)
         version = re.sub('b([0-9]+)$', ' Beta \\1', version)
         version = re.sub('rc([0-9]+)$', ' RC \\1', version)
         return version
 
-
-class ReleaseRepackFactory(BaseRepackFactory, ReleaseFactory):
+class CCReleaseRepackFactory(CCBaseRepackFactory, ReleaseFactory):
     def __init__(self, platform, buildRevision, version, buildNumber,
-                 env={}, brandName=None, mergeLocales=False, usePrettyLongVer=True, **kwargs):
+                 env={}, brandName=None, mergeLocales=False, usePrettyLongVer=True,
+                 mozRepoPath='', inspectorRepoPath='', venkmanRepoPath='',
+                 chatzillaRepoPath='', cvsroot='', **kwargs):
+        self.skipBlankRepos = True
+        self.mozRepoPath = mozRepoPath
+        self.inspectorRepoPath = inspectorRepoPath
+        self.venkmanRepoPath = venkmanRepoPath
+        self.chatzillaRepoPath = chatzillaRepoPath
+        self.cvsroot = cvsroot
         self.buildRevision = buildRevision
         self.version = version
         self.buildNumber = buildNumber
         self.usePrettyLongVer = usePrettyLongVer
         if brandName:
             self.brandName = brandName
         else:
             self.brandName = kwargs['project'].capitalize()
@@ -3439,17 +3442,18 @@ class ReleaseRepackFactory(BaseRepackFac
         assert 'project' in kwargs
         # TODO: better place to put this/call this
         self.postUploadCmd = 'post_upload.py ' + \
                              '-p %s ' % kwargs['project'] + \
                              '-v %s ' % self.version + \
                              '-n %s ' % self.buildNumber + \
                              '--release-to-candidates-dir'
         BaseRepackFactory.__init__(self, env=env, platform=platform,
-                                   mergeLocales=mergeLocales, **kwargs)
+                                   mergeLocales=mergeLocales, mozillaDir='mozilla',
+                                   mozconfigBranch='default', **kwargs)
 
     def updateSources(self):
         self.addStep(ShellCommand,
          name='update_sources',
          command=['hg', 'up', '-C', '-r', self.buildRevision],
          workdir='build/'+self.origSrcDir,
          description=['update %s' % self.branchName,
                       'to %s' % self.buildRevision],
@@ -3463,26 +3467,58 @@ class ReleaseRepackFactory(BaseRepackFac
         )
         self.addStep(SetProperty,
                      command=['hg', 'ident', '-i'],
                      haltOnFailure=True,
                      property='l10n_revision',
                      workdir=WithProperties('build/' + self.l10nRepoPath + 
                                             '/%(locale)s')
                      )
-
-    def downloadBuilds(self):
+        self.addStep(ShellCommand,
+         command=['hg', 'up', '-C', '-r', self.buildRevision],
+         workdir='build/'+self.mozillaSrcDir,
+         description=['update mozilla',
+                      'to %s' % self.buildRevision],
+         haltOnFailure=True
+        )
+        if self.venkmanRepoPath:
+            self.addStep(ShellCommand,
+             command=['hg', 'up', '-C', '-r', self.buildRevision],
+             workdir='build/'+self.mozillaSrcDir+'/extensions/venkman',
+             description=['update venkman',
+                          'to %s' % self.buildRevision],
+             haltOnFailure=True
+            )
+        if self.inspectorRepoPath:
+            self.addStep(ShellCommand,
+             command=['hg', 'up', '-C', '-r', self.buildRevision],
+             workdir='build/'+self.mozillaSrcDir+'/extensions/inspector',
+             description=['update inspector',
+                          'to %s' % self.buildRevision],
+             haltOnFailure=True
+            )
+        if self.chatzillaRepoPath:
+            self.addStep(ShellCommand,
+             command=['hg', 'up', '-C', '-r', self.buildRevision],
+             workdir='build/'+self.mozillaSrcDir+'/extensions/irc',
+             description=['update chatzilla',
+                          'to %s' % self.buildRevision],
+             haltOnFailure=True
+            )
+
+    def preClean(self):
         # We need to know the absolute path to the input builds when we repack,
         # so we need retrieve at run-time as a build property
         self.addStep(SetProperty,
          command=['bash', '-c', 'pwd'],
          property='srcdir',
          workdir='build/'+self.origSrcDir
         )
 
+    def downloadBuilds(self):
         candidatesDir = 'http://%s' % self.stageServer + \
                         '/pub/mozilla.org/%s/nightly' % self.project + \
                         '/%s-candidates/build%s' % (self.version,
                                                     self.buildNumber)
         longVersion = self.makeLongVersion(self.version, self.usePrettyLongVer)
 
         # This block sets platform specific data that our wget command needs.
         #  build is mapping between the local and remote filenames
@@ -3562,72 +3598,16 @@ class ReleaseRepackFactory(BaseRepackFac
          description=['repack', 'installers'],
          command=['sh','-c',
                   WithProperties('make installers-%(locale)s LOCALE_MERGEDIR=$PWD/merged')],
          env=self.env,
          haltOnFailure=True,
          workdir='build/'+self.objdir+'/'+self.appName+'/locales'
         )
 
-class CCReleaseRepackFactory(CCBaseRepackFactory, ReleaseRepackFactory):
-    def __init__(self, mozRepoPath='', inspectorRepoPath='',
-                 venkmanRepoPath='', chatzillaRepoPath='', cvsroot='',
-                 **kwargs):
-        self.skipBlankRepos = True
-        self.mozRepoPath = mozRepoPath
-        self.inspectorRepoPath = inspectorRepoPath
-        self.venkmanRepoPath = venkmanRepoPath
-        self.chatzillaRepoPath = chatzillaRepoPath
-        self.cvsroot = cvsroot
-        ReleaseRepackFactory.__init__(self, mozillaDir='mozilla',
-            mozconfigBranch='default', **kwargs)
-
-    def updateSources(self):
-        ReleaseRepackFactory.updateSources(self)
-        self.addStep(ShellCommand,
-         command=['hg', 'up', '-C', '-r', self.buildRevision],
-         workdir='build/'+self.mozillaSrcDir,
-         description=['update mozilla',
-                      'to %s' % self.buildRevision],
-         haltOnFailure=True
-        )
-        if self.venkmanRepoPath:
-            self.addStep(ShellCommand,
-             command=['hg', 'up', '-C', '-r', self.buildRevision],
-             workdir='build/'+self.mozillaSrcDir+'/extensions/venkman',
-             description=['update venkman',
-                          'to %s' % self.buildRevision],
-             haltOnFailure=True
-            )
-        if self.inspectorRepoPath:
-            self.addStep(ShellCommand,
-             command=['hg', 'up', '-C', '-r', self.buildRevision],
-             workdir='build/'+self.mozillaSrcDir+'/extensions/inspector',
-             description=['update inspector',
-                          'to %s' % self.buildRevision],
-             haltOnFailure=True
-            )
-        if self.chatzillaRepoPath:
-            self.addStep(ShellCommand,
-             command=['hg', 'up', '-C', '-r', self.buildRevision],
-             workdir='build/'+self.mozillaSrcDir+'/extensions/irc',
-             description=['update chatzilla',
-                          'to %s' % self.buildRevision],
-             haltOnFailure=True
-            )
-
-    def downloadBuilds(self):
-        ReleaseRepackFactory.downloadBuilds(self)
-
-    # unsure why we need to explicitely do this but after bug 478436 we stopped
-    # executing the actual repackaging without this def here
-    def doRepack(self):
-        ReleaseRepackFactory.doRepack(self)
-
-
 class StagingRepositorySetupFactory(ReleaseFactory):
     """This Factory should be run at the start of a staging release run. It
        deletes and reclones all of the repositories in 'repositories'. Note that
        the staging buildTools repository should _not_ be recloned, as it is
        used by many other builders, too.
     """
     def __init__(self, username, sshKey, repositories, userRepoRoot,
                  **kwargs):