mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-14 15:02:51 +03:00
deploy: ensure mirrors and binary transparency always create 'master'
If there was a global default on a machine that was something other than 'master', these things would crash with: Traceback (most recent call last): File "/home/hans/code/fdroid/server/fdroid", line 22, in <module> fdroidserver.__main__.main() File "/home/hans/code/fdroid/server/fdroidserver/__main__.py", line 230, in main raise e File "/home/hans/code/fdroid/server/fdroidserver/__main__.py", line 211, in main mod.main() File "/home/hans/code/fdroid/server/fdroidserver/deploy.py", line 833, in main push_binary_transparency(BINARY_TRANSPARENCY_DIR, File "/home/hans/code/fdroid/server/fdroidserver/deploy.py", line 705, in push_binary_transparency local.pull('master') File "/usr/lib/python3/dist-packages/git/remote.py", line 1045, in pull res = self._get_fetch_info_from_stderr(proc, progress, kill_after_timeout=kill_after_timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/git/remote.py", line 848, in _get_fetch_info_from_stderr proc.wait(stderr=stderr_text) File "/usr/lib/python3/dist-packages/git/cmd.py", line 604, in wait raise GitCommandError(remove_password_if_present(self.args), status, errstr) git.exc.GitCommandError: Cmd('git') failed due to: exit code(1) cmdline: git pull -v -- local master stderr: 'fatal: couldn't find remote ref master'
This commit is contained in:
parent
0735bfa7e5
commit
f7830a41f1
4 changed files with 17 additions and 9 deletions
|
@ -39,6 +39,8 @@ config = None
|
|||
options = None
|
||||
start_timestamp = time.gmtime()
|
||||
|
||||
GIT_BRANCH = 'master'
|
||||
|
||||
BINARY_TRANSPARENCY_DIR = 'binary_transparency'
|
||||
|
||||
AUTO_S3CFG = '.fdroid-deploy-s3cfg'
|
||||
|
@ -407,7 +409,7 @@ def update_servergitmirrors(servergitmirrors, repo_section):
|
|||
elif 'identity_file' in config:
|
||||
ssh_cmd += ' -oIdentitiesOnly=yes -i "%s"' % config['identity_file']
|
||||
|
||||
repo = git.Repo.init(git_mirror_path)
|
||||
repo = git.Repo.init(git_mirror_path, initial_branch=GIT_BRANCH)
|
||||
|
||||
enabled_remotes = []
|
||||
for remote_url in servergitmirrors:
|
||||
|
@ -480,7 +482,9 @@ def update_servergitmirrors(servergitmirrors, repo_section):
|
|||
|
||||
logging.debug(_('Pushing to {url}').format(url=remote.url))
|
||||
with repo.git.custom_environment(GIT_SSH_COMMAND=ssh_cmd):
|
||||
pushinfos = remote.push('master', force=True, set_upstream=True, progress=progress)
|
||||
pushinfos = remote.push(
|
||||
GIT_BRANCH, force=True, set_upstream=True, progress=progress
|
||||
)
|
||||
for pushinfo in pushinfos:
|
||||
if pushinfo.flags & (git.remote.PushInfo.ERROR
|
||||
| git.remote.PushInfo.REJECTED
|
||||
|
@ -691,7 +695,7 @@ def push_binary_transparency(git_repo_path, git_remote):
|
|||
remote_path = os.path.abspath(git_repo_path)
|
||||
if not os.path.isdir(os.path.join(git_remote, '.git')):
|
||||
os.makedirs(git_remote, exist_ok=True)
|
||||
thumbdriverepo = git.Repo.init(git_remote)
|
||||
thumbdriverepo = git.Repo.init(git_remote, initial_branch=GIT_BRANCH)
|
||||
local = thumbdriverepo.create_remote('local', remote_path)
|
||||
else:
|
||||
thumbdriverepo = git.Repo(git_remote)
|
||||
|
@ -702,7 +706,7 @@ def push_binary_transparency(git_repo_path, git_remote):
|
|||
local.set_url(remote_path)
|
||||
else:
|
||||
local = thumbdriverepo.create_remote('local', remote_path)
|
||||
local.pull('master')
|
||||
local.pull(GIT_BRANCH)
|
||||
else:
|
||||
# from online machine to remote on a server on the internet
|
||||
gitrepo = git.Repo(git_repo_path)
|
||||
|
@ -713,7 +717,7 @@ def push_binary_transparency(git_repo_path, git_remote):
|
|||
origin.set_url(git_remote)
|
||||
else:
|
||||
origin = gitrepo.create_remote('origin', git_remote)
|
||||
origin.push('master')
|
||||
origin.push(GIT_BRANCH)
|
||||
|
||||
|
||||
def main():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue