From owner-freebsd-questions@FreeBSD.ORG Thu May 22 21:28:32 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C0C21065701 for ; Thu, 22 May 2008 21:28:32 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id C3FAA8FC13 for ; Thu, 22 May 2008 21:28:31 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (adsl105-70.kln.forthnet.gr [77.49.224.70]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-1) with ESMTP id m4MLRWtJ029140 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 23 May 2008 00:28:02 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.2/8.14.2) with ESMTP id m4MLRV0N001877; Fri, 23 May 2008 00:28:01 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.2/8.14.2/Submit) id m4MKMm2u002028; Thu, 22 May 2008 23:22:48 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Matthias Apitz References: <972994690801011020u60ed0a0et6d8356cdb1f6f974@mail.gmail.com> <20080102141419.GB61289@sandvine.com> <20080521143210.GA70289@rebelion.Sisis.de> <4834516F.1010002@otenet.gr> <87prre275y.fsf@kobe.laptop> <20080522071727.GA6009@rebelion.Sisis.de> Date: Thu, 22 May 2008 23:22:46 +0300 In-Reply-To: <20080522071727.GA6009@rebelion.Sisis.de> (Matthias Apitz's message of "Thu, 22 May 2008 09:17:27 +0200") Message-ID: <87skwaqeax.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: quoted-printable X-MailScanner-ID: m4MLRWtJ029140 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.832, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.57, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: Manolis Kiagias , "freebsd-questions@freebsd.org" Subject: Re: Asus eee X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 May 2008 21:28:32 -0000 On Thu, 22 May 2008 09:17:27 +0200, Matthias Apitz wrote: > El d=A8=AAa Thursday, May 22, 2008 a las 09:18:33AM +0300, Giorgos Kerami= das escribi=A8=AE: >> Alternatively, you can use `pkg_create -b' to save the installed >> copies of a few ports, and move them over. Installed packages can be >> saved anywhere you prefer to store them. I some times use `/usr/pkg'. > > Thanks for your hint concerning pkg_create. I've stumbled over this as > well and we must not only create a given package, but also all the > packages from which it depends with for example: > > # pkg_create -Rb stardict-2.4.8_5 > > this gave me in this example 144 packages in the current dir; I run it > twice to see if pkg_create detects that a given dependency is already > there or if it will rebuild the package, and it does rebuild them; this > means if I run pkg_create for the 200 ports I've compiled (even if I let > out what perhaps I don't need on the smaller EeePC it is a lot of > stuff), it will do a lot of work twice; is there a way to let pkg_create > check if the pkg is already built and there? That's true. There is going to be at least *some* duplication of work if you run `pkg_create -Rb' multiple times :-/ There's no option to inhibit pkg_create output if a package already exists, i.e. something like a `noclobber' option. Maybe we can hack a new feature for this. That would be cool. Then you could run, for example, `pkg_create -Rbn' and avoid recreating packages every time a dependency is met as part of one of the packages you want to transfer. I'll haev to test a bit the following patch, and get it reviewed by our packaging tools people, but it seems pretty straightforward. %%% Index: usr.sbin/pkg_install/create/create.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/usr.sbin/pkg_install/create/create.h,v retrieving revision 1.26 diff -u -r1.26 create.h --- usr.sbin/pkg_install/create/create.h 8 Nov 2005 20:48:26 -0000 1.26 +++ usr.sbin/pkg_install/create/create.h 22 May 2008 20:11:20 -0000 @@ -46,6 +46,7 @@ extern int Dereference; extern int PlistOnly; extern int Recursive; +extern int NoClobber; =20 enum zipper {NONE, GZIP, BZIP, BZIP2 }; extern enum zipper Zipper; Index: usr.sbin/pkg_install/create/main.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/usr.sbin/pkg_install/create/main.c,v retrieving revision 1.41 diff -u -r1.41 main.c --- usr.sbin/pkg_install/create/main.c 7 Nov 2007 10:53:36 -0000 1.41 +++ usr.sbin/pkg_install/create/main.c 22 May 2008 20:07:33 -0000 @@ -16,7 +16,7 @@ #include "lib.h" #include "create.h" =20 -static char Options[] =3D "EGYNORhjvxyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:S:o= :b:"; +static char Options[] =3D "EGYNnORhjvxyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:S:= o:b:"; =20 match_t MatchType =3D MATCH_GLOB; char *Prefix =3D NULL; @@ -41,6 +41,7 @@ int Dereference =3D FALSE; int PlistOnly =3D FALSE; int Recursive =3D FALSE; +int NoClobber =3D FALSE; #if defined(__FreeBSD_version) && __FreeBSD_version >=3D 500039 enum zipper Zipper =3D BZIP2; #else @@ -192,6 +193,10 @@ Recursive =3D TRUE; break; =20 + case 'n': + NoClobber =3D TRUE; + break; + case '?': default: usage(); @@ -228,7 +233,7 @@ usage() { fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n", -"usage: pkg_create [-YNOhjvyz] [-C conflicts] [-P pkgs] [-p prefix]", +"usage: pkg_create [-YNOhjnvyz] [-C conflicts] [-P pkgs] [-p prefix]", " [-i iscript] [-I piscript] [-k dscript] [-K pdscript]", " [-r rscript] [-s srcdir] [-S basedir]", " [-t template] [-X excludefile]", Index: usr.sbin/pkg_install/create/perform.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/usr.sbin/pkg_install/create/perform.c,v retrieving revision 1.82 diff -u -r1.82 perform.c --- usr.sbin/pkg_install/create/perform.c 7 Jan 2006 22:10:57 -0000 1.82 +++ usr.sbin/pkg_install/create/perform.c 22 May 2008 20:17:37 -0000 @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include #include @@ -336,6 +338,7 @@ static void make_dist(const char *homedir, const char *pkg, const char *suff, Package = *plist) { + struct stat sb; char tball[FILENAME_MAX]; PackingList p; int ret; @@ -355,6 +358,16 @@ else snprintf(tball, FILENAME_MAX, "%s/%s.%s", homedir, pkg, suff); =20 + /* + * If the package tarball exists already, and we are running in `no + * clobber' mode, skip this package. + */ + if (stat(tball, &sb) =3D=3D 0 && NoClobber =3D=3D TRUE) { + if (Verbose) + printf("Skipping package '%s'. It already exists.\n", tball); + return; + } + args[nargs++] =3D "-c"; args[nargs++] =3D "-f"; args[nargs++] =3D tball; Index: usr.sbin/pkg_install/create/pkg_create.1 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/usr.sbin/pkg_install/create/pkg_create.1,v retrieving revision 1.72 diff -u -r1.72 pkg_create.1 --- usr.sbin/pkg_install/create/pkg_create.1 9 Dec 2007 11:01:57 -0000 1.72 +++ usr.sbin/pkg_install/create/pkg_create.1 22 May 2008 20:20:27 -0000 @@ -350,6 +350,24 @@ .It Fl G Use exact matching for .Ar pkg-name . +.It Fl n +Run in +.Dq no clobber +mode. +If a package tarball exists, the +.Nm +utility will not overwrite it. +This is useful, for example, when multiple packages are saved with +several consecutive runs of +.Nm +with the +.Fl Rb +options. +Saving common dependencies multiple times would do a lot of duplicate +work in this case. +The +.Fl n +option avoids repackaging common dependencies multiple times. .El .Sh PACKING LIST DETAILS The %%%