spl-core 7.14.0rc3.dev1__py3-none-any.whl → 7.14.0rc4.dev3__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.
- spl_core/__init__.py +1 -1
- spl_core/test_utils/artifacts_archiver.py +157 -13
- {spl_core-7.14.0rc3.dev1.dist-info → spl_core-7.14.0rc4.dev3.dist-info}/METADATA +12 -11
- {spl_core-7.14.0rc3.dev1.dist-info → spl_core-7.14.0rc4.dev3.dist-info}/RECORD +7 -7
- {spl_core-7.14.0rc3.dev1.dist-info → spl_core-7.14.0rc4.dev3.dist-info}/WHEEL +0 -0
- {spl_core-7.14.0rc3.dev1.dist-info → spl_core-7.14.0rc4.dev3.dist-info}/entry_points.txt +0 -0
- {spl_core-7.14.0rc3.dev1.dist-info → spl_core-7.14.0rc4.dev3.dist-info}/licenses/LICENSE +0 -0
spl_core/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "7.14.0-
|
|
1
|
+
__version__ = "7.14.0-rc4.dev.3"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import os
|
|
3
3
|
from dataclasses import dataclass
|
|
4
|
+
from datetime import datetime, timezone
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
from typing import Dict, List, Optional
|
|
6
7
|
|
|
@@ -122,6 +123,7 @@ class ArtifactsArchiver:
|
|
|
122
123
|
def __init__(self) -> None:
|
|
123
124
|
self.archives: Dict[str, ArtifactsArchive] = {}
|
|
124
125
|
self._target_repos: Dict[str, str] = {}
|
|
126
|
+
# self._artifacts_metadata: Dict[str, Dict[str, Dict[str, str]]] = {} # variant -> category -> artifacts
|
|
125
127
|
|
|
126
128
|
def add_archive(self, out_dir: Path, archive_filename: str, target_repo: Optional[str] = None, archive_name: str = "default") -> ArtifactsArchive:
|
|
127
129
|
"""
|
|
@@ -177,6 +179,34 @@ class ArtifactsArchiver:
|
|
|
177
179
|
|
|
178
180
|
return self.archives[archive_name]
|
|
179
181
|
|
|
182
|
+
def get_archive_url(self, archive_name: str = "default") -> Optional[str]:
|
|
183
|
+
"""
|
|
184
|
+
Get the Artifactory URL for a specific archive.
|
|
185
|
+
|
|
186
|
+
Args:
|
|
187
|
+
archive_name: Name of the archive (defaults to "default")
|
|
188
|
+
|
|
189
|
+
Returns:
|
|
190
|
+
The full Artifactory URL for the archive, or None if no target repo configured
|
|
191
|
+
|
|
192
|
+
Example:
|
|
193
|
+
"https://artifactory.marquardt.de/artifactory/spled-generic-snapshot-rietheim/develop/123/Disco.7z"
|
|
194
|
+
"""
|
|
195
|
+
if archive_name not in self.archives:
|
|
196
|
+
return None
|
|
197
|
+
|
|
198
|
+
if archive_name not in self._target_repos:
|
|
199
|
+
return None
|
|
200
|
+
|
|
201
|
+
archive = self.archives[archive_name]
|
|
202
|
+
target_repo = self._target_repos[archive_name]
|
|
203
|
+
branch_name, build_number, _ = self._get_build_metadata()
|
|
204
|
+
|
|
205
|
+
# Construct the URL following the same pattern as create_rt_upload_json
|
|
206
|
+
archive_url = f"https://artifactory.marquardt.de/artifactory/{target_repo}/{branch_name}/{build_number}/{archive.archive_name}"
|
|
207
|
+
|
|
208
|
+
return archive_url
|
|
209
|
+
|
|
180
210
|
def create_all_archives(self) -> Dict[str, Path]:
|
|
181
211
|
"""
|
|
182
212
|
Create all registered archives.
|
|
@@ -214,28 +244,24 @@ class ArtifactsArchiver:
|
|
|
214
244
|
else:
|
|
215
245
|
return 28 # 4 weeks for PRs, feature branches, and other branches
|
|
216
246
|
|
|
217
|
-
|
|
247
|
+
@staticmethod
|
|
248
|
+
def _get_build_metadata() -> tuple[str, str, bool]:
|
|
218
249
|
"""
|
|
219
|
-
|
|
250
|
+
Get build metadata from environment variables or defaults.
|
|
220
251
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
when available, otherwise falls back to default values.
|
|
224
|
-
|
|
225
|
-
Args:
|
|
226
|
-
output_dir: Directory where the rt-upload.json file will be created
|
|
252
|
+
Detects Jenkins environment variables when available, otherwise falls back
|
|
253
|
+
to local development defaults.
|
|
227
254
|
|
|
228
255
|
Returns:
|
|
229
|
-
|
|
256
|
+
Tuple of (branch_name, build_number, is_tag):
|
|
257
|
+
- branch_name: The branch or PR identifier
|
|
258
|
+
- build_number: The build number or "local_build"
|
|
259
|
+
- is_tag: Whether this is a tag build
|
|
230
260
|
"""
|
|
231
|
-
# Set local defaults first
|
|
232
|
-
change_id = None
|
|
233
261
|
branch_name = "local_branch"
|
|
234
262
|
build_number = "local_build"
|
|
235
263
|
is_tag = False
|
|
236
264
|
|
|
237
|
-
# Adapt values when Jenkins environment is detected
|
|
238
|
-
# TODO: check if an existing library can be used for CI context detection
|
|
239
265
|
if os.environ.get("JENKINS_URL"):
|
|
240
266
|
change_id = os.environ.get("CHANGE_ID")
|
|
241
267
|
jenkins_branch_name = os.environ.get("BRANCH_NAME")
|
|
@@ -256,6 +282,25 @@ class ArtifactsArchiver:
|
|
|
256
282
|
if jenkins_build_number:
|
|
257
283
|
build_number = jenkins_build_number
|
|
258
284
|
|
|
285
|
+
return branch_name, build_number, is_tag
|
|
286
|
+
|
|
287
|
+
def create_rt_upload_json(self, out_dir: Path) -> Path:
|
|
288
|
+
"""
|
|
289
|
+
Create a single rt-upload.json file containing all archives.
|
|
290
|
+
|
|
291
|
+
This function replicates the logic from the Jenkinsfile for determining the RT_TARGET
|
|
292
|
+
and creating the upload specification file. It uses Jenkins environment variables
|
|
293
|
+
when available, otherwise falls back to default values.
|
|
294
|
+
|
|
295
|
+
Args:
|
|
296
|
+
output_dir: Directory where the rt-upload.json file will be created
|
|
297
|
+
|
|
298
|
+
Returns:
|
|
299
|
+
Path to the created rt-upload.json file
|
|
300
|
+
"""
|
|
301
|
+
# Get build metadata from environment or defaults
|
|
302
|
+
branch_name, build_number, is_tag = self._get_build_metadata()
|
|
303
|
+
|
|
259
304
|
# Calculate retention period based on branch/tag
|
|
260
305
|
retention_period = self.calculate_retention_period(branch_name, is_tag)
|
|
261
306
|
|
|
@@ -291,6 +336,94 @@ class ArtifactsArchiver:
|
|
|
291
336
|
|
|
292
337
|
return json_path
|
|
293
338
|
|
|
339
|
+
def create_artifacts_json(self, variant: str, out_dir: Path) -> Path:
|
|
340
|
+
"""
|
|
341
|
+
Create an initial artifacts.json file with build metadata structure.
|
|
342
|
+
|
|
343
|
+
This function creates a fresh artifacts.json file with build metadata
|
|
344
|
+
but no artifacts. Use update_artifacts_json() to add artifact categories.
|
|
345
|
+
It uses Jenkins environment variables when available, otherwise falls back to default values.
|
|
346
|
+
|
|
347
|
+
Args:
|
|
348
|
+
variant: The variant name (e.g., "Disco")
|
|
349
|
+
out_dir: Directory where the artifacts.json file will be created
|
|
350
|
+
|
|
351
|
+
Returns:
|
|
352
|
+
Path to the created artifacts.json file
|
|
353
|
+
|
|
354
|
+
Raises:
|
|
355
|
+
ValueError: If variant is empty or None
|
|
356
|
+
"""
|
|
357
|
+
# Input validation
|
|
358
|
+
if not variant or not variant.strip():
|
|
359
|
+
raise ValueError("Variant name cannot be empty or None")
|
|
360
|
+
|
|
361
|
+
# Get build metadata from environment or defaults
|
|
362
|
+
branch_name, build_number, _ = self._get_build_metadata()
|
|
363
|
+
|
|
364
|
+
# Create the initial artifacts.json structure
|
|
365
|
+
artifacts_data = {"variant": variant, "build_timestamp": datetime.now(timezone.utc).isoformat(timespec="seconds") + "Z", "build_number": build_number, "branch_name": branch_name, "artifacts": {}}
|
|
366
|
+
|
|
367
|
+
# Create the artifacts.json file
|
|
368
|
+
json_path = out_dir / "artifacts.json"
|
|
369
|
+
json_path.parent.mkdir(parents=True, exist_ok=True)
|
|
370
|
+
|
|
371
|
+
with open(json_path, "w") as f:
|
|
372
|
+
json.dump(artifacts_data, f, indent=2)
|
|
373
|
+
|
|
374
|
+
return json_path
|
|
375
|
+
|
|
376
|
+
def update_artifacts_json(self, category: str, artifacts: Dict[str, str], artifacts_json_path: Path) -> Path:
|
|
377
|
+
"""
|
|
378
|
+
Add or update artifacts in a specific category for the artifacts.json file.
|
|
379
|
+
|
|
380
|
+
Args:
|
|
381
|
+
category: The artifact category (e.g., "test_reports", "sca_reports", "build_binaries")
|
|
382
|
+
artifacts: Dictionary mapping artifact names to their URLs/paths
|
|
383
|
+
artifacts_json_path: Path to the artifacts.json file to be updated
|
|
384
|
+
|
|
385
|
+
Returns:
|
|
386
|
+
Path to the updated artifacts.json file
|
|
387
|
+
|
|
388
|
+
Raises:
|
|
389
|
+
ValueError: If category is empty, artifacts dictionary is empty, or JSON structure is invalid
|
|
390
|
+
FileNotFoundError: If artifacts.json file does not exist
|
|
391
|
+
"""
|
|
392
|
+
# Input validation
|
|
393
|
+
if not category or not category.strip():
|
|
394
|
+
raise ValueError("Category name cannot be empty or None")
|
|
395
|
+
if not artifacts:
|
|
396
|
+
raise ValueError("Artifacts dictionary cannot be empty")
|
|
397
|
+
|
|
398
|
+
# Check if artifacts.json file exists
|
|
399
|
+
if not artifacts_json_path.exists():
|
|
400
|
+
raise FileNotFoundError(f"artifacts.json file does not exist at {artifacts_json_path}. Please create it first using create_artifacts_json().")
|
|
401
|
+
|
|
402
|
+
# Read existing artifacts.json file
|
|
403
|
+
try:
|
|
404
|
+
with open(artifacts_json_path) as f:
|
|
405
|
+
artifacts_data = json.load(f)
|
|
406
|
+
except json.JSONDecodeError as e:
|
|
407
|
+
raise ValueError(f"Could not parse artifacts.json: {e}") from e
|
|
408
|
+
except OSError as e:
|
|
409
|
+
raise ValueError(f"Could not read artifacts.json: {e}") from e
|
|
410
|
+
|
|
411
|
+
# Validate that the file has the expected structure
|
|
412
|
+
if not artifacts_data or "artifacts" not in artifacts_data:
|
|
413
|
+
raise ValueError("artifacts.json file has invalid structure. Expected 'artifacts' section not found.")
|
|
414
|
+
|
|
415
|
+
# Update the specific category with new artifacts
|
|
416
|
+
if category in artifacts_data["artifacts"]:
|
|
417
|
+
artifacts_data["artifacts"][category].update(artifacts)
|
|
418
|
+
else:
|
|
419
|
+
artifacts_data["artifacts"][category] = artifacts.copy()
|
|
420
|
+
|
|
421
|
+
# Write the updated data back to the file
|
|
422
|
+
with open(artifacts_json_path, "w") as f:
|
|
423
|
+
json.dump(artifacts_data, f, indent=2)
|
|
424
|
+
|
|
425
|
+
return artifacts_json_path
|
|
426
|
+
|
|
294
427
|
def list_archives(self) -> List[str]:
|
|
295
428
|
"""
|
|
296
429
|
Get a list of all archive names.
|
|
@@ -347,3 +480,14 @@ class ArtifactsArchiver:
|
|
|
347
480
|
#
|
|
348
481
|
# created_files = archiver.create_all_archives()
|
|
349
482
|
# upload_json = archiver.create_rt_upload_json(Path("./build/output")) # only includes archives with target repos
|
|
483
|
+
#
|
|
484
|
+
# ## Artifacts.json use case (variant-specific metadata):
|
|
485
|
+
# archiver = ArtifactsArchiver()
|
|
486
|
+
# variant = "Disco"
|
|
487
|
+
# out_dir = Path("./build/output")
|
|
488
|
+
#
|
|
489
|
+
# # Create initial artifacts.json file first, then add categories
|
|
490
|
+
# artifacts_json_path = archiver.create_artifacts_json(variant, out_dir)
|
|
491
|
+
# archiver.update_artifacts_json("test_reports", test_reports, artifacts_json_path)
|
|
492
|
+
# archiver.update_artifacts_json("sca_reports", sca_reports, artifacts_json_path)
|
|
493
|
+
# archiver.update_artifacts_json("build_binaries", build_binaries, artifacts_json_path)
|
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spl-core
|
|
3
|
-
Version: 7.14.
|
|
3
|
+
Version: 7.14.0rc4.dev3
|
|
4
4
|
Summary: Software Product Line Support for CMake
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
Author: Avengineers
|
|
8
8
|
Author-email: karsten.guenther@kamg.de
|
|
9
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.10,<3.12
|
|
10
10
|
Classifier: Development Status :: 2 - Pre-Alpha
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
13
13
|
Classifier: Natural Language :: English
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
18
|
Classifier: Topic :: Software Development :: Libraries
|
|
18
|
-
Requires-Dist: cookiecutter (
|
|
19
|
+
Requires-Dist: cookiecutter (==2.6.0)
|
|
19
20
|
Requires-Dist: doxysphinx (>=3.3,<4.0)
|
|
20
21
|
Requires-Dist: gcovr (>=8.3,<9.0)
|
|
21
22
|
Requires-Dist: hammocking (>=0.8,<0.10)
|
|
22
23
|
Requires-Dist: kconfiglib (>=14.1,<15.0)
|
|
23
|
-
Requires-Dist: mlx-traceability (>=10,<
|
|
24
|
+
Requires-Dist: mlx-traceability (>=10,<12)
|
|
24
25
|
Requires-Dist: myst-parser (>=0.16)
|
|
25
26
|
Requires-Dist: py-app-dev (>=2.1,<3.0)
|
|
26
27
|
Requires-Dist: py7zr (>=1.0.0,<2.0.0)
|
|
27
28
|
Requires-Dist: pypeline-runner (>=1,<=2)
|
|
28
29
|
Requires-Dist: pypeline-semantic-release (>=0.4.1,<=0.5.0)
|
|
29
|
-
Requires-Dist: sphinx (>=
|
|
30
|
+
Requires-Dist: sphinx (>=7.3,<8.0)
|
|
30
31
|
Requires-Dist: sphinx-book-theme (>=1.1,<2.0)
|
|
31
32
|
Requires-Dist: sphinx-copybutton (>=0.5,<0.6)
|
|
32
|
-
Requires-Dist: sphinx-design (>=0.5,<0.
|
|
33
|
-
Requires-Dist: sphinx-needs (>=2,<
|
|
34
|
-
Requires-Dist: sphinx-new-tab-link (>=0.4,<0.
|
|
33
|
+
Requires-Dist: sphinx-design (>=0.5,<0.7)
|
|
34
|
+
Requires-Dist: sphinx-needs (>=2.0,<3.0)
|
|
35
|
+
Requires-Dist: sphinx-new-tab-link (>=0.4,<0.9)
|
|
35
36
|
Requires-Dist: sphinx-rtd-size (>=0.2,<0.3)
|
|
36
|
-
Requires-Dist: sphinx-rtd-theme (>=2,<
|
|
37
|
+
Requires-Dist: sphinx-rtd-theme (>=2.0,<3.0)
|
|
37
38
|
Requires-Dist: sphinx-test-reports (>=1.0,<2.0)
|
|
38
39
|
Requires-Dist: sphinxcontrib-datatemplates (>=0.11,<0.12)
|
|
39
|
-
Requires-Dist: sphinxcontrib-mermaid (>=
|
|
40
|
-
Requires-Dist: sphinxcontrib-plantuml (>=0.29,<0.
|
|
40
|
+
Requires-Dist: sphinxcontrib-mermaid (>=0.9,<0.10)
|
|
41
|
+
Requires-Dist: sphinxcontrib-plantuml (>=0.29,<0.31)
|
|
41
42
|
Requires-Dist: typer (>=0,<1)
|
|
42
43
|
Project-URL: Bug Tracker, https://github.com/avengineers/spl-core/issues
|
|
43
44
|
Project-URL: Changelog, https://github.com/avengineers/spl-core/blob/develop/CHANGELOG.md
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
spl_core/__init__.py,sha256=
|
|
1
|
+
spl_core/__init__.py,sha256=fVSFOVv7SK8LoblrhY5bTnftzxOChVyx4iJlNZk-Vnc,33
|
|
2
2
|
spl_core/__run.py,sha256=DphnN7_Bjiw_mOOztsHxTDHS8snz1g2MMWAaJpZxPKM,361
|
|
3
3
|
spl_core/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
spl_core/common/path.py,sha256=sDujd3n4XP1XGjHc7ImXEdjihO6A8BOIDbKCf7HgQ0Y,462
|
|
@@ -61,11 +61,11 @@ spl_core/main.py,sha256=_hL4j155WZMXog_755bgAH1PeUwvTdJZvVdVw9EWhvo,1225
|
|
|
61
61
|
spl_core/spl.cmake,sha256=YQMhpSJ9yZaJ34m_W1UqrlTh_r7AKMDuH6-hzK4w98A,4585
|
|
62
62
|
spl_core/steps/collect_pr_changes.py,sha256=su3yCtSJM9XDlMNOD0L72ooQdKzruc0lUat858Na0Kg,5539
|
|
63
63
|
spl_core/test_utils/archive_artifacts_collection.py,sha256=x7LH5dGIvssyhXsTFzB6rjgb5D2efKvHVpnjId3MNDk,5126
|
|
64
|
-
spl_core/test_utils/artifacts_archiver.py,sha256=
|
|
64
|
+
spl_core/test_utils/artifacts_archiver.py,sha256=5nwlkYAPfCAiBmN36PthVZ57JP9DkeuUbM02hWzba2w,19448
|
|
65
65
|
spl_core/test_utils/base_variant_test_runner.py,sha256=Oq27lkJlpB_y-p2_8S23F5zjn1438HW148q-hQNz3EY,3795
|
|
66
66
|
spl_core/test_utils/spl_build.py,sha256=bSM6hwhTH9aRryvUvtSPDfk_zoZuKEO5g3QXK4SIrco,8442
|
|
67
|
-
spl_core-7.14.
|
|
68
|
-
spl_core-7.14.
|
|
69
|
-
spl_core-7.14.
|
|
70
|
-
spl_core-7.14.
|
|
71
|
-
spl_core-7.14.
|
|
67
|
+
spl_core-7.14.0rc4.dev3.dist-info/METADATA,sha256=uQ42jHdB3qtU57nIUVIchGYbzRDN1qhsEhtPZ2Ow_Yo,5322
|
|
68
|
+
spl_core-7.14.0rc4.dev3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
69
|
+
spl_core-7.14.0rc4.dev3.dist-info/entry_points.txt,sha256=18_sdVY93N1GVBiAHxQ_F9ZM-bBvOmVMOMn7PNe2EqU,45
|
|
70
|
+
spl_core-7.14.0rc4.dev3.dist-info/licenses/LICENSE,sha256=UjjA0o8f5tT3wVm7qodTLAhPWLl6kgVyn9FPAd1VeYY,1099
|
|
71
|
+
spl_core-7.14.0rc4.dev3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|