repo-add: don't break if delta package sources contain epoch

Our sed parser for xdelta3 headers will greedily match on ":" which
coincidentally is also the character we use to define a version with an
epoch.

While we are at it, simply use sed for the whole pipeline, rather than
using both grep and sed.

Fixes FS#61195

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Eli Schwartz 2018-12-27 18:15:48 -05:00 committed by Allan McRae
parent 4778f13188
commit 984492b92f

View file

@ -159,8 +159,8 @@ db_write_delta() {
md5sum=${md5sum%% *} md5sum=${md5sum%% *}
csize=$(wc -c "$deltafile" | cut -d' ' -f1) csize=$(wc -c "$deltafile" | cut -d' ' -f1)
oldfile=$(xdelta3 printhdr "$deltafile" | grep "XDELTA filename (source)" | sed 's/.*: *//') oldfile=$(xdelta3 printhdr "$deltafile" | sed -n 's/XDELTA filename (source):\s\+\(\.*\)/\1/p')
newfile=$(xdelta3 printhdr "$deltafile" | grep "XDELTA filename (output)" | sed 's/.*: *//') newfile=$(xdelta3 printhdr "$deltafile" | sed -n 's/XDELTA filename (output):\s\+\(\.*\)/\1/p')
if grep -q "$oldfile.*$newfile" "$deltas"; then if grep -q "$oldfile.*$newfile" "$deltas"; then
sed -i.backup "/$oldfile.*$newfile/d" "$deltas" && rm -f "$deltas.backup" sed -i.backup "/$oldfile.*$newfile/d" "$deltas" && rm -f "$deltas.backup"