summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2007-07-30 07:25:10 +0000
committerjoerg <joerg@pkgsrc.org>2007-07-30 07:25:10 +0000
commitd3a02b798c4548b252e810e13828d19463b1b613 (patch)
treeef2af6de51183828f5dd1adb8d55cecb61159cf8
parentba250884a3d362c5f0f862ed96d3ed4dbcab49ee (diff)
downloadpkgsrc-d3a02b798c4548b252e810e13828d19463b1b613.tar.gz
Don't build a list for a single item, but change the pkg_perform
interface to hand it down directly.
-rw-r--r--pkgtools/pkg_install/files/create/create.h4
-rw-r--r--pkgtools/pkg_install/files/create/main.c31
-rw-r--r--pkgtools/pkg_install/files/create/perform.c11
3 files changed, 15 insertions, 31 deletions
diff --git a/pkgtools/pkg_install/files/create/create.h b/pkgtools/pkg_install/files/create/create.h
index dee4a9e3548..f7c6b835f98 100644
--- a/pkgtools/pkg_install/files/create/create.h
+++ b/pkgtools/pkg_install/files/create/create.h
@@ -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 @@ extern int create_views;
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 --git a/pkgtools/pkg_install/files/create/main.c b/pkgtools/pkg_install/files/create/main.c
index 84156429022..d2b61665b0a 100644
--- a/pkgtools/pkg_install/files/create/main.c
+++ b/pkgtools/pkg_install/files/create/main.c
@@ -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 @@ int
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 @@ main(int argc, char **argv)
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 --git a/pkgtools/pkg_install/files/create/perform.c b/pkgtools/pkg_install/files/create/perform.c
index e5f9abcb216..f083ffb959f 100644
--- a/pkgtools/pkg_install/files/create/perform.c
+++ b/pkgtools/pkg_install/files/create/perform.c
@@ -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 @@ cleanup(int sig)
}
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)