pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install - only build pkg_admin, pkg_creat...
details: https://anonhg.NetBSD.org/pkgsrc/rev/ceff1b368b42
branches: trunk
changeset: 531633:ceff1b368b42
user: joerg <joerg%pkgsrc.org@localhost>
date: Fri Aug 03 13:15:58 2007 +0000
description:
- only build pkg_admin, pkg_create and pkg_info for --enable-bootstrap
- for pkg_create, split-off the package creation from the plist
processing. package creation is disabled for --enable-bootstrap
- change package creation to use libarchive
- add two options (-u and -g) to override file system ownership
- pkg_create now creates files in the tarball with correct owner/group
based on -u/-g or @owner/@group
- add a function to compute the +CONTENTS file in memory
Bump version to 20070802.
Review of a slightly older version by jlam@
diffstat:
pkgtools/pkg_install/Makefile | 55 +++-
pkgtools/pkg_install/files/Makefile.in | 8 +-
pkgtools/pkg_install/files/configure | 19 +-
pkgtools/pkg_install/files/configure.ac | 6 +
pkgtools/pkg_install/files/create/Makefile.in | 19 +-
pkgtools/pkg_install/files/create/build.c | 387 ++++++++++++++++++++++
pkgtools/pkg_install/files/create/create.h | 28 +-
pkgtools/pkg_install/files/create/main.c | 39 +-
pkgtools/pkg_install/files/create/perform.c | 283 ++-------------
pkgtools/pkg_install/files/create/pkg_create.1 | 14 +-
pkgtools/pkg_install/files/create/pkg_create.cat1 | 16 +-
pkgtools/pkg_install/files/create/pl.c | 30 +-
pkgtools/pkg_install/files/create/util.c | 147 ++++++++
pkgtools/pkg_install/files/lib/lib.h | 3 +-
pkgtools/pkg_install/files/lib/plist.c | 79 ++++-
pkgtools/pkg_install/files/lib/version.h | 4 +-
16 files changed, 842 insertions(+), 295 deletions(-)
diffs (truncated from 1554 to 300 lines):
diff -r 9b3112cbc4e4 -r ceff1b368b42 pkgtools/pkg_install/Makefile
--- a/pkgtools/pkg_install/Makefile Fri Aug 03 12:55:52 2007 +0000
+++ b/pkgtools/pkg_install/Makefile Fri Aug 03 13:15:58 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.136 2007/07/29 17:39:31 seb Exp $
+# $NetBSD: Makefile,v 1.137 2007/08/03 13:15:58 joerg Exp $
# Notes to package maintainers:
#
@@ -86,8 +86,61 @@
SUBST_FILES.paths= audit-packages/Makefile.in
SUBST_SED.paths= -e 's,_gzcat_,${GZCAT},g'
+.include "../../archivers/bzip2/builtin.mk"
+.include "../../archivers/libarchive/builtin.mk"
+.include "../../devel/zlib/builtin.mk"
+
+USE_BUILTIN.bzip2= no
+USE_BUILTIN.zlib= no
+
+.if empty(USE_BUILTIN.bzip2:M[yY][eE][sS]) || \
+ empty(USE_BUILTIN.zlib:M[yY][eE][sS])
+USE_BUILTIN.libarchive= no
+.endif
+
+FILESDIR.bzip2?= ${.CURDIR}/../../archivers/bzip2/files
+FILESDIR.libarchive?= ${.CURDIR}/../../archivers/libarchive/files
+FILESDIR.zlib?= ${.CURDIR}/../../devel/zlib/files
+
+.if empty(USE_BUILTIN.bzip2:M[yY][eE][sS])
+CPPFLAGS+= -I${WRKDIR}/bzip2
+LDFLAGS+= -L${WRKDIR}/bzip2
+.endif
+.if empty(USE_BUILTIN.zlib:M[yY][eE][sS])
+CPPFLAGS+= -I${WRKDIR}/zlib
+LDFLAGS+= -L${WRKDIR}/zlib
+.endif
+.if empty(USE_BUILTIN.libarchive:M[yY][eE][sS])
+CPPFLAGS+= -I${WRKDIR}/libarchive/libarchive
+LDFLAGS+= -L${WRKDIR}/libarchive/.libs
+.endif
+
do-extract:
@${CP} -R ${FILESDIR} ${WRKSRC}
+.if empty(USE_BUILTIN.bzip2:M[yY][eE][sS])
+ @${CP} -R ${FILESDIR.bzip2} ${WRKDIR}/bzip2
+.endif
+.if empty(USE_BUILTIN.zlib:M[yY][eE][sS])
+ @${CP} -R ${FILESDIR.zlib} ${WRKDIR}/zlib
+.endif
+.if empty(USE_BUILTIN.libarchive:M[yY][eE][sS])
+ @${CP} -R ${FILESDIR.libarchive} ${WRKDIR}/libarchive
+.endif
+
+pre-configure:
+.if empty(USE_BUILTIN.bzip2:M[yY][eE][sS])
+ cd ${WRKDIR}/bzip2 && ${BUILD_MAKE_CMD} libbz2.a
+.endif
+.if empty(USE_BUILTIN.zlib:M[yY][eE][sS])
+ cd ${WRKDIR}/zlib && ${BUILD_MAKE_CMD} libz.a
+.endif
+.if empty(USE_BUILTIN.libarchive:M[yY][eE][sS])
+ cd ${WRKDIR}/libarchive && \
+ ${SETENV} ${_CONFIGURE_SCRIPT_ENV} \
+ ${CONFIG_SHELL} ${CONFIG_SHELL_FLAGS} \
+ ./configure --disable-shared --disable-bsdtar
+ cd ${WRKDIR}/libarchive && ${BUILD_MAKE_CMD}
+.endif
# XXX Reverse the order that update does things since
# XXX we need pkg_delete built before we can deinstall.
diff -r 9b3112cbc4e4 -r ceff1b368b42 pkgtools/pkg_install/files/Makefile.in
--- a/pkgtools/pkg_install/files/Makefile.in Fri Aug 03 12:55:52 2007 +0000
+++ b/pkgtools/pkg_install/files/Makefile.in Fri Aug 03 13:15:58 2007 +0000
@@ -1,6 +1,12 @@
-# $NetBSD: Makefile.in,v 1.7 2007/07/14 20:17:06 adrianp Exp $
+# $NetBSD: Makefile.in,v 1.8 2007/08/03 13:15:58 joerg Exp $
+
+BOOTSTRAP= @bootstrap@
+.if empty(BOOTSTRAP)
SUBDIRS= lib add admin create delete info view audit-packages
+.else
+SUBDIRS= lib admin create info
+.endif
all:
@for dir in $(SUBDIRS); do \
diff -r 9b3112cbc4e4 -r ceff1b368b42 pkgtools/pkg_install/files/configure
--- a/pkgtools/pkg_install/files/configure Fri Aug 03 12:55:52 2007 +0000
+++ b/pkgtools/pkg_install/files/configure Fri Aug 03 13:15:58 2007 +0000
@@ -695,6 +695,7 @@
ftp
tar
pax
+bootstrap
CPP
EGREP
LIBOBJS
@@ -1280,6 +1281,11 @@
esac
cat <<\_ACEOF
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-bootstrap build minimal version of pkg_install
+
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
@@ -3592,6 +3598,16 @@
+# Check whether --enable-bootstrap was given.
+if test "${enable_bootstrap+set}" = set; then
+ enableval=$enable_bootstrap; bootstrap=yes
+else
+ bootstrap=
+fi
+
+
+
+
{ echo "$as_me:$LINENO: checking for __db185_open in -ldb" >&5
echo $ECHO_N "checking for __db185_open in -ldb... $ECHO_C" >&6; }
@@ -7498,13 +7514,14 @@
ftp!$ftp$ac_delim
tar!$tar$ac_delim
pax!$pax$ac_delim
+bootstrap!$bootstrap$ac_delim
CPP!$CPP$ac_delim
EGREP!$EGREP$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 84; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 85; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff -r 9b3112cbc4e4 -r ceff1b368b42 pkgtools/pkg_install/files/configure.ac
--- a/pkgtools/pkg_install/files/configure.ac Fri Aug 03 12:55:52 2007 +0000
+++ b/pkgtools/pkg_install/files/configure.ac Fri Aug 03 13:15:58 2007 +0000
@@ -61,6 +61,12 @@
[ pax='$(prefix)/bin/pax' ])
AC_SUBST(pax)
+AC_ARG_ENABLE([bootstrap],
+ [AS_HELP_STRING([--enable-bootstrap], [build minimal version of pkg_install])],
+ [bootstrap=yes], [bootstrap=])
+
+AC_SUBST(bootstrap)
+
dnl Checks for libraries.
AC_CHECK_LIB(db, __db185_open, , AC_SEARCH_LIBS(dbopen, [db db1]))
AC_SEARCH_LIBS(tgetent, [termcap termlib curses ncurses])
diff -r 9b3112cbc4e4 -r ceff1b368b42 pkgtools/pkg_install/files/create/Makefile.in
--- a/pkgtools/pkg_install/files/create/Makefile.in Fri Aug 03 12:55:52 2007 +0000
+++ b/pkgtools/pkg_install/files/create/Makefile.in Fri Aug 03 13:15:58 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.in,v 1.13 2007/07/16 09:57:58 joerg Exp $
+# $NetBSD: Makefile.in,v 1.14 2007/08/03 13:15:59 joerg Exp $
srcdir= @srcdir@
@@ -10,14 +10,11 @@
man1dir= $(mandir)/man1
cat1dir= $(mandir)/cat1
-tar= @tar@
-pax= @pax@
+BOOTSTRAP= @bootstrap@
CC= @CC@
CCLD= $(CC)
-LIBS= -linstall @LIBS@
-CPPFLAGS= @CPPFLAGS@ -I. -I$(srcdir) -I../lib
-DEFS= @DEFS@ -DTAR_CMD=\"$(tar)\" -DPAX_CMD=\"$(pax)\"
+DEFS= @DEFS@
CFLAGS= @CFLAGS@
LDFLAGS= @LDFLAGS@ -L../lib
@@ -25,7 +22,15 @@
PROG= pkg_create
-OBJS= main.o perform.o pl.o
+.if empty(BOOTSTRAP)
+LIBS= -linstall -larchive -lbz2 -lz @LIBS@
+CPPFLAGS= @CPPFLAGS@ -I. -I$(srcdir) -I../lib
+OBJS= main.o perform.o pl.o util.o build.o
+.else
+LIBS= -linstall @LIBS@
+CPPFLAGS= @CPPFLAGS@ -I. -I$(srcdir) -I../lib -DBOOTSTRAP
+OBJS= main.o perform.o pl.o util.o
+.endif
all: $(PROG)
diff -r 9b3112cbc4e4 -r ceff1b368b42 pkgtools/pkg_install/files/create/build.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/pkg_install/files/create/build.c Fri Aug 03 13:15:58 2007 +0000
@@ -0,0 +1,387 @@
+/* $NetBSD: build.c,v 1.1 2007/08/03 13:15:59 joerg Exp $ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <nbcompat.h>
+#if HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#endif
+#ifndef lint
+#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: build.c,v 1.1 2007/08/03 13:15:59 joerg Exp $");
+#endif
+#endif
+
+/*
+ * FreeBSD install - a package for the installation and maintainance
+ * of non-core utilities.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Jordan K. Hubbard
+ * 18 July 1993
+ *
+ * This is the main body of the create module.
+ *
+ */
+
+#include "lib.h"
+#include "create.h"
+
+#if HAVE_ERR_H
+#include <err.h>
+#endif
+#if HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <pwd.h>
+#include <grp.h>
+
+#include <archive.h>
+#include <archive_entry.h>
+
+static struct memory_file *contents_file;
+static struct memory_file *comment_file;
+static struct memory_file *desc_file;
+static struct memory_file *install_file;
+static struct memory_file *deinstall_file;
+static struct memory_file *display_file;
+static struct memory_file *build_version_file;
+static struct memory_file *build_info_file;
+static struct memory_file *size_pkg_file;
+static struct memory_file *size_all_file;
+static struct memory_file *preserve_file;
+static struct memory_file *views_file;
+
+static void
+write_meta_file(struct memory_file *file, struct archive *archive)
+{
+ struct archive_entry *entry;
+
+ entry = archive_entry_new();
+ archive_entry_set_pathname(entry, file->name);
+ archive_entry_copy_stat(entry, &file->st);
+
+ archive_entry_set_uname(entry, file->owner);
+ archive_entry_set_gname(entry, file->group);
+
+ if (archive_write_header(archive, entry))
+ errx(2, "cannot write to archive: %s", archive_error_string(archive));
+
+ archive_write_data(archive, file->data, file->len);
+
+ archive_entry_free(entry);
+}
+
+LIST_HEAD(hardlink_list, hardlinked_entry);
+struct hardlink_list written_hardlinks;
+
+struct hardlinked_entry {
Home |
Main Index |
Thread Index |
Old Index