use DROP IF EXISTS (from Martynas Venckus)

fix WANTLIB, regexp to strip version was totally wrong...

(more to come)
This commit is contained in:
espie 2006-11-03 23:03:09 +00:00
parent 4c52d3dcf3
commit ae324520f0
2 changed files with 10 additions and 10 deletions

View File

@ -1,7 +1,7 @@
# $OpenBSD: Makefile,v 1.5 2006/10/15 09:41:44 espie Exp $
# $OpenBSD: Makefile,v 1.6 2006/11/03 23:03:09 espie Exp $
CATEGORIES= databases
DISTNAME= sqlports-0.3
DISTNAME= sqlports-0.4
DISTFILES=
COMMENT= 'sqlite database of ports'
MAINTAINER= Marc Espie <espie@openbsd.org>

View File

@ -1,5 +1,5 @@
#! /usr/bin/perl
# $OpenBSD: mksqlitedb,v 1.1 2006/10/15 09:41:44 espie Exp $
# $OpenBSD: mksqlitedb,v 1.2 2006/11/03 23:03:09 espie Exp $
#
# Copyright (c) 2006 Marc Espie <espie@openbsd.org>
#
@ -196,9 +196,9 @@ sub addvalue
{
my ($class, $pkgpath, $db, $value) = @_;
$class->SUPER::addvalue($pkgpath, $db, $value);
if ($value =~ m/\(\>?\=\)?\.\d+\.\d+$/) {
if ($value =~ m/\.(?:\>?\=)?\d+\.\d+$/) {
$class->SUPER::addvalue($pkgpath, $db, $`);
} elsif ($value =~ m/\(\>?\=\)?\.\d+$/) {
} elsif ($value =~ m/\.(?:\>?\=)?\d+$/) {
$class->SUPER::addvalue($pkgpath, $db, $`);
}
}
@ -305,17 +305,17 @@ my $vars = {
# create the various tables, dropping old versions
for my $t (qw(Categories Flavors Multi Modules Configure ConfigureArgs Wantlib Descr)) {
$db->do("DROP TABLE $t");
$db->do("DROP TABLE IF EXISTS $t");
$db->do("CREATE TABLE $t (FULLPKGPATH TEXT NOT NULL, VALUE TEXT NOT NULL, UNIQUE(FULLPKGPATH, VALUE))");
}
$db->do("DROP TABLE Depends");
$db->do("DROP TABLE IF EXISTS Depends");
$db->do("CREATE TABLE Depends (FULLPKGPATH TEXT NOT NULL, FULLDEPENDS TEXT NOT NULL, DEPENDSPATH TEXT NOT NULL, TYPE TEXT NOT NULL)");
$db->do("DROP TABLE Shared_Libs");
$db->do("DROP TABLE IF EXISTS Shared_Libs");
$db->do("CREATE TABLE Shared_Libs (FULLPKGPATH TEXT NOT NULL, LIBNAME TEXT NOT NULL, VERSION TEXT NOT NULL, UNIQUE (FULLPKGPATH, LIBNAME))");
$db->do("DROP TABLE Ports");
$db->do("DROP TABLE IF EXISTS Ports");
$db->do("CREATE TABLE Ports (FULLPKGPATH TEXT PRIMARY KEY, ".
join(',', (map {$_." TEXT"} (keys %$vars))).")");
$db->do("DROP TABLE Paths");
$db->do("DROP TABLE IF EXISTS Paths");
$db->do("CREATE TABLE Paths (FULLPKGPATH TEXT PRIMARY KEY, PKGPATH TEXT NOT NULL)");
$db->commit();