Ansgar pushed to branch deploy at Debian FTP Team / dak
Commits:
-
65428330
by Ansgar at 2021-01-27T19:05:14+01:00
-
8f090ecf
by Ansgar at 2021-01-30T15:56:25+01:00
-
ac3c7a86
by Ansgar at 2021-02-01T12:33:52+01:00
2 changed files:
Changes:
... | ... | @@ -161,16 +161,15 @@ def validate_data(data): |
161 | 161 |
|
162 | 162 |
|
163 | 163 |
def validate_file(fname):
|
164 |
- f = None
|
|
165 | 164 |
if fname.endswith('.gz'):
|
166 |
- f = gzip.open(fname, 'r')
|
|
165 |
+ opener = gzip.open
|
|
167 | 166 |
elif fname.endswith('.xz'):
|
168 |
- f = lzma.open(fname, 'r')
|
|
167 |
+ opener = lzma.open
|
|
169 | 168 |
else:
|
170 |
- f = open(fname, 'r')
|
|
169 |
+ opener = open
|
|
171 | 170 |
|
172 |
- data = str(f.read(), 'utf-8')
|
|
173 |
- f.close()
|
|
171 |
+ with opener(fname, 'rt', encoding='utf-8') as fh:
|
|
172 |
+ data = fh.read()
|
|
174 | 173 |
|
175 | 174 |
return validate_data(data)
|
176 | 175 |
|
... | ... | @@ -101,10 +101,8 @@ out=$(ssh ${DBHOST} preparehashes) |
101 | 101 |
# And now we get us the file here, so we can easily lookup hashes.
|
102 | 102 |
# (the rsync uses the same ssh key and runs into the forced command.
|
103 | 103 |
# That just knows to send the file for rsync instead of preparing it.)
|
104 |
-if [[ ${out} == UPDATED ]]; then
|
|
105 |
- cd "${dbdir}"
|
|
106 |
- rsync ${DBHOST}:/srv/ftp-master.debian.org/home/hashes.gz ${HASHFILE}.gz
|
|
107 |
-fi
|
|
104 |
+cd "${dbdir}"
|
|
105 |
+rsync ${DBHOST}:/srv/ftp-master.debian.org/home/hashes.gz ${HASHFILE}.gz
|
|
108 | 106 |
|
109 | 107 |
cd "${PROCESSDIR}"
|
110 | 108 |
log "Processing ${PROCESSDIR}"
|