From ab57137f5c3d42162193cae2c27955a94f1efcd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20L=C3=BCdtke?= Date: Fri, 4 Sep 2020 09:23:25 +0200 Subject: [PATCH] download Packages.gz instead of Packages (#89) --- docker_templates/packages.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docker_templates/packages.py b/docker_templates/packages.py index 7daa131..876a9f1 100644 --- a/docker_templates/packages.py +++ b/docker_templates/packages.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import gzip import string import re import urllib.request @@ -29,11 +30,11 @@ } indexUrlTemplateLookup = { - 'gazebo_packages': string.Template('http://packages.osrfoundation.org/gazebo/$os_name-$release/dists/$os_code_name/main/binary-$arch/Packages'), - 'ros_packages': string.Template('http://packages.ros.org/ros/ubuntu/dists/$os_code_name/main/binary-$arch/Packages'), - 'ros2_packages': string.Template('http://packages.ros.org/ros2/ubuntu/dists/$os_code_name/main/binary-$arch/Packages'), - 'ros_packages_snapshots': string.Template('http://snapshots.ros.org/$rosdistro_name/final/ubuntu/dists/$os_code_name/main/binary-$arch/Packages'), - 'ros2_packages_snapshots': string.Template('http://snapshots.ros.org/$ros2distro_name/final/ubuntu/dists/$os_code_name/main/binary-$arch/Packages'), + 'gazebo_packages': string.Template('http://packages.osrfoundation.org/gazebo/$os_name-$release/dists/$os_code_name/main/binary-$arch/Packages.gz'), + 'ros_packages': string.Template('http://packages.ros.org/ros/ubuntu/dists/$os_code_name/main/binary-$arch/Packages.gz'), + 'ros2_packages': string.Template('http://packages.ros.org/ros2/ubuntu/dists/$os_code_name/main/binary-$arch/Packages.gz'), + 'ros_packages_snapshots': string.Template('http://snapshots.ros.org/$rosdistro_name/final/ubuntu/dists/$os_code_name/main/binary-$arch/Packages.gz'), + 'ros2_packages_snapshots': string.Template('http://snapshots.ros.org/$ros2distro_name/final/ubuntu/dists/$os_code_name/main/binary-$arch/Packages.gz'), } packageNameVersionTemplateLookup = { @@ -54,7 +55,7 @@ def getPackageIndex(data, package_index_url): # Download package index req = urllib.request.Request(package_index_url) with urllib.request.urlopen(req) as response: - package_index = response.read().decode('utf-8') + package_index = gzip.decompress(response.read()).decode('utf-8') return package_index