Пример #1
0
    def get_build_id(self):
        """
        Return a BuildID (named tuple with .component, .branch, .code_revno,
        and .test_revno) that can be used to uniquely identify this sandbox's
        state (in terms of what code and tests it contains) for build
        reproducibility.

        Build IDs are used to tag built artifacts and to coordinate test results
        across platforms. It consists of the name of the top-level component in
        the sandbox, its branch, plus the revno of the code and test aspects of
        that component. The format of build ids is documented on our build site
        (https:// ... /working-with-code) at #TODO Kim refer to correct doc site
        /overview-and-concepts/version-tags.

        Build ids are less useful when the top component aspect is built instead
        of code (as with test-only sandboxes), or when the sandbox is
        experimental and contains checkouts.
        """
        top = self.get_top_component()
        aspects = self.get_component_aspects(top)
        if component.CODE_ASPECT_NAME in aspects:
            crev = int(vcs.revno(self.get_component_path(top, component.CODE_ASPECT_NAME)))
        else:
            crev = 0
        if component.TEST_ASPECT_NAME in aspects:
            trev = int(vcs.revno(self.get_component_path(top, component.TEST_ASPECT_NAME)))
        else:
            trev = 0
        date = dateutils.format_standard_date_with_tz_offset(time.time()).split(".")[0].strip()
        guid = str(uuid.uuid1())
        return build_id.BuildID(top, self.get_branch(), crev, trev, guid, date)
Пример #2
0
 def __init__(self, path, txt, start, end):
     self.when = ''
     self.which = ''
     self.where = ''
     self.by = ''
     self.ticket = ''
     self.owner = ''
     self.why = ''
     self.path = path
     self.revision = vcs.revno(path, True)
     self.scope = ''
     i = start
     j = end - 2
     while txt[j] == '*':
         j-= 1
     self.lineNum = codescan.getLineNumForOffset(txt, i)
     lines = [re.sub(r'^\s*\*', '', l).strip() for l in txt[i:j].split('\n') if l.strip()]
     lbl = None
     for l in lines:
         m = _LBL_PAT.match(l)
         if m:
             if lbl:
                 DisabledUnitTest._assign(self, lbl, val)
             lbl = m.group(1)
             val = m.group(2)
         elif lbl:
             val += ' ' + l
     if lbl:
         DisabledUnitTest._assign(self, lbl, val)
     if self.ticket:
         m = TICKET_PAT.search(self.ticket)
         if m:
             self.ticket = m.group(1)
     if self.owner:
         self.owner = ', '.join([x.strip() for x in self.owner.replace(';',',').split(',')])
Пример #3
0
def revno(dir):
    sb = sandbox.create_from_within(dir)
    revno = int(
        vcs.revno(
            sb.get_component_path(sb.get_top_component(),
                                  component.CODE_ASPECT_NAME)))
    #print('revno: {0}'.format(revno))
    print(revno)
    return revno
Пример #4
0
 def getRevision(self):
     sb = sandbox.create_from_within(self.conf.path)
     branchLocation = os.path.join(sb.get_code_root(), sb.get_top_component())
     return vcs.revno(branchLocation, True)
     cwd = os.getcwd()
     os.chdir(branchLocation)
     p = subprocess.Popen(["bzr", "revno", "--tree"], stdout=subprocess.PIPE)
     revno = p.stdout.read().strip()
     os.chdir(cwd)
     return revno
Пример #5
0
 def getRevision(self):
     sb = sandbox.create_from_within(self.conf.path)
     branchLocation = os.path.join(sb.get_code_root(),
                                   sb.get_top_component())
     return vcs.revno(branchLocation, True)
     cwd = os.getcwd()
     os.chdir(branchLocation)
     p = subprocess.Popen(['bzr', 'revno', '--tree'],
                          stdout=subprocess.PIPE)
     revno = p.stdout.read().strip()
     os.chdir(cwd)
     return revno
Пример #6
0
    def get_build_id(self):
        '''
        Return a BuildID (named tuple with .component, .branch, .code_revno,
        and .test_revno) that can be used to uniquely identify this sandbox's
        state (in terms of what code and tests it contains) for build
        reproducibility.

        Build IDs are used to tag built artifacts and to coordinate test results
        across platforms. It consists of the name of the top-level component in
        the sandbox, its branch, plus the revno of the code and test aspects of
        that component. The format of build ids is documented on our build site
        (https:// ... /working-with-code) at #TODO Kim refer to correct doc site
        /overview-and-concepts/version-tags.

        Build ids are less useful when the top component aspect is built instead
        of code (as with test-only sandboxes), or when the sandbox is
        experimental and contains checkouts.
        '''
        top = self.get_top_component()
        aspects = self.get_component_aspects(top)
        if component.CODE_ASPECT_NAME in aspects:
            crev = int(
                vcs.revno(
                    self.get_component_path(top, component.CODE_ASPECT_NAME)))
        else:
            crev = 0
        if component.TEST_ASPECT_NAME in aspects:
            trev = int(
                vcs.revno(
                    self.get_component_path(top, component.TEST_ASPECT_NAME)))
        else:
            trev = 0
        date = dateutils.format_standard_date_with_tz_offset(
            time.time()).split('.')[0].strip()
        guid = str(uuid.uuid1())
        return build_id.BuildID(top, self.get_branch(), crev, trev, guid, date)
Пример #7
0
 def __init__(self, path, txt, start, end):
     self.when = ''
     self.which = ''
     self.where = ''
     self.by = ''
     self.ticket = ''
     self.owner = ''
     self.why = ''
     self.path = path
     self.revision = vcs.revno(path, True)
     self.scope = ''
     i = start
     j = end - 2
     while txt[j] == '*':
         j -= 1
     self.lineNum = codescan.getLineNumForOffset(txt, i)
     lines = [
         re.sub(r'^\s*\*', '', l).strip() for l in txt[i:j].split('\n')
         if l.strip()
     ]
     lbl = None
     for l in lines:
         m = _LBL_PAT.match(l)
         if m:
             if lbl:
                 DisabledUnitTest._assign(self, lbl, val)
             lbl = m.group(1)
             val = m.group(2)
         elif lbl:
             val += ' ' + l
     if lbl:
         DisabledUnitTest._assign(self, lbl, val)
     if self.ticket:
         m = TICKET_PAT.search(self.ticket)
         if m:
             self.ticket = m.group(1)
     if self.owner:
         self.owner = ', '.join(
             [x.strip() for x in self.owner.replace(';', ',').split(',')])
Пример #8
0
def revno(dir):
    sb = sandbox.create_from_within(dir)
    revno = int(vcs.revno(sb.get_component_path(sb.get_top_component(), component.CODE_ASPECT_NAME)))
    #print('revno: {0}'.format(revno))
    print(revno)
    return revno
Пример #9
0
def show_component_revno(componentname, sb, tree=False):
    aspects = get_vcs_component_aspects(componentname, sb)
    for a in aspects:
        path = sb.get_component_path(componentname, a)
        print(_get_relative_path(sb, componentname, a), '\t',
              vcs.revno(path, tree=tree))
Пример #10
0
def show_component_revno(componentname, sb, tree=False):
    aspects = get_vcs_component_aspects(componentname, sb)
    for a in aspects:
        path = sb.get_component_path(componentname, a)
        print(_get_relative_path(sb, componentname, a), '\t', vcs.revno(path, tree=tree))