summarylogtreecommitdiffstats
path: root/0008-Fix-hdrmd5-check-of-downloaded-packages-from-DoD-rep.patch
blob: fa3be6b03c4a765a35cedef6f736bcfe9bc5eb27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Daniel Mach <daniel.mach@suse.com>
Date: Tue, 29 Mar 2022 09:59:08 +0200
Subject: [PATCH] Fix hdrmd5 check of downloaded packages from DoD repos
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

(cherry picked from commit 8384a1fdff980590244c211024127542d08a9716)

Re:
openSUSE/osc#1016

Signed-off-by: Björn Bidar <bjorn.bidar@jolla.com>
---
 osc/fetch.py | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/osc/fetch.py b/osc/fetch.py
index 8ed75a58c7e2caf5febb96cd862e0065f478b58a..90e8321575b1df8d91388314d1cecd4d281d9792 100644
--- a/osc/fetch.py
+++ b/osc/fetch.py
@@ -270,14 +270,16 @@ class Fetcher:
                         # mark it for downloading from the API
                         self.__add_cpio(i)
                     else:
+                        # if the checksum of the downloaded package doesn't match,
+                        # delete it and mark it for downloading from the API
                         hdrmd5 = packagequery.PackageQuery.queryhdrmd5(i.fullfilename)
-                        if hdrmd5 != i.hdrmd5:
-                            if conf.config["api_host_options"][apiurl]["disable_hdrmd5_check"]:
-                                print(f"Warning: Ignoring a hdrmd5 mismatch for {i.fullfilename}: {hdrmd5} (actual) != {i.hdrmd5} (expected)")
-                            else:
-                                print(f"The file will be redownloaded from the API due to a hdrmd5 mismatch for {i.fullfilename}: {hdrmd5} (actual) != {i.hdrmd5} (expected)")
-                                os.unlink(i.fullfilename)
-                                self.__add_cpio(i)
+
+                        # packages with hdrmd5 == 'd0d...' come from 'download on demand' repos
+                        # and their checksum is not known to the server yet, so we skip their checksum check
+                        if hdrmd5 != i.hdrmd5 and i.hdrmd5 != 'd0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0':
+                            print(f"The file will be redownloaded from the API due to a hdrmd5 mismatch for {i.fullfilename}: {hdrmd5} (actual) != {i.hdrmd5} (expected)")
+                            os.unlink(i.fullfilename)
+                            self.__add_cpio(i)
 
                 except KeyboardInterrupt:
                     print('Cancelled by user (ctrl-c)')