From owner-freebsd-hackers@FreeBSD.ORG Mon Apr 12 16:18:20 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 C35801065670 for ; Mon, 12 Apr 2010 16:18:20 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.27]) by mx1.freebsd.org (Postfix) with ESMTP id 759BA8FC1E for ; Mon, 12 Apr 2010 16:18:20 +0000 (UTC) Received: by qw-out-2122.google.com with SMTP id 5so2006648qwi.7 for ; Mon, 12 Apr 2010 09:18:19 -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:cc:content-type :content-transfer-encoding; bh=FZoTlSLAp55KOwKw8+8YQEvkLEktBeatHJMIjt5IJ8M=; b=ebZl+OpxoD/03oR1W9b8Y+XQnp4Ai7KNZgUKS5qb+kT1bbqrIFkpjzMwCJxGZx8xrk CrC5I8pkl9SNhTzVXhlXdRDTOVpqFzhC+Nbk0JNlz85gidk77DbM5lFL3559xVn0kz16 ElaP25M2LyklKslIl9IgTHvZUUSqwQLHXbZNg= 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 :cc:content-type:content-transfer-encoding; b=LgGnT6hlUwhriJO+ukrQSFmGpTLnumX4wZgkm8SOyttRYBSwvlJMyx/8L7OpKCy0sF iDzGNJ6KjKXEOx0Xzf4y553c5G8Baf2v/QSfZMUwK5MLR9C8ItPq7af7XvtHZwdg/5ND bhRmQGnNmzpG2wNm33pkMSAUo2zoe0i24EHao= MIME-Version: 1.0 Received: by 10.229.28.85 with HTTP; Mon, 12 Apr 2010 09:18:19 -0700 (PDT) In-Reply-To: References: Date: Mon, 12 Apr 2010 09:18:19 -0700 Received: by 10.229.214.17 with SMTP id gy17mr3096309qcb.42.1271089099469; Mon, 12 Apr 2010 09:18:19 -0700 (PDT) Message-ID: From: Garrett Cooper To: Leinier Cruz Salfran Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org 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:18:20 -0000 On Mon, Apr 12, 2010 at 9:07 AM, Leinier Cruz Salfran wrote: > 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 ha= d >>> a lib not just a command". =A0This is particularly the case = for >>> monitoring tools, where third-party applications have a lot of trouble >>> parsing and tracking the output of tools like ps(1), etc. =A0This is wh= y >>> 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 thi= ngs >> for free. It does not have to be XML with XML-Schema (though there are g= ood >> plaintext schema languages like RelaxNG-compact and you could possibly f= ind >> 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 everyo= ne >> 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 .. =A0i'm not sure but maybe they have the same > situation and for that reason i think use the commands is the way to > follow Just to give you an idea of what's out there... NetBSD used the same basic solution that FreeBSD did, but they diverged about 3 years ago and they have their own library based solution. I think that OpenBSD has their own package maintenance tool written in perl. As for us, we're going the libpkg direction-ish AFAIK, but it's going to take time before we get there. In the meantime, there's also a tool named pkgin which does similar to what you describe and it's portable between pkg_install on FreeBSD and the libpkg-ish solution on NetBSD. HTH, -Garrett