ScriptCollection 4.3.10__py3-none-any.whl → 4.3.12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,7 +37,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
37
37
  from .ProgramRunnerPopen import ProgramRunnerPopen
38
38
  from .SCLog import SCLog, LogLevel
39
39
 
40
- version = "4.3.10"
40
+ version = "4.3.12"
41
41
  __version__ = version
42
42
 
43
43
  class VSCodeWorkspaceShellTask:
@@ -584,8 +584,7 @@ class ScriptCollectionCore:
584
584
  argument.append("--force")
585
585
  if (pushalltags):
586
586
  argument.append("--tags")
587
- result: tuple[int, str, str, int] = self.run_program_argsasarray("git", argument, folder, throw_exception_if_exitcode_is_not_zero=True, print_errors_as_information=True)
588
- return result[1].replace('\r', '').replace('\n', '')
587
+ self.run_program_argsasarray("git", argument, folder, throw_exception_if_exitcode_is_not_zero=True, print_errors_as_information=True)
589
588
 
590
589
  @GeneralUtilities.check_arguments
591
590
  def git_pull_with_retry(self, folder: str, remote: str, localbranchname: str, remotebranchname: str, force: bool = False, amount_of_attempts: int = 5) -> None:
@@ -1,7 +1,9 @@
1
1
  import os
2
2
  import json
3
3
  import re
4
+ import shutil
4
5
  import socket
6
+ import uuid
5
7
  from datetime import datetime, timedelta,timezone
6
8
  import xmlschema
7
9
  import yaml
@@ -161,17 +163,52 @@ class TFCPS_CodeUnit_BuildCodeUnits:
161
163
  if GeneralUtilities.string_has_content(self.additionalargumentsfile):
162
164
  scbuildcodeunits_arguments += ["-a", self.__translate_path_into_container(self.additionalargumentsfile, container_repository_folder)]
163
165
 
166
+ #if the repository is a git-submodule then "<repository>/.git" is not a directory but a pointer-file referencing a gitdir which
167
+ #lies outside the mounted working-tree (for example "<product>Build/.git/modules/Submodules/<product>"). git inside the container
168
+ #can not resolve that gitdir, so "git rev-parse --verify HEAD" fails and the version-detection silently falls back to a wrong
169
+ #default-version. To fix this regardless of where the submodule is located in the base-repository, the resolved real gitdir is
170
+ #mounted into the container at a dedicated path and two files are replaced via file-over-file-mounts:
171
+ # - "<container-repository>/.git" by a generated pointer-file that references the in-container gitdir-path, and
172
+ # - the gitdir's "config" by a copy whose "core.worktree" points at the in-container working-tree.
173
+ #The config-override is required because the submodule-gitdir's original "core.worktree" references the original (now wrong)
174
+ #location: git itself could be told via GIT_WORK_TREE, but gitversion (libgit2) reads core.worktree from the config and ignores
175
+ #GIT_WORK_TREE - it would otherwise fail with "doesn't point at a valid Git repository or workdir". For a normal repository (own
176
+ #".git"-directory) nothing additional is required.
177
+ git_dir_docker_arguments: list[str] = []
178
+ staged_git_pointer_file: str = None
179
+ staged_git_config_file: str = None
180
+ if os.path.isfile(os.path.join(self.repository, ".git")):
181
+ real_git_folder = self.sc.get_real_git_folder(self.repository)
182
+ container_git_dir = "/Workspace/RepositoryGitDir"
183
+ staged_git_pointer_file = os.path.join(GeneralUtilities.get_temp_folder(), f"sc-container-gitpointer-{uuid.uuid4()}")
184
+ GeneralUtilities.write_text_to_file(staged_git_pointer_file, f"gitdir: {container_git_dir}\n")
185
+ staged_git_config_file = os.path.join(GeneralUtilities.get_temp_folder(), f"sc-container-gitconfig-{uuid.uuid4()}")
186
+ shutil.copyfile(os.path.join(real_git_folder, "config"), staged_git_config_file)
187
+ self.sc.run_program_argsasarray("git", ["config", "--file", staged_git_config_file, "core.worktree", container_repository_folder], GeneralUtilities.get_temp_folder())
188
+ git_dir_docker_arguments = [
189
+ "-v", f"{real_git_folder}:{container_git_dir}",
190
+ "-v", f"{staged_git_config_file}:{container_git_dir}/config",
191
+ "-v", f"{staged_git_pointer_file}:{container_repository_folder}/.git",
192
+ ]
193
+
164
194
  #run scbuildcodeunits inside the SCBuilder-image. the repository is mounted into the container and the docker-socket is forwarded because codeunit-builds often start containers (for example local test-services).
165
195
  docker_arguments = [
166
196
  "run", "--rm",
167
197
  "-v", f"{self.repository}:{container_repository_folder}",
168
198
  "-v", "/var/run/docker.sock:/var/run/docker.sock",
199
+ ] + git_dir_docker_arguments + [
169
200
  "-w", container_repository_folder,
170
201
  image,
171
202
  ] + scbuildcodeunits_arguments
172
203
  self.sc.log.log(f"Build codeunits in container using image \"{image}\"...")
173
- # the exitcode is evaluated by the caller (returned as part of the result-tuple), so the program-runner must not raise on a non-zero exitcode here.
174
- result=self.sc.run_program_argsasarray("docker", docker_arguments, throw_exception_if_exitcode_is_not_zero=False, print_live_output=True)
204
+ try:
205
+ # the exitcode is evaluated by the caller (returned as part of the result-tuple), so the program-runner must not raise on a non-zero exitcode here.
206
+ result=self.sc.run_program_argsasarray("docker", docker_arguments, throw_exception_if_exitcode_is_not_zero=False, print_live_output=True)
207
+ finally:
208
+ if staged_git_pointer_file is not None:
209
+ GeneralUtilities.ensure_file_does_not_exist(staged_git_pointer_file)
210
+ if staged_git_config_file is not None:
211
+ GeneralUtilities.ensure_file_does_not_exist(staged_git_config_file)
175
212
  exit_code:int=result[0]
176
213
  stdout:str=result[1] or GeneralUtilities.empty_string
177
214
  stderr:str=result[2] or GeneralUtilities.empty_string
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptcollection
3
- Version: 4.3.10
3
+ Version: 4.3.12
4
4
  Summary: The ScriptCollection is the place for reusable scripts.
5
5
  Author-email: Marius Göcke <marius.goecke@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/anionDev/ScriptCollection
@@ -9,7 +9,7 @@ ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrR
9
9
  ScriptCollection/ProgramRunnerPopen.py,sha256=zVD-gZY85o8wiGFcpYAGNDl-tXaKzipl1Bkhqy2ois4,4681
10
10
  ScriptCollection/ProgramRunnerSudo.py,sha256=RXsiceQ8W6a8YDk_2BPscVbIAmDIpIxqe9WHBy2r4CM,5233
11
11
  ScriptCollection/SCLog.py,sha256=Z-HhC_CRtU3HdQflNsabFh9IJOucHcXmxMDcf58fli0,4671
12
- ScriptCollection/ScriptCollectionCore.py,sha256=ycaLc7SU53jKAsVS46cFqrH_Sp-pH3QOyR7Va9DWoMI,230263
12
+ ScriptCollection/ScriptCollectionCore.py,sha256=2e23eilk84kOK0aub3VqSjJGFE7oFBS8cIslvtJW5GM,230165
13
13
  ScriptCollection/UnassignedVariablesCheck.py,sha256=v59qLQ5RRvx31ouuCW7NWZj3McWENvGBPkV5ZGBmqJE,4344
14
14
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  ScriptCollection/OCIImages/AbstractImageHandler.py,sha256=o129UYDtLymCRjMZBP9Puaj19ueMHoNt6UTLspfnaRc,1758
@@ -35,7 +35,7 @@ ScriptCollection/Resources/MaintenanceSite/MaintenanceSite.html,sha256=CX9S1bdOz
35
35
  ScriptCollection/TFCPS/SCTaskRunnerServer.py,sha256=rpuwSsQ6YQfZS2LGnvOH5ql8zs_-cHU4LQttS7XNT60,11272
36
36
  ScriptCollection/TFCPS/TFCPS_CodeUnitSpecific_Base.py,sha256=oICRtl85n2puWvchcJIkmLZL1BAylMbzH7ltBGWfqgY,31973
37
37
  ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnit.py,sha256=s4E20EkvFZpsg2c2Gu-D6kHXS0QIkpx_chawHNSnlnU,9891
38
- ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=n_ZBkh5XybkIrz4t2LhJKY7t7eJYrqpnuNBZt8uUiy0,25512
38
+ ScriptCollection/TFCPS/TFCPS_CodeUnit_BuildCodeUnits.py,sha256=4wOl_GSzlNwTo0OtMzLut4joglz3Sr0FkBrc5TlaAy0,28532
39
39
  ScriptCollection/TFCPS/TFCPS_CreateRelease.py,sha256=X2NgZgbOkJsdZ6wMHB_RuS_rQCuz5oQCqzYrxyXBN9Q,6680
40
40
  ScriptCollection/TFCPS/TFCPS_Generic.py,sha256=5vCFfDiU8bvfcnoKNs2ATS8nsl6mYXcIuX7XfYE0tvg,2116
41
41
  ScriptCollection/TFCPS/TFCPS_MergeToMain.py,sha256=BsSV4a-NZY86MZ20d-_rYxNVAI4UzAfmEwXlRZ8qWQc,7685
@@ -63,8 +63,8 @@ ScriptCollection/TFCPS/Python/TFCPS_CodeUnitSpecific_Python.py,sha256=Bd1gxCk9Fb
63
63
  ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
64
  ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=WhOsMpJxNGqnQGA3nJ99ruyqymxBeJxCcpK98zJduTo,1680
65
65
  ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
- scriptcollection-4.3.10.dist-info/METADATA,sha256=fkKN4GjqMtFxTZKuNi9lTY9BJ261wqJJ4n6TXUXXfn8,7816
67
- scriptcollection-4.3.10.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
68
- scriptcollection-4.3.10.dist-info/entry_points.txt,sha256=MwiP9P29EeSfjS19JOZmqbx8OzpZrUWpgMza3EffBs8,5812
69
- scriptcollection-4.3.10.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
70
- scriptcollection-4.3.10.dist-info/RECORD,,
66
+ scriptcollection-4.3.12.dist-info/METADATA,sha256=8MlKafLMkghWUJxyj8-Z5b1NSOdPcqJvFuPjA3zDu68,7816
67
+ scriptcollection-4.3.12.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
68
+ scriptcollection-4.3.12.dist-info/entry_points.txt,sha256=MwiP9P29EeSfjS19JOZmqbx8OzpZrUWpgMza3EffBs8,5812
69
+ scriptcollection-4.3.12.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
70
+ scriptcollection-4.3.12.dist-info/RECORD,,