Commit Diff
Diff:
be8d83b280fc299e50db136120da70de2afb26ab
84a99bf370976816e3ca7c14c73135ec3c6b2a1b
Commit:
84a99bf370976816e3ca7c14c73135ec3c6b2a1b
Tree:
d389226557a27f3f4a50fa0583e372b2b7657b2f
Author:
fredgnix <fredgnix@a8afeb8c-277c-4b4a-a4f6-ef4c85adc32b>
Committer:
fredgnix <fredgnix@a8afeb8c-277c-4b4a-a4f6-ef4c85adc32b>
Date:
Thu Apr 19 14:51:58 2012 UTC
Message:
clean pkgdesc with parasite characters
blob - 160822c29d38bcb529fb6deb83802d024d0d047a
blob + ed3f0146206cfb3d1544d6e4b4e4955a7ac2eff6
--- Pkgtxt2db.pm
+++ Pkgtxt2db.pm
@@ -145,8 +145,13 @@ sub mkdadb {
}
if (($_ =~ /\Q${pkgname}\E:(.*)/) && (defined($pkgname))) {
$pkgdb{$pkgname}[8] = $pkgdb{$pkgname}[8] . "$1";
- # clean xml
+ # clean space
+ $pkgdb{$pkgname}[8] =~ s/ +/ /g;
+ # clean xml output: & < > cannot be in a varchar
$pkgdb{$pkgname}[8] =~ s/&/and/g;
+ $pkgdb{$pkgname}[8] =~ s/(<)|(>)//g;
+ # clean csv output: " in pkgdesc is shit
+ $pkgdb{$pkgname}[8] =~ s/"/'/g;
next;
}
else {
@@ -163,7 +168,7 @@ sub tocsv {
open(C, ">$target-$release.csv") or die "Unable to open $target-$release.csv for writing, aborting.";
# choose the CSV separator, \t = tab \@ = @ ....
# avoid the comma (,) as it is the separator for dependancies
- my $c = "\;";
+ my $c = "\"\;\"";
print C "\"pkgname${c}pkgver${c}arch${c}pkgrel${c}location${c}dep${c}sizeC${c}sizeU${c}Desc\"\n";
for my $p ( sort keys %pkgdb ) {
printf C "\"%s$c%s$c%s$c%s$c%s$c%s$c%s$c%s$c%s\"\n",
Frédéric Galusik