pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/create Don't build a list f...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4e9261a35c8d
branches:  trunk
changeset: 531420:4e9261a35c8d
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Mon Jul 30 07:25:10 2007 +0000

description:
Don't build a list for a single item, but change the pkg_perform
interface to hand it down directly.

diffstat:

 pkgtools/pkg_install/files/create/create.h  |   4 +-
 pkgtools/pkg_install/files/create/main.c    |  31 +++++++++-------------------
 pkgtools/pkg_install/files/create/perform.c |  11 ++-------
 3 files changed, 15 insertions(+), 31 deletions(-)

diffs (117 lines):

diff -r 9ec28502cd8b -r 4e9261a35c8d pkgtools/pkg_install/files/create/create.h
--- a/pkgtools/pkg_install/files/create/create.h        Mon Jul 30 07:16:21 2007 +0000
+++ b/pkgtools/pkg_install/files/create/create.h        Mon Jul 30 07:25:10 2007 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: create.h,v 1.7 2007/07/30 07:16:21 joerg Exp $ */
+/* $NetBSD: create.h,v 1.8 2007/07/30 07:25:10 joerg Exp $ */
 
 /* from FreeBSD Id: create.h,v 1.13 1997/10/08 07:46:19 charnier Exp */
 
@@ -53,6 +53,6 @@
 void    check_list(char *, package_t *, const char *);
 void    copy_plist(char *, package_t *);
 
-int     pkg_perform(lpkg_head_t *);
+int     pkg_perform(const char *);
 
 #endif                         /* _INST_CREATE_H_INCLUDE */
diff -r 9ec28502cd8b -r 4e9261a35c8d pkgtools/pkg_install/files/create/main.c
--- a/pkgtools/pkg_install/files/create/main.c  Mon Jul 30 07:16:21 2007 +0000
+++ b/pkgtools/pkg_install/files/create/main.c  Mon Jul 30 07:25:10 2007 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.9 2007/07/25 15:01:46 joerg Exp $   */
+/*     $NetBSD: main.c,v 1.10 2007/07/30 07:25:11 joerg Exp $  */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -11,7 +11,7 @@
 #if 0
 static const char *rcsid = "from FreeBSD Id: main.c,v 1.17 1997/10/08 07:46:23 charnier Exp";
 #else
-__RCSID("$NetBSD: main.c,v 1.9 2007/07/25 15:01:46 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.10 2007/07/30 07:25:11 joerg Exp $");
 #endif
 #endif
 
@@ -78,8 +78,6 @@
 main(int argc, char **argv)
 {
        int     ch;
-       lpkg_head_t pkgs;
-       lpkg_t *lpp;
 
        setprogname(argv[0]);
        while ((ch = getopt(argc, argv, Options)) != -1)
@@ -197,25 +195,16 @@
        argc -= optind;
        argv += optind;
 
-       TAILQ_INIT(&pkgs);
-
-       /* Get all the remaining package names, if any */
-       while (*argv) {
-               lpp = alloc_lpkg(*argv);
-               TAILQ_INSERT_TAIL(&pkgs, lpp, lp_link);
-               argv++;
+       if (argc == 0) {
+               warnx("missing package name");
+               usage();
+       }
+       if (argc != 1) {
+               warnx("only one package name allowed");
+               usage();
        }
 
-       /* If no packages, yelp */
-       lpp = TAILQ_FIRST(&pkgs);
-       if (lpp == NULL)
-               warnx("missing package name"), usage();
-       lpp = TAILQ_NEXT(lpp, lp_link);
-       if (lpp != NULL)
-               warnx("only one package name allowed ('%s' extraneous)",
-                   lpp->lp_name),
-                   usage();
-       if (!pkg_perform(&pkgs)) {
+       if (!pkg_perform(*argv)) {
                if (Verbose)
                        warnx("package creation failed");
                return 1;
diff -r 9ec28502cd8b -r 4e9261a35c8d pkgtools/pkg_install/files/create/perform.c
--- a/pkgtools/pkg_install/files/create/perform.c       Mon Jul 30 07:16:21 2007 +0000
+++ b/pkgtools/pkg_install/files/create/perform.c       Mon Jul 30 07:25:10 2007 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.13 2007/07/25 15:01:46 joerg Exp $       */
+/*     $NetBSD: perform.c,v 1.14 2007/07/30 07:25:11 joerg Exp $       */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -11,7 +11,7 @@
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.38 1997/10/13 15:03:51 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.13 2007/07/25 15:01:46 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.14 2007/07/30 07:25:11 joerg Exp $");
 #endif
 #endif
 
@@ -198,19 +198,14 @@
 }
 
 int
-pkg_perform(lpkg_head_t *pkgs)
+pkg_perform(const char *pkg)
 {
-       const char *pkg;
        char   *cp;
        FILE   *pkg_in, *fp;
        package_t plist;
        char   *suffix;         /* What we tack on to the end of the finished package */
-       lpkg_t *lpp;
        char    installed[MaxPathSize];
 
-       lpp = TAILQ_FIRST(pkgs);
-       pkg = lpp->lp_name;     /* Only one arg to create */
-
        /* Preliminary setup */
        sanity_check();
        if (Verbose && !PlistOnly)



Home | Main Index | Thread Index | Old Index