mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Update PGP keys during _PostRepoUpgrade in sync
Previously, if a key was added, a client wouldn't add the key during the sync step. This would cause issues if a new key were added and a subsequent release were signed by that key. Change-Id: I4fac317573cd9d0e8da62aa42e00faf08bfeb26c
This commit is contained in:
parent
57365c98cc
commit
c9129d90de
18
main.py
18
main.py
@ -23,6 +23,7 @@ if __name__ == '__main__':
|
|||||||
del magic
|
del magic
|
||||||
|
|
||||||
import getpass
|
import getpass
|
||||||
|
import imp
|
||||||
import netrc
|
import netrc
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
@ -167,16 +168,15 @@ def _MyRepoPath():
|
|||||||
def _MyWrapperPath():
|
def _MyWrapperPath():
|
||||||
return os.path.join(os.path.dirname(__file__), 'repo')
|
return os.path.join(os.path.dirname(__file__), 'repo')
|
||||||
|
|
||||||
|
_wrapper_module = None
|
||||||
|
def WrapperModule():
|
||||||
|
global _wrapper_module
|
||||||
|
if not _wrapper_module:
|
||||||
|
_wrapper_module = imp.load_source('wrapper', _MyWrapperPath())
|
||||||
|
return _wrapper_module
|
||||||
|
|
||||||
def _CurrentWrapperVersion():
|
def _CurrentWrapperVersion():
|
||||||
VERSION = None
|
return WrapperModule().VERSION
|
||||||
pat = re.compile(r'^VERSION *=')
|
|
||||||
fd = open(_MyWrapperPath())
|
|
||||||
for line in fd:
|
|
||||||
if pat.match(line):
|
|
||||||
fd.close()
|
|
||||||
exec line
|
|
||||||
return VERSION
|
|
||||||
raise NameError, 'No VERSION in repo script'
|
|
||||||
|
|
||||||
def _CheckWrapperVersion(ver, repo_path):
|
def _CheckWrapperVersion(ver, repo_path):
|
||||||
if not repo_path:
|
if not repo_path:
|
||||||
|
14
repo
14
repo
@ -28,7 +28,7 @@ if __name__ == '__main__':
|
|||||||
del magic
|
del magic
|
||||||
|
|
||||||
# increment this whenever we make important changes to this script
|
# increment this whenever we make important changes to this script
|
||||||
VERSION = (1, 17)
|
VERSION = (1, 18)
|
||||||
|
|
||||||
# increment this if the MAINTAINER_KEYS block is modified
|
# increment this if the MAINTAINER_KEYS block is modified
|
||||||
KEYRING_VERSION = (1,0)
|
KEYRING_VERSION = (1,0)
|
||||||
@ -80,7 +80,7 @@ TACbBS+Up3RpfYVfd63c1cDdlru13pQAn3NQy/SN858MkxN+zym86UBgOad2
|
|||||||
GIT = 'git' # our git command
|
GIT = 'git' # our git command
|
||||||
MIN_GIT_VERSION = (1, 5, 4) # minimum supported git version
|
MIN_GIT_VERSION = (1, 5, 4) # minimum supported git version
|
||||||
repodir = '.repo' # name of repo's private directory
|
repodir = '.repo' # name of repo's private directory
|
||||||
S_repo = 'repo' # special repo reposiory
|
S_repo = 'repo' # special repo repository
|
||||||
S_manifests = 'manifests' # special manifest repository
|
S_manifests = 'manifests' # special manifest repository
|
||||||
REPO_MAIN = S_repo + '/main.py' # main script
|
REPO_MAIN = S_repo + '/main.py' # main script
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ group.add_option('-g', '--groups',
|
|||||||
metavar='GROUP')
|
metavar='GROUP')
|
||||||
group.add_option('-p', '--platform',
|
group.add_option('-p', '--platform',
|
||||||
dest='platform', default="auto",
|
dest='platform', default="auto",
|
||||||
help='restrict manifest projects to ones with a specified'
|
help='restrict manifest projects to ones with a specified '
|
||||||
'platform group [auto|all|none|linux|darwin|...]',
|
'platform group [auto|all|none|linux|darwin|...]',
|
||||||
metavar='PLATFORM')
|
metavar='PLATFORM')
|
||||||
|
|
||||||
@ -196,8 +196,8 @@ def _Init(args):
|
|||||||
|
|
||||||
_CheckGitVersion()
|
_CheckGitVersion()
|
||||||
try:
|
try:
|
||||||
if _NeedSetupGnuPG():
|
if NeedSetupGnuPG():
|
||||||
can_verify = _SetupGnuPG(opt.quiet)
|
can_verify = SetupGnuPG(opt.quiet)
|
||||||
else:
|
else:
|
||||||
can_verify = True
|
can_verify = True
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ def _CheckGitVersion():
|
|||||||
raise CloneFailure()
|
raise CloneFailure()
|
||||||
|
|
||||||
|
|
||||||
def _NeedSetupGnuPG():
|
def NeedSetupGnuPG():
|
||||||
if not os.path.isdir(home_dot_repo):
|
if not os.path.isdir(home_dot_repo):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ def _NeedSetupGnuPG():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def _SetupGnuPG(quiet):
|
def SetupGnuPG(quiet):
|
||||||
if not os.path.isdir(home_dot_repo):
|
if not os.path.isdir(home_dot_repo):
|
||||||
try:
|
try:
|
||||||
os.mkdir(home_dot_repo)
|
os.mkdir(home_dot_repo)
|
||||||
|
@ -46,6 +46,7 @@ except ImportError:
|
|||||||
|
|
||||||
from git_command import GIT
|
from git_command import GIT
|
||||||
from git_refs import R_HEADS, HEAD
|
from git_refs import R_HEADS, HEAD
|
||||||
|
from main import WrapperModule
|
||||||
from project import Project
|
from project import Project
|
||||||
from project import RemoteSpec
|
from project import RemoteSpec
|
||||||
from command import Command, MirrorSafeCommand
|
from command import Command, MirrorSafeCommand
|
||||||
@ -537,7 +538,7 @@ uncommitted changes are present' % project.relpath
|
|||||||
mp.PreSync()
|
mp.PreSync()
|
||||||
|
|
||||||
if opt.repo_upgraded:
|
if opt.repo_upgraded:
|
||||||
_PostRepoUpgrade(self.manifest)
|
_PostRepoUpgrade(self.manifest, opt)
|
||||||
|
|
||||||
if not opt.local_only:
|
if not opt.local_only:
|
||||||
mp.Sync_NetworkHalf(quiet=opt.quiet,
|
mp.Sync_NetworkHalf(quiet=opt.quiet,
|
||||||
@ -611,7 +612,10 @@ uncommitted changes are present' % project.relpath
|
|||||||
if self.manifest.notice:
|
if self.manifest.notice:
|
||||||
print self.manifest.notice
|
print self.manifest.notice
|
||||||
|
|
||||||
def _PostRepoUpgrade(manifest):
|
def _PostRepoUpgrade(manifest, opt):
|
||||||
|
wrapper = WrapperModule()
|
||||||
|
if wrapper.NeedSetupGnuPG():
|
||||||
|
wrapper.SetupGnuPG(opt.quiet)
|
||||||
for project in manifest.projects.values():
|
for project in manifest.projects.values():
|
||||||
if project.Exists:
|
if project.Exists:
|
||||||
project.PostRepoUpgrade()
|
project.PostRepoUpgrade()
|
||||||
|
Loading…
Reference in New Issue
Block a user