--- Begin Message ---
Package: tracker.debian.org
Severity: normal
Tags: patch
Dear Maintainer,
Trying to build a Tracker database from scratch, using the repositories fixture
as descibed in the documentation, I get the following:
2015-12-18 08:54:11,265 INFO: Starting task UpdateRepositoriesTask
2015-12-18 08:54:11,265 INFO: UpdateRepositoriesTask Updating apt's cache
2015-12-18 08:54:15,313 INFO: UpdateRepositoriesTask Updating data from Sources files
None
2015-12-18 08:54:15,313 ERROR: Problem processing a task.
Traceback (most recent call last):
File "/home/tobald/packages/distro-tracker/distro_tracker/core/tasks.py", line 518, in run
task.execute()
File "/home/tobald/packages/distro-tracker/distro_tracker/core/tasks.py", line 548, in wrapper
six.reraise(*sys.exc_info())
File "/home/tobald/packages/distro-tracker/distro_tracker/core/tasks.py", line 545, in wrapper
func(self)
File "/home/tobald/packages/distro-tracker/distro_tracker/core/retrieve_data.py", line 818, in execute
self.update_sources_files(updated_sources)
File "/home/tobald/packages/distro-tracker/distro_tracker/core/retrieve_data.py", line 584, in update_sources_files
repository.shorthand)
AttributeError: 'NoneType' object has no attribute 'shorthand'
The attached naïve patch fixes the issue here.
Cheers,
Christophe
-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (900, 'testing'), (800, 'unstable'), (600, 'experimental'), (500, 'testing-updates')
Architecture: amd64 (x86_64)
Kernel: Linux 4.2.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_BE.UTF-8, LC_CTYPE=fr_BE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
>From 898e7e20bbe33630e752b1a55ce72f57c6f32b80 Mon Sep 17 00:00:00 2001
From: Christophe Siraut <tobald@debian.org>
Date: Fri, 18 Dec 2015 11:20:33 +0100
Subject: [PATCH] utils.AptCache: fix component_url
---
distro_tracker/core/utils/packages.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/distro_tracker/core/utils/packages.py b/distro_tracker/core/utils/packages.py
index 12c28a1..5321dd6 100644
--- a/distro_tracker/core/utils/packages.py
+++ b/distro_tracker/core/utils/packages.py
@@ -318,7 +318,7 @@ class AptCache(object):
for index_file in entry.index_files:
if os.path.basename(sources_file) in index_file.describe:
split_description = index_file.describe.split()
- component_url = split_description[0] + split_description[1]
+ component_url = split_description[0] + '/' + split_description[1]
break
for repository in Repository.objects.all():
if component_url in repository.component_urls:
--
2.6.4
--- End Message ---
--- Begin Message ---
Hi,
On Fri, 18 Dec 2015, Christophe Siraut wrote:
> The attached naïve patch fixes the issue here.
Thanks for the patch and the report. It looks like the apt_pkg module
changed its behaviour and now strips trailing slashes from the base
URL.
> @@ -318,7 +318,7 @@ class AptCache(object):
> for index_file in entry.index_files:
> if os.path.basename(sources_file) in index_file.describe:
> split_description = index_file.describe.split()
> - component_url = split_description[0] + split_description[1]
> + component_url = split_description[0] + '/' + split_description[1]
Blindly adding this slash will break systems with an older apt_pkg that
still keeps them (like jessie I guess otherwise the update would not work
on tracker.debian.org).
So I committed this:
--- a/distro_tracker/core/utils/packages.py
+++ b/distro_tracker/core/utils/packages.py
@@ -317,8 +317,9 @@ class AptCache(object):
for entry in sources_list.list:
for index_file in entry.index_files:
if os.path.basename(sources_file) in index_file.describe:
- split_description = index_file.describe.split()
- component_url = split_description[0] + split_description[1]
+ base_url, component, _ = index_file.describe.split(None, 2)
+ base_url = base_url.rstrip('/')
+ component_url = base_url + '/' + component
break
for repository in Repository.objects.all():
if component_url in repository.component_urls:
Cheers,
--
Raphaël Hertzog ◈ Debian Developer
Support Debian LTS: http://www.freexian.com/services/debian-lts.html
Learn to master Debian: http://debian-handbook.info/get/
--- End Message ---