Пример #1
0
    def testCalculateChangedDeps(self):
        webrtc_deps = ParseLocalDepsFile(self._webrtc_depsfile)
        new_cr_deps = ParseLocalDepsFile(self._new_cr_depsfile)
        with mock.patch('roll_deps._RunCommand', self.fake):
            _SetupGitLsRemoteCall(
                self.fake,
                'https://chromium.googlesource.com/chromium/src/build',
                BUILD_NEW_REV)
            changed_deps = CalculateChangedDeps(webrtc_deps, new_cr_deps)

        self.assertEquals(len(changed_deps), 3)
        self.assertEquals(changed_deps[0].path, 'src/build')
        self.assertEquals(changed_deps[0].current_rev, BUILD_OLD_REV)
        self.assertEquals(changed_deps[0].new_rev, BUILD_NEW_REV)

        self.assertEquals(changed_deps[1].path, 'src/buildtools/linux64')
        self.assertEquals(changed_deps[1].package, 'gn/gn/linux-amd64')
        self.assertEquals(
            changed_deps[1].current_version,
            'git_revision:69ec4fca1fa69ddadae13f9e6b7507efa0675263')
        self.assertEquals(changed_deps[1].new_version,
                          'git_revision:new-revision')

        self.assertEquals(changed_deps[2].path, 'src/third_party/depot_tools')
        self.assertEquals(changed_deps[2].current_rev, DEPOTTOOLS_OLD_REV)
        self.assertEquals(changed_deps[2].new_rev, DEPOTTOOLS_NEW_REV)
Пример #2
0
 def testWithDistinctDeps(self):
     """Check CalculateChangedDeps still works when deps are added/removed. """
     webrtc_deps = ParseLocalDepsFile(self._webrtc_depsfile_android)
     new_cr_deps = ParseLocalDepsFile(self._new_cr_depsfile_android)
     changed_deps = CalculateChangedDeps(webrtc_deps, new_cr_deps)
     self.assertEquals(len(changed_deps), 1)
     self.assertEquals(
         changed_deps[0].path,
         'src/third_party/android_deps/libs/android_arch_core_common')
     self.assertEquals(
         changed_deps[0].package,
         'chromium/third_party/android_deps/libs/android_arch_core_common')
     self.assertEquals(changed_deps[0].current_version, 'version:0.9.0')
     self.assertEquals(changed_deps[0].new_version, 'version:1.0.0-cr0')
Пример #3
0
  def testCalculateChangedDeps(self):
    _SetupGitLsRemoteCall(self.fake,
        'https://chromium.googlesource.com/chromium/src/build', BUILD_NEW_REV)
    webrtc_deps = ParseLocalDepsFile(self._webrtc_depsfile)
    new_cr_deps = ParseLocalDepsFile(self._new_cr_depsfile)
    changed_deps = CalculateChangedDeps(webrtc_deps, new_cr_deps)
    self.assertEquals(len(changed_deps), 2)
    self.assertEquals(changed_deps[0].path, 'src/build')
    self.assertEquals(changed_deps[0].current_rev, BUILD_OLD_REV)
    self.assertEquals(changed_deps[0].new_rev, BUILD_NEW_REV)

    self.assertEquals(changed_deps[1].path, 'src/buildtools')
    self.assertEquals(changed_deps[1].current_rev, BUILDTOOLS_OLD_REV)
    self.assertEquals(changed_deps[1].new_rev, BUILDTOOLS_NEW_REV)
Пример #4
0
  def _CommitMessageSetup(self):
    webrtc_deps = ParseLocalDepsFile(self._webrtc_depsfile_android)
    new_cr_deps = ParseLocalDepsFile(self._new_cr_depsfile_android)

    changed_deps = CalculateChangedDeps(webrtc_deps, new_cr_deps)
    added_paths, _ = FindAddedDeps(webrtc_deps, new_cr_deps)
    removed_paths, _ = FindRemovedDeps(webrtc_deps, new_cr_deps)

    current_commit_pos = 'cafe'
    new_commit_pos = 'f00d'

    commit_msg = GenerateCommitMessage(NO_CHROMIUM_REVISION_UPDATE,
                                       current_commit_pos, new_commit_pos,
                                       changed_deps, added_paths, removed_paths)

    return [l.strip() for l in commit_msg.split('\n')]
Пример #5
0
  def _UpdateDepsSetup(self):
    with open(self._webrtc_depsfile_android) as deps_file:
      webrtc_contents = deps_file.read()
    with open(self._new_cr_depsfile_android) as deps_file:
      new_cr_contents = deps_file.read()
    webrtc_deps = ParseDepsDict(webrtc_contents)
    new_cr_deps = ParseDepsDict(new_cr_contents)

    changed_deps = CalculateChangedDeps(webrtc_deps, new_cr_deps)
    with mock.patch('roll_deps._RunCommand', NullCmd()):
      UpdateDepsFile(self._webrtc_depsfile_android, NO_CHROMIUM_REVISION_UPDATE,
                     changed_deps, new_cr_contents)

    with open(self._webrtc_depsfile_android) as deps_file:
      updated_contents = deps_file.read()

    return webrtc_contents, updated_contents
Пример #6
0
  def testCalculateChangedDeps(self):
    _SetupGitLsRemoteCall(self.fake,
        'https://chromium.googlesource.com/chromium/src/build', BUILD_NEW_REV)
    webrtc_deps = ParseLocalDepsFile(self._webrtc_depsfile)
    new_cr_deps = ParseLocalDepsFile(self._new_cr_depsfile)
    changed_deps = CalculateChangedDeps(webrtc_deps, new_cr_deps)
    self.assertEquals(len(changed_deps), 3)
    self.assertEquals(changed_deps[0].path, 'src/build')
    self.assertEquals(changed_deps[0].current_rev, BUILD_OLD_REV)
    self.assertEquals(changed_deps[0].new_rev, BUILD_NEW_REV)

    self.assertEquals(changed_deps[1].path, 'src/buildtools')
    self.assertEquals(changed_deps[1].current_rev, BUILDTOOLS_OLD_REV)
    self.assertEquals(changed_deps[1].new_rev, BUILDTOOLS_NEW_REV)

    self.assertEquals(changed_deps[2].path, 'src/third_party/xstream')
    self.assertEquals(changed_deps[2].package, 'chromium/third_party/xstream')
    self.assertEquals(changed_deps[2].current_version, '1.4.8-cr0')
    self.assertEquals(changed_deps[2].new_version, '1.10.0-cr0')
Пример #7
0
    def _CommitMessageSetup(self):
        webrtc_deps = ParseLocalDepsFile(self._webrtc_depsfile_android)
        new_cr_deps = ParseLocalDepsFile(self._new_cr_depsfile_android)

        changed_deps = CalculateChangedDeps(webrtc_deps, new_cr_deps)
        added_paths, _ = FindAddedDeps(webrtc_deps, new_cr_deps)
        removed_paths, _ = FindRemovedDeps(webrtc_deps, new_cr_deps)

        current_commit_pos = 'cafe'
        new_commit_pos = 'f00d'

        with mock.patch('roll_deps._RunCommand', self.fake):
            # We don't really care, but it's needed to construct the message.
            self.fake.AddExpectation(['git', 'config', 'user.email'],
                                     _returns=('*****@*****.**', None),
                                     _ignores=['working_dir'])

            commit_msg = GenerateCommitMessage(NO_CHROMIUM_REVISION_UPDATE,
                                               current_commit_pos,
                                               new_commit_pos, changed_deps,
                                               added_paths, removed_paths)

        return [l.strip() for l in commit_msg.split('\n')]