Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/makemandb PR 46419 by Abhinav Upadhyay using his up...
details: https://anonhg.NetBSD.org/src/rev/a8d24f6a54b7
branches: trunk
changeset: 779162:a8d24f6a54b7
user: wiz <wiz%NetBSD.org@localhost>
date: Mon May 07 11:18:16 2012 +0000
description:
PR 46419 by Abhinav Upadhyay using his updated patch:
Clean up after removing man page aliases.
diffstat:
usr.sbin/makemandb/DBSCHEMA | 1 +
usr.sbin/makemandb/apropos-utils.c | 10 ++++++----
usr.sbin/makemandb/apropos-utils.h | 4 ++--
usr.sbin/makemandb/makemandb.c | 10 ++++++----
4 files changed, 15 insertions(+), 10 deletions(-)
diffs (103 lines):
diff -r 5f21f1d8fffb -r a8d24f6a54b7 usr.sbin/makemandb/DBSCHEMA
--- a/usr.sbin/makemandb/DBSCHEMA Mon May 07 08:55:46 2012 +0000
+++ b/usr.sbin/makemandb/DBSCHEMA Mon May 07 11:18:16 2012 +0000
@@ -50,3 +50,4 @@
3. section The section number
4. machine The machine architecture (if any) for which
the page is relevant
+ 5. md5_hash MD5 Hash of the target man page.
diff -r 5f21f1d8fffb -r a8d24f6a54b7 usr.sbin/makemandb/apropos-utils.c
--- a/usr.sbin/makemandb/apropos-utils.c Mon May 07 08:55:46 2012 +0000
+++ b/usr.sbin/makemandb/apropos-utils.c Mon May 07 11:18:16 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: apropos-utils.c,v 1.4 2012/04/15 15:56:52 wiz Exp $ */
+/* $NetBSD: apropos-utils.c,v 1.5 2012/05/07 11:18:16 wiz Exp $ */
/*-
* Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
* All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: apropos-utils.c,v 1.4 2012/04/15 15:56:52 wiz Exp $");
+__RCSID("$NetBSD: apropos-utils.c,v 1.5 2012/05/07 11:18:16 wiz Exp $");
#include <sys/stat.h>
@@ -172,7 +172,7 @@
"file UNIQUE, md5_hash UNIQUE, id INTEGER PRIMARY KEY); "
//mandb_meta
"CREATE TABLE IF NOT EXISTS mandb_links(link, target, section, "
- "machine); "; //mandb_links
+ "machine, md5_hash); "; //mandb_links
sqlite3_exec(db, sqlstr, NULL, NULL, &errmsg);
if (errmsg != NULL)
@@ -181,7 +181,9 @@
sqlstr = "CREATE INDEX IF NOT EXISTS index_mandb_links ON mandb_links "
"(link); "
"CREATE INDEX IF NOT EXISTS index_mandb_meta_dev ON mandb_meta "
- "(device, inode)";
+ "(device, inode); "
+ "CREATE INDEX IF NOT EXISTS index_mandb_links_md5 ON mandb_links "
+ "(md5_hash);";
sqlite3_exec(db, sqlstr, NULL, NULL, &errmsg);
if (errmsg != NULL)
goto out;
diff -r 5f21f1d8fffb -r a8d24f6a54b7 usr.sbin/makemandb/apropos-utils.h
--- a/usr.sbin/makemandb/apropos-utils.h Mon May 07 08:55:46 2012 +0000
+++ b/usr.sbin/makemandb/apropos-utils.h Mon May 07 11:18:16 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: apropos-utils.h,v 1.2 2012/02/07 19:17:16 joerg Exp $ */
+/* $NetBSD: apropos-utils.h,v 1.3 2012/05/07 11:18:16 wiz Exp $ */
/*-
* Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
* All rights reserved.
@@ -43,7 +43,7 @@
#define MANDB_WRITE SQLITE_OPEN_READWRITE
#define MANDB_CREATE SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
-#define APROPOS_SCHEMA_VERSION 20120130
+#define APROPOS_SCHEMA_VERSION 20120507
/*
* Used to identify the section of a man(7) page.
diff -r 5f21f1d8fffb -r a8d24f6a54b7 usr.sbin/makemandb/makemandb.c
--- a/usr.sbin/makemandb/makemandb.c Mon May 07 08:55:46 2012 +0000
+++ b/usr.sbin/makemandb/makemandb.c Mon May 07 11:18:16 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: makemandb.c,v 1.8 2012/05/04 23:50:26 wiz Exp $ */
+/* $NetBSD: makemandb.c,v 1.9 2012/05/07 11:18:16 wiz Exp $ */
/*
* Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
@@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: makemandb.c,v 1.8 2012/05/04 23:50:26 wiz Exp $");
+__RCSID("$NetBSD: makemandb.c,v 1.9 2012/05/07 11:18:16 wiz Exp $");
#include <sys/stat.h>
#include <sys/types.h>
@@ -780,6 +780,8 @@
sqlstr = "DELETE FROM mandb_meta WHERE file NOT IN"
" (SELECT file FROM metadb.file_cache);"
+ "DELETE FROM mandb_links WHERE md5_hash NOT IN"
+ " (SELECT md5_hash from mandb_meta);"
"DROP TABLE metadb.file_cache;"
"DELETE FROM mandb WHERE rowid NOT IN"
" (SELECT id FROM mandb_meta);";
@@ -1726,9 +1728,9 @@
ln[strlen(ln) - 1] = 0;
str = sqlite3_mprintf("INSERT INTO mandb_links"
- " VALUES (%Q, %Q, %Q, %Q)",
+ " VALUES (%Q, %Q, %Q, %Q, %Q)",
ln, rec->name, rec->section,
- rec->machine);
+ rec->machine, rec->md5_hash);
sqlite3_exec(db, str, NULL, NULL, &errmsg);
sqlite3_free(str);
if (errmsg != NULL) {
Home |
Main Index |
Thread Index |
Old Index