Skip to content

Commit

Permalink
Merge pull request #115 from sot/skare3-promote
Browse files Browse the repository at this point in the history
Update skare3-promote to handle osx-arm64 packages
  • Loading branch information
javierggt authored Aug 22, 2024
2 parents 9adfdbc + da6796d commit 582547d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 15 deletions.
46 changes: 38 additions & 8 deletions skare3_tools/scripts/skare3_promote.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@
TO_CHANNEL = "flight"
FROM_CHANNELS = ["test", "masters"]
PLATFORM_OPTIONS = {
"linux-64": {"linux": True, "linux64": True},
"osx-64": {"osx": True, "osx64": True},
"win-64": {"win": True, "win64": True},
"linux-64": {"linux": True, "linux64": True, "arm64": False},
"osx-64": {"osx": True, "osx64": True, "arm64": False},
"osx-arm64": {"osx": True, "osx64": True, "arm64": True},
"win-64": {"win": True, "win64": True, "arm64": False},
}
SECTIONS = ["run"]

Expand Down Expand Up @@ -122,7 +123,6 @@ def promote(package, args, platforms=None):
f" not found for platform {platform}."
)
continue

if pkgs is not None:
package_names += [package["name"]]
pkg_files += pkgs
Expand All @@ -137,7 +137,7 @@ def promote(package, args, platforms=None):
r"(?P<name>\S+)(\s+)?(==(\s+)?(?P<version>\S+))?", requirement_str
)
if match:
requirement = m.groupdict()
requirement = match.groupdict()

pkgs = _files_to_copy(
requirement,
Expand All @@ -146,6 +146,7 @@ def promote(package, args, platforms=None):
args.to_channel,
args.from_channels,
)

if pkgs is not None:
if requirement["name"] not in package_names:
package_names.append(requirement["name"])
Expand Down Expand Up @@ -178,22 +179,49 @@ def promote(package, args, platforms=None):
"| {noarch:24s} {noarch-src:7s} "
"| {linux-64:24s} {linux-64-src:7s} "
"| {osx-64:24s} {osx-64-src:7s} "
"| {osx-arm64:24s} {osx-arm64-src:7s} "
"| {win-64:24s} {win-64-src:7s} |"
)
div = {"package": "", "noarch": "", "linux-64": "", "osx-64": "", "win-64": ""}
div = {
"package": "",
"noarch": "",
"linux-64": "",
"osx-64": "",
"osx-arm64": "",
"win-64": "",
}
div.update(
{k: "" for k in ["noarch-src", "linux-64-src", "osx-64-src", "win-64-src"]}
{
k: ""
for k in [
"noarch-src",
"linux-64-src",
"osx-64-src",
"osx-arm64-src",
"win-64-src",
]
}
)
div = row.format(**div).replace(" ", "-").replace("|", "+")
header = {
"package": "package name",
"noarch": "noarch",
"linux-64": "linux-64",
"osx-64": "osx-64",
"osx-arm64": "osx-arm64",
"win-64": "win-64",
}
header.update(
{k: "" for k in ["noarch-src", "linux-64-src", "osx-64-src", "win-64-src"]}
{
k: ""
for k in [
"noarch-src",
"linux-64-src",
"osx-64-src",
"osx-arm64-src",
"win-64-src",
]
}
)
header = row.format(**header)
logging.info(div)
Expand All @@ -206,10 +234,12 @@ def promote(package, args, platforms=None):
"noarch",
"linux-64",
"osx-64",
"osx-arm64",
"win-64",
"noarch-src",
"linux-64-src",
"osx-64-src",
"osx-arm64-src",
"win-64-src",
]
}
Expand Down
14 changes: 7 additions & 7 deletions skare3_tools/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ def remove(uid=None, directory=None, uids=(), directories=()):
directories += [SKARE3_TEST_DATA / directory]

# make sure all directories are absolute and within the data tree
for direct in directories:
if SKARE3_TEST_DATA not in direct.resolve().parents:
LOGGER.warning(f"warning: {direct} not in SKARE3_DASH_DATA. Ignoring")
for drctry in directories:
if SKARE3_TEST_DATA not in drctry.resolve().parents:
LOGGER.warning(f"warning: {drctry} not in SKARE3_DASH_DATA. Ignoring")
directories = [
direct for direct in directories if SKARE3_TEST_DATA in direct.resolve().parents
drctry for drctry in directories if SKARE3_TEST_DATA in drctry.resolve().parents
]

# make a list of everything that will be removed
Expand All @@ -89,10 +89,10 @@ def remove(uid=None, directory=None, uids=(), directories=()):
test_result_index.remove(tr)
shutil.rmtree(SKARE3_TEST_DATA / tr["destination"])

for direct in directories:
if direct.exists():
for drctry in directories:
if drctry.exists():
LOGGER.warning(
f"The directory {direct} is still there."
f"The directory {drctry} is still there."
"This does not happen unless the directory is already not in the index,"
"in which case it is safe to remove it by hand."
)
Expand Down

0 comments on commit 582547d

Please sign in to comment.