1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-04 16:45:07 -05:00

repo-add: Fix whitespaces handling in variables.

repo-add didn't handle whitespaces nicely in fields value, and this has hurt
us several times, first with provision version (FS#9171) and then with
optdepends (FS#10630), so it is time to fix it.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Nagy Gabor 2008-01-15 11:50:46 +01:00 committed by Dan McGee
parent 729651a554
commit 6417ac129d

View File

@ -99,8 +99,7 @@ test_repo_db_file () {
write_list_entry() { write_list_entry() {
if [ -n "$2" ]; then if [ -n "$2" ]; then
echo "%$1%" >>$3 echo "%$1%" >>$3
echo $2 | tr -s ' ' '\n' >>$3 echo -e $2 >>$3
echo "" >>$3
fi fi
} }
@ -157,13 +156,13 @@ db_write_entry()
grep -v "^#" | sed 's|\(\w*\)\s*=\s*\(.*\)|\1="\2"|'); do grep -v "^#" | sed 's|\(\w*\)\s*=\s*\(.*\)|\1="\2"|'); do
eval "$line" eval "$line"
case "$line" in case "$line" in
group=*) _groups="$_groups $group" ;; group=*) _groups="$_groups$group\n" ;;
depend=*) _depends="$_depends $depend" ;; depend=*) _depends="$_depends$depend\n" ;;
backup=*) _backups="$_backups $backup" ;; backup=*) _backups="$_backups$backup\n" ;;
license=*) _licenses="$_licenses $license" ;; license=*) _licenses="$_licenses$license\n" ;;
replaces=*) _replaces="$_replaces $replaces" ;; replaces=*) _replaces="$_replaces$replaces\n" ;;
provides=*) _provides="$_provides $provides" ;; provides=*) _provides="$_provides$provides\n" ;;
conflict=*) _conflicts="$_conflicts $conflict" ;; conflict=*) _conflicts="$_conflicts$conflict\n" ;;
esac esac
done done