[Pkg-privacy-commits] [tails-installer] 03/08: Fix the release detection code to work with latest Fedora products

anonym anonym-tails-guest at moszumanska.debian.org
Thu Jan 12 15:15:08 UTC 2017


This is an automated email from the git hooks/post-receive script.

anonym-tails-guest pushed a commit to annotated tag 3.13.2
in repository tails-installer.

commit a940696c4511c1b8e82cf3b692ae36ddd3a26d55
Author: Luke Macken <lmacken at redhat.com>
Date:   Thu Dec 11 17:17:43 2014 -0700

    Fix the release detection code to work with latest Fedora products
---
 liveusb/releases.py | 61 +++++++++++++++++++++++++++++------------------------
 1 file changed, 34 insertions(+), 27 deletions(-)

diff --git a/liveusb/releases.py b/liveusb/releases.py
index 3522533..ae606ea 100644
--- a/liveusb/releases.py
+++ b/liveusb/releases.py
@@ -60,33 +60,40 @@ def get_fedora_releases():
         versions = re.findall(r'<a href="(\d+)/">', html)
         latest = sorted([int(v) for v in versions], reverse=True)[0:2]
         for release in latest:
-            for arch in ARCHES:
-                arch_url = FEDORA_RELEASES + '%s/Live/%s/' % (release, arch)
-                try:
-                    files = urlread(arch_url)
-                except URLGrabError:
-                    continue
-                for link in re.findall(r'<a href="(.*)">', files):
-                    if link.endswith('-CHECKSUM'):
-                        checksum = urlread(arch_url + link)
-                        for line in checksum.split('\n'):
-                            try:
-                                sha256, filename = line.split()
-                                if filename[0] != '*':
-                                    continue
-                                filename = filename[1:]
-                                chunks = filename[:-6].split('-')
-                                chunks.remove('Live')
-                                release = chunks.pop()
-                                chunks.insert(1,release)
-                                name = ' '.join(chunks)
-                                fedora_releases.append(dict(
-                                    name=name,
-                                    url=arch_url + filename,
-                                    sha256=sha256,
-                                ))
-                            except ValueError:
-                                pass
+            if release >= 21:
+                products = ('Workstation', 'Server', 'Cloud', 'Live')
+            else:
+                products = ('Live',)
+            for product in products:
+                for arch in ARCHES:
+                    if product == 'Live':
+                        isodir = '/'
+                    else:
+                        isodir = 'iso/'
+                    arch_url = FEDORA_RELEASES + '%s/%s/%s/%s' % (release,
+                            product, arch, isodir)
+                    try:
+                        files = urlread(arch_url)
+                    except URLGrabError:
+                        continue
+                    for link in re.findall(r'<a href="(.*)">', files):
+                        if link.endswith('-CHECKSUM'):
+                            print('Reading %s' % arch_url + link)
+                            checksum = urlread(arch_url + link)
+                            for line in checksum.split('\n'):
+                                try:
+                                    sha256, filename = line.split()
+                                    if filename[0] != '*':
+                                        continue
+                                    filename = filename[1:]
+                                    name = filename.replace('.iso', '')
+                                    fedora_releases.append(dict(
+                                        name=name,
+                                        url=arch_url + filename,
+                                        sha256=sha256,
+                                    ))
+                                except ValueError:
+                                    pass
         releases = fedora_releases + other_releases
     except:
         # Can't fetch releases from the internet.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/tails-installer.git



More information about the Pkg-privacy-commits mailing list