On Mon, Oct 15, 2007 at 09:24:19PM -0500, Dan McGee wrote:
+ pkgname="$(echo "$filename" | sed -e 's/\(.*\)-\(.*-.*\)_to_\(.*-.*\)-\(.*\).delta/\1/')" + fromver="$(echo "$filename" | sed -e 's/\(.*\)-\(.*-.*\)_to_\(.*-.*\)-\(.*\).delta/\2/')" + tover="$(echo "$filename" | sed -e 's/\(.*\)-\(.*-.*\)_to_\(.*-.*\)-\(.*\).delta/\3/')" + arch="$(echo "$filename" | sed -e 's/\(.*\)-\(.*-.*\)_to_\(.*-.*\)-\(.*\).delta/\4/')" + md5sum="$(md5sum "$deltafile" | cut -d ' ' -f 1)"
Is there any way to do it without so much sed-magic, or at least make it look slightly cleaner? If not, then we'll have to live with it. Can you add some comments above it explaining the regex in case someone else ever has to change it though?
This was the only method I could think of, aside from creating the delta as a tar file with a .DELTAINFO like packages. I'll add the comment.
+ # create deltas entry + msg2 "$(gettext "Creating 'deltas' db entry...")" + echo -e "%DELTAS%" >>deltas + for delta in $startdir/$pkgname-*-*_to_*-*-$arch.delta; do + if [ -e "$delta" ]; then + if db_write_delta "$delta"; then + msg2 "$(gettext "Added delta '%s'")" "$(basename "$delta")" + else + msg2 "$(gettext "Could not add delta '%s'")" "$(basename "$delta")" + fi + fi + done + echo -e "" >>deltas + # preserve the modification time - touch -r "$pkgfile" desc depends + touch -r "$pkgfile" desc depends deltas
Will this create an empty deltas file if it doesn't exist? We probably don't want that (just db clutter).
The deltas file will always have at least '%DELTAS%\n' in it. I will change it so it is only created if needed.