Esempio n. 1
0
def _load_git_version():
    global _version
    global _revision
    global _git
    global _version_str
    repo = git.repo(_top())
    if repo.valid():
        head = repo.head()
        if repo.dirty():
            modified = 'modified'
            revision_sep = '-'
            sep = ' '
        else:
            modified = ''
            revision_sep = ''
            sep = ''
        _revision = '%s%s%s' % (head[0:12], revision_sep, modified)
        _version_str = '%s (%s%s%s)' % (_version, head[0:12], sep, modified)
        _git = True
    return _git
Esempio n. 2
0
 def local_git(self):
     repo = git.repo(self.defaults.expand('%{_rtdir}'), self)
     if repo.valid():
         repo_valid = '1'
         repo_head = repo.head()
         repo_clean = not repo.dirty()
         repo_id = repo_head
         if not repo_clean:
             repo_id += '-modified'
         repo_mail = repo.email()
     else:
         repo_valid = '0'
         repo_head = '%{nil}'
         repo_clean = '%{nil}'
         repo_id = 'no-repo'
         repo_mail = None
     self.defaults['_local_git_valid'] = repo_valid
     self.defaults['_local_git_head']  = repo_head
     self.defaults['_local_git_clean'] = str(repo_clean)
     self.defaults['_local_git_id']    = repo_id
     if repo_mail is not None:
         self.defaults['_localgit_mail'] = repo_mail
Esempio n. 3
0
rsb_updated = False
rtems_updated = False

# this only works if it was created by rtems-cron-prepdir.py
if os.path.isdir(options.top + '/rtems') and \
   os.path.isdir(options.top + '/rtems-source-builder'):

  # if the directories were gotten from git, they may be updated
  if options.git:
    # ensure that git was used to get these directories
    if '.git' in os.listdir(options.top + '/rtems') and \
                 os.listdir(options.top + '/rtems-source-builder'):

      os.chdir('./rtems-source-builder')
      
      rsb_repo = git.repo(os.getcwd())
      
      # determine what branch we're on and determine if we need to checkout a 
      # different one
      if (rsb_repo.branch() != options.version) and \
         (options.version != master_version):
        try:
          rsb_repo.checkout(options.version)
        except:
          print('An error occured when trying to checkout branch ' + \
          options.version + '...'
          )
          sys.exit(1)
      
      rsb_repo.fetch()