mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-28 14:42:03 +00:00
aedi: remove most of git operations
ability to checkout a commit and implicit pull of remote changes were infinite source of errors only initial clone of source code repository remains
This commit is contained in:
parent
cac1d5cf8c
commit
539d67838f
2 changed files with 6 additions and 39 deletions
|
@ -37,8 +37,6 @@ class Builder(object):
|
||||||
|
|
||||||
state = self._state = BuildState()
|
state = self._state = BuildState()
|
||||||
state.xcode = arguments.xcode
|
state.xcode = arguments.xcode
|
||||||
state.checkout_commit = arguments.checkout_commit
|
|
||||||
state.skip_checkout = arguments.skip_checkout
|
|
||||||
state.verbose = arguments.verbose
|
state.verbose = arguments.verbose
|
||||||
|
|
||||||
self._platforms = []
|
self._platforms = []
|
||||||
|
@ -291,12 +289,6 @@ class Builder(object):
|
||||||
group.add_argument('--target', choices=self._targets.keys(), help='target to build')
|
group.add_argument('--target', choices=self._targets.keys(), help='target to build')
|
||||||
group.add_argument('--source', metavar='path', help='path to target\'s source code')
|
group.add_argument('--source', metavar='path', help='path to target\'s source code')
|
||||||
|
|
||||||
group = parser.add_mutually_exclusive_group()
|
|
||||||
group.add_argument('--checkout-commit', metavar='commit',
|
|
||||||
help='source code commit or tag to checkout')
|
|
||||||
group.add_argument('--skip-checkout', action='store_true',
|
|
||||||
help='avoid any operations with source code')
|
|
||||||
|
|
||||||
group = parser.add_argument_group()
|
group = parser.add_argument_group()
|
||||||
group.add_argument('--xcode', action='store_true', help='generate Xcode project instead of build')
|
group.add_argument('--xcode', action='store_true', help='generate Xcode project instead of build')
|
||||||
group.add_argument('--source-path', metavar='path',
|
group.add_argument('--source-path', metavar='path',
|
||||||
|
|
|
@ -44,9 +44,6 @@ class BuildState:
|
||||||
self.output_path = None
|
self.output_path = None
|
||||||
self.install_path = None
|
self.install_path = None
|
||||||
|
|
||||||
self.checkout_commit = None
|
|
||||||
self.skip_checkout = False
|
|
||||||
|
|
||||||
self.platform = None
|
self.platform = None
|
||||||
self.xcode = False
|
self.xcode = False
|
||||||
self.verbose = False
|
self.verbose = False
|
||||||
|
@ -70,37 +67,15 @@ class BuildState:
|
||||||
def cxx_compiler(self) -> str:
|
def cxx_compiler(self) -> str:
|
||||||
return self.platform.cxx_compiler if self.platform else ''
|
return self.platform.cxx_compiler if self.platform else ''
|
||||||
|
|
||||||
def checkout_git(self, url: str, branch: str = 'master'):
|
def checkout_git(self, url: str, branch: str = None):
|
||||||
if os.path.exists(self.source):
|
if os.path.exists(self.source):
|
||||||
if self.skip_checkout:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
args = ('git', 'fetch', '--all', '--tags')
|
|
||||||
subprocess.run(args, cwd=self.source, check=True)
|
|
||||||
else:
|
|
||||||
assert not self.skip_checkout
|
|
||||||
args = ('git', 'clone', '--recurse-submodules', url, self.source)
|
args = ('git', 'clone', '--recurse-submodules', url, self.source)
|
||||||
subprocess.run(args, cwd=self.root_path, check=True)
|
subprocess.run(args, cwd=self.root_path, check=True)
|
||||||
|
|
||||||
if self.checkout_commit:
|
if branch:
|
||||||
checkout_args = (self.checkout_commit,)
|
args = ('git', 'checkout', '-b', branch, 'origin/' + branch)
|
||||||
need_pull = False
|
|
||||||
else:
|
|
||||||
args = ('git', 'show-ref', '--quiet', 'refs/heads/' + branch)
|
|
||||||
branch_exists = 0 == subprocess.run(args, cwd=self.source).returncode
|
|
||||||
|
|
||||||
if branch_exists:
|
|
||||||
checkout_args = (branch,)
|
|
||||||
else:
|
|
||||||
checkout_args = ('-b', branch, 'origin/' + branch)
|
|
||||||
|
|
||||||
need_pull = True
|
|
||||||
|
|
||||||
args = ('git', 'checkout') + checkout_args
|
|
||||||
subprocess.run(args, cwd=self.source, check=True)
|
|
||||||
|
|
||||||
if need_pull:
|
|
||||||
args = ('git', 'pull')
|
|
||||||
subprocess.run(args, cwd=self.source, check=True)
|
subprocess.run(args, cwd=self.source, check=True)
|
||||||
|
|
||||||
def download_source(self, url: str, checksum: str):
|
def download_source(self, url: str, checksum: str):
|
||||||
|
|
Loading…
Reference in a new issue