Skip to content

Update copy-to-distro-specific-channel.py with workaround for packages that use timestamp in seconds instead of milliseconds #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion copy-to-distro-specific-channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ def upload_package(package_name_simple, package_name, version, build, platform,
except subprocess.CalledProcessError as e:
print(f"Failed to upload {package_name}, version {version}, build {build}, platform {platform}: {e}")

# Get the timestamp in milliseconds from epoch, with an additional workaround
# for packages that for some reason have a timestamp in seconds instead of milliseconds
def get_timestamp_with_workaround_for_timestamp_in_seconds_instead_of_milliseconds(pkg_data):
timestamp = pkg_data["timestamp"]
# Workaround for https://github.com/RoboStack/ros-humble/issues/258 .
# If it seems that the packages was built before 2001, probably the timestamp is actually
# in seconds instead of milliseconds
if timestamp < 1000000000000:
timestamp *= 1000
return timestamp

def main():
# Parse command-line arguments
parser = argparse.ArgumentParser(description="Upload packages from robostack-staging to robostack-<distroname>.")
Expand Down Expand Up @@ -91,7 +102,7 @@ def main():
for pkg_name, pkg_data in source_packages.items()
# This should cover both packages that start with 'ros-<distro>'
# '(ros|ros2)-<distro>-mutex' packages whose build string contains <distro>
if (pkg_name.startswith(prefix) or (pkg_data["name"].endswith("distro-mutex") and distro in pkg_data["build"])) and (pkg_data["timestamp"] >= cutoff_timestamp)
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)
}

print(f"Found {len(filtered_packages)} packages in {SOURCE_CHANNEL}/{platform} that belong to distro {distro}")
Expand Down
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