Asus eee
Giorgos Keramidas
keramida at ceid.upatras.gr
Thu May 22 21:28:32 UTC 2008
On Thu, 22 May 2008 09:17:27 +0200, Matthias Apitz <matthias.apitz at oclc.org> wrote:
> El día Thursday, May 22, 2008 a las 09:18:33AM +0300, Giorgos Keramidas escribió:
>> 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
===================================================================
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;
enum zipper {NONE, GZIP, BZIP, BZIP2 };
extern enum zipper Zipper;
Index: usr.sbin/pkg_install/create/main.c
===================================================================
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"
-static char Options[] = "EGYNORhjvxyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:S:o:b:";
+static char Options[] = "EGYNnORhjvxyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:S:o:b:";
match_t MatchType = MATCH_GLOB;
char *Prefix = NULL;
@@ -41,6 +41,7 @@
int Dereference = FALSE;
int PlistOnly = FALSE;
int Recursive = FALSE;
+int NoClobber = FALSE;
#if defined(__FreeBSD_version) && __FreeBSD_version >= 500039
enum zipper Zipper = BZIP2;
#else
@@ -192,6 +193,10 @@
Recursive = TRUE;
break;
+ case 'n':
+ NoClobber = 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
===================================================================
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 <libgen.h>
#include <signal.h>
#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <sys/syslimits.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -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);
+ /*
+ * If the package tarball exists already, and we are running in `no
+ * clobber' mode, skip this package.
+ */
+ if (stat(tball, &sb) == 0 && NoClobber == TRUE) {
+ if (Verbose)
+ printf("Skipping package '%s'. It already exists.\n", tball);
+ return;
+ }
+
args[nargs++] = "-c";
args[nargs++] = "-f";
args[nargs++] = tball;
Index: usr.sbin/pkg_install/create/pkg_create.1
===================================================================
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
%%%
More information about the freebsd-questions
mailing list