From owner-freebsd-hackers@FreeBSD.ORG Fri May 9 11:54:06 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 711761065677 for ; Fri, 9 May 2008 11:54:06 +0000 (UTC) (envelope-from andenore@start.no) Received: from osl1smout1.broadpark.no (osl1smout1.broadpark.no [80.202.4.58]) by mx1.freebsd.org (Postfix) with ESMTP id 2C0A08FC17 for ; Fri, 9 May 2008 11:54:05 +0000 (UTC) (envelope-from andenore@start.no) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; format=flowed; delsp=yes; charset=us-ascii Received: from osl1sminn1.broadpark.no ([80.202.4.59]) by osl1smout1.broadpark.no (Sun Java(tm) System Messaging Server 6.3-3.01 (built Jul 12 2007; 32bit)) with ESMTP id <0K0L00MOLNQ05J60@osl1smout1.broadpark.no> for freebsd-hackers@freebsd.org; Fri, 09 May 2008 13:54:00 +0200 (CEST) Received: from duckjen.nextgentel.no ([84.48.194.205]) by osl1sminn1.broadpark.no (Sun Java(tm) System Messaging Server 6.3-3.01 (built Jul 12 2007; 32bit)) with ESMTP id <0K0L001ZWNPZMEK1@osl1sminn1.broadpark.no> for freebsd-hackers@freebsd.org; Fri, 09 May 2008 13:54:00 +0200 (CEST) Date: Fri, 09 May 2008 13:52:46 +0200 To: freebsd-hackers@freebsd.org From: Anders Nore Message-id: User-Agent: Opera Mail/9.27 (FreeBSD) Subject: Adding .db support to pkg_tools X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 May 2008 11:54:06 -0000 Hi, I'm working on adding .db support to the pkg_tools( i.e. pkg_add, pkg_info, etc. ) as part of SoC 2008. The database api used is BerkeleyDB that comes with the base system (/usr/src/include/db.h). BerkeleyDB is not you're typical relational db, and can only save key/value pairs. The way I'm thinking of storing information to the .db is to name the keys as the directory names in /var/db/pkg. And save the +* files in the directories to the value element in the db, separated with a special character or similar. One problem lies with the +* files which is scripts (e.g., +INSTALL, +DEINSTALL). I've gotten some input that it's bad to save scripts in the db, but if it's not going to be saved there, then where? Isn't it possible to execute a script without saving a file to disk? Like using "sh -c 'string'". In my personal opinion it should not be a hybrid solution where you save the script files in an old fashion way, for example /var/db/pkg/someport-1.2_1/+INSTALL, and the rest of the information lies in the .db file. Because then you have redundancy and that could lead to inconsistencies. Let me hear your opinions =) - Anders Nore