Joerg Jaspert pushed to branch master at Debian FTP Team / dak
Commits:
-
18a4c47f
by aviau at 2018-06-10T12:45:34-04:00
-
07d6a9b2
by Joerg Jaspert at 2018-06-13T13:12:49+00:00
1 changed file:
Changes:
... | ... | @@ -79,8 +79,8 @@ def file_in_archive(filepattern=None): |
79 | 79 |
is % for zero, one or more characters, _ for a
|
80 | 80 |
single character match.
|
81 | 81 |
|
82 |
- @rtype: Dictionary, empty if nothing matched.
|
|
83 |
- @return: A dictionary of
|
|
82 |
+ @rtype: list of dictionaries
|
|
83 |
+ @return: Dictionaries made out of
|
|
84 | 84 |
- filename
|
85 | 85 |
- sha256sum
|
86 | 86 |
"""
|
... | ... | @@ -103,6 +103,40 @@ def file_in_archive(filepattern=None): |
103 | 103 |
QueryRegister().register_path('/file_in_archive', file_in_archive)
|
104 | 104 |
|
105 | 105 |
|
106 |
+@bottle.route('/sha256sum_in_archive/<sha256sum>')
|
|
107 |
+def sha256sum_in_archive(sha256sum=None):
|
|
108 |
+ """
|
|
109 |
+ Check if files with matching sha256sums are known to the archive.
|
|
110 |
+ |
|
111 |
+ @since: June 2018
|
|
112 |
+ |
|
113 |
+ @type sha256sum: string
|
|
114 |
+ @param sha256sum: SHA256 sum of the file.
|
|
115 |
+ |
|
116 |
+ @rtype: list of dictionaries
|
|
117 |
+ @return: Dictionaries made out of
|
|
118 |
+ - filename
|
|
119 |
+ - sha256sum
|
|
120 |
+ """
|
|
121 |
+ if sha256sum is None:
|
|
122 |
+ return bottle.HTTPError(503, 'sha256sum not specified.')
|
|
123 |
+ |
|
124 |
+ s = DBConn().session()
|
|
125 |
+ q = s.query(PoolFile)
|
|
126 |
+ q = q.filter(PoolFile.sha256sum == sha256sum)
|
|
127 |
+ ret = []
|
|
128 |
+ |
|
129 |
+ for p in q:
|
|
130 |
+ ret.append({'filename': p.filename,
|
|
131 |
+ 'sha256sum': p.sha256sum})
|
|
132 |
+ |
|
133 |
+ s.close()
|
|
134 |
+ |
|
135 |
+ return json.dumps(ret)
|
|
136 |
+ |
|
137 |
+QueryRegister().register_path('/sha256sum_in_archive', sha256sum_in_archive)
|
|
138 |
+ |
|
139 |
+ |
|
106 | 140 |
@bottle.route('/sources_in_suite/<suite>')
|
107 | 141 |
def sources_in_suite(suite=None):
|
108 | 142 |
"""
|