From owner-freebsd-hackers@FreeBSD.ORG Mon Apr 12 16:07:15 2010 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 4B648106564A for ; Mon, 12 Apr 2010 16:07:15 +0000 (UTC) (envelope-from salfrancl.listas@gmail.com) Received: from mail-bw0-f216.google.com (mail-bw0-f216.google.com [209.85.218.216]) by mx1.freebsd.org (Postfix) with ESMTP id CAFA68FC0A for ; Mon, 12 Apr 2010 16:07:14 +0000 (UTC) Received: by bwz8 with SMTP id 8so3187417bwz.3 for ; Mon, 12 Apr 2010 09:07:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:content-type :content-transfer-encoding; bh=J6Qal8nPP+nZVXmzPhCOGxoWIkRKNnDl9KC0Wg3dDu8=; b=fnf2DJ+icYipJrd5eO5mj6w4P0z+CiiJhmEI9cg2tD1eYhck/VaoEeBAzUw1EdMyoe 6I/j4slV3XHKzsm57Xd/BDL7krKmLpMU1d5BhKOpOxnxiLXnn2aXalGZALF179BFziyU X3kLLdtJPFztVZuoZyx9U1bkOSLVDbiWyQSPs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=P4kKrJTtaYTKjNPkxzmztk3UuVzmX1pqDS4b7suLK1muP1nzRlrpEz9VZm1nCbiuyo b64ShWSBnKHygKZB4hMDhlAx0H93U4Wz9DcHwKv3qpRR1NohALMxWZsQlBXG7Dd7hif7 3K35yAV1uOJv3Khk5q7p93EZwliD5B7lcUmoo= MIME-Version: 1.0 Received: by 10.204.67.17 with HTTP; Mon, 12 Apr 2010 09:07:13 -0700 (PDT) In-Reply-To: References: Date: Mon, 12 Apr 2010 12:07:13 -0400 Received: by 10.204.162.145 with SMTP id v17mr5051256bkx.83.1271088433468; Mon, 12 Apr 2010 09:07:13 -0700 (PDT) Message-ID: From: Leinier Cruz Salfran To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: make pkg_install suite reusable, please 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: Mon, 12 Apr 2010 16:07:15 -0000 On Sun, Apr 11, 2010 at 8:34 PM, Marcin Wisnicki wrote: > On Sun, 11 Apr 2010 12:37:27 +0100, Robert Watson wrote: > >> On Fri, 9 Apr 2010, Alexander Churanov wrote: >> >>> 2010/4/9 Leinier Cruz Salfran >>> >>>> i want to ask you one thing: can you make the 'pkg_install' suite >>>> reusable .. means install 'libinstall.a' as a shared object in order >>>> to make it reusable by others devs >>> >>> I'd like to add my 50 cents. From my point of view, the true UNIX way >>> is re-using whole programs. This provides unbelievable isolation and >>> correctness. If you don't want to fork myriads of processes each >>> second, then, it's, probably, better to ask for pipe mode of pkg_* >>> tools. For example, aspell works that way. You start a process, write >>> commands and queries and read results. >> >> While there are clearly benefits to process isolation, there are >> countless situations in UNIX where I've said to myself "Oh, I wish I had >> a lib not just a command". =C2=A0This is particularly the cas= e for >> monitoring tools, where third-party applications have a lot of trouble >> parsing and tracking the output of tools like ps(1), etc. =C2=A0This is = why >> recently we've been working on libmemstat(3), libprocstat(3), >> libnetstat(3), etc -- so that tools can avoid rewriting that code as >> well as avoid the parsing problem. > > A middle-ground solution to this is to standardise on a common data > exchange format with a schema definition language. With schema you can > autogenerate high level parsers and generators, validators and other thin= gs > for free. It does not have to be XML with XML-Schema (though there are go= od > plaintext schema languages like RelaxNG-compact and you could possibly fi= nd > less verbose text encoding for XML). > > If, say ps or ipfw, had a switch like '--format-output-yaml' and > '--print-output-schema' (alternatively schema files could be stored > somewhere in $prefix/share) it would be trivial to use them anywhere. > > The only problem I see is agreeing on a single format and forcing everyon= e > to use it. Which is probably why it will never happen :( > hello marcin that can be a smart solution but i prefer to use functions directly from library .. i think it's better well, alexander .. i must to follow your first suggestion: use 'pkg_*' commands (meanwhile) .. i plan to make this software usable to netbsd and openbsd too .. i'm not sure but maybe they have the same situation and for that reason i think use the commands is the way to follow i want to count on you to do more questions and surveys