Skip to content

Commit b936729

Browse files
authored
Update copy-to-distro-specific-channel.py with workaround for packages that use timestamp in seconds instead of milliseconds
1 parent 9c1e76f commit b936729

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

copy-to-distro-specific-channel.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ def upload_package(package_name_simple, package_name, version, build, platform,
3939
except subprocess.CalledProcessError as e:
4040
print(f"Failed to upload {package_name}, version {version}, build {build}, platform {platform}: {e}")
4141

42+
# Get the timestamp in milliseconds from epoch, with an additional workaround
43+
# for packages that for some reason have a timestamp in seconds instead of milliseconds
44+
def get_timestamp_with_workaround_for_timestamp_in_seconds_instead_of_milliseconds(pkg_data):
45+
timestamp = pkg_data["timestamp"]
46+
# Workaround for https://github.com/RoboStack/ros-humble/issues/258 .
47+
# If it seems that the packages was built before 2001, probably the timestamp is actually
48+
# in seconds instead of milliseconds
49+
if timestamp < 1000000000000:
50+
timestamp *= 1000
51+
return timestamp
52+
4253
def main():
4354
# Parse command-line arguments
4455
parser = argparse.ArgumentParser(description="Upload packages from robostack-staging to robostack-<distroname>.")
@@ -91,7 +102,7 @@ def main():
91102
for pkg_name, pkg_data in source_packages.items()
92103
# This should cover both packages that start with 'ros-<distro>'
93104
# '(ros|ros2)-<distro>-mutex' packages whose build string contains <distro>
94-
if (pkg_name.startswith(prefix) or (pkg_data["name"].endswith("distro-mutex") and distro in pkg_data["build"])) and (pkg_data["timestamp"] >= cutoff_timestamp)
105+
if (pkg_name.startswith(prefix) or (pkg_data["name"].endswith("distro-mutex") and distro in pkg_data["build"])) and (get_timestamp_with_workaround_for_timestamp_in_seconds_instead_of_milliseconds(pkg_data) >= cutoff_timestamp)
95106
}
96107

97108
print(f"Found {len(filtered_packages)} packages in {SOURCE_CHANNEL}/{platform} that belong to distro {distro}")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy