tech-pkg archive

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

DESTDIR-enabled bootstrap + disabling USE_DESTDIR=no



Hello all,
attached is a patch that switches bootstrap to use the normal
USE_DESTDIR=yes handling. It also bails out explicitly when later using
USE_DESTDIR=no. This is the last step before cleaning out the
infrastructure.

Joerg
Index: bootstrap/bootstrap
==================================================================
--- bootstrap/bootstrap
+++ bootstrap/bootstrap
@@ -1183,20 +1183,31 @@
 	;;
 esac
 
 # bootstrap pkg_install
 echo_msg "Bootstrapping pkgtools"
+copy_src $pkgsrcdir/archivers/libarchive/files libarchive
+run_cmd "(cd $wrkdir/libarchive; env $BSTRAP_ENV \
+$shprog ./configure $configure_quiet_flags --enable-static --disable-shared \
+--disable-bsdtar --disable-bsdcpio --disable-posix-regex-lib --disable-xattr \
+--disable-acl --without-zlib --without-bz2lib --without-lzmadec \
+--without-iconv --without-lzma --without-lzo2 --without-nettle \
+--without-openssl --without-xml2 --without-expat && $bmake -j$make_jobs)"
 copy_src $pkgsrcdir/pkgtools/pkg_install/files pkg_install
 run_cmd "(cd $wrkdir/pkg_install; env $BSTRAP_ENV \
 CPPFLAGS='$CPPFLAGS -I../libnbcompat -I../../libnbcompat' \
 LDFLAGS='$LDFLAGS -L../libnbcompat -L../../libnbcompat' \
 LIBS='$LIBS -lnbcompat' $shprog ./configure $configure_quiet_flags -C \
 --enable-bootstrap --prefix=$prefix --sysconfdir=$sysconfdir \
---with-pkgdbdir=$pkgdbdir --infodir=$infodir --mandir=$mandir $pkg_install_args && $bmake -j$make_jobs)"
+--with-pkgdbdir=$pkgdbdir --infodir=$infodir --mandir=$mandir $pkg_install_args && \
+STATIC_LIBARCHIVE=$wrkdir/libarchive/.libs/libarchive.a \
+PKGSRC_MACHINE_ARCH="$machine_arch" $bmake -j$make_jobs)"
+run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/pkg_install/add/pkg_add $wrkdir/sbin/pkg_add"
 run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/pkg_install/admin/pkg_admin $wrkdir/sbin/pkg_admin"
 run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/pkg_install/create/pkg_create $wrkdir/sbin/pkg_create"
 run_cmd "$install_sh -c -o $user -g $group -m 755 $wrkdir/pkg_install/info/pkg_info $wrkdir/sbin/pkg_info"
+echo "PKG_ADD_CMD?=			$wrkdir/sbin/pkg_add" >> ${BOOTSTRAP_MKCONF}
 echo "PKG_ADMIN_CMD?=			$wrkdir/sbin/pkg_admin" >> ${BOOTSTRAP_MKCONF}
 echo "PKG_CREATE_CMD?=			$wrkdir/sbin/pkg_create" >> ${BOOTSTRAP_MKCONF}
 echo "PKG_INFO_CMD?=			$wrkdir/sbin/pkg_info" >> ${BOOTSTRAP_MKCONF}
 
 MAKECONF=$wrkdir/mk.conf
@@ -1266,11 +1277,11 @@
 echo ".endif			# end pkgsrc settings" >> ${BOOTSTRAP_MKCONF}
 
 # build and register packages
 # usage: build_package <packagedirectory> [additional arguments]
 build_package() {
-	run_cmd "(cd $pkgsrcdir/$1 && $bmake MAKE_JOBS=${make_jobs} USE_DESTDIR=no -DPKG_PRESERVE MAKECONF=${BOOTSTRAP_MKCONF} install)"
+	run_cmd "(cd $pkgsrcdir/$1 && $bmake MAKE_JOBS=${make_jobs} USE_DESTDIR=yes -DPKG_PRESERVE MAKECONF=${BOOTSTRAP_MKCONF} install)"
 }
 
 #
 # Please make sure that the following packages and
 # only the following packages set BOOTSTRAP_PKG=yes.

Index: mk/bsd.prefs.mk
==================================================================
--- mk/bsd.prefs.mk
+++ mk/bsd.prefs.mk
@@ -534,10 +534,11 @@
 _MAKE_PACKAGE_AS_ROOT=	no
 _MAKE_CLEAN_AS_ROOT=	no
 _MAKE_INSTALL_AS_ROOT=	no
 .  endif
 .else
+PKG_FAIL_REASON+=	"USE_DESTDIR=no is no longer supported."
 DESTDIR=
 .endif
 
 # controls whether binary packages are preserved in pkgsrc/packages/All
 # default is no (to preserve settings since 2013/05/23, prior to that it

Index: pkgtools/pkg_install/files/Makefile.in
==================================================================
--- pkgtools/pkg_install/files/Makefile.in
+++ pkgtools/pkg_install/files/Makefile.in
@@ -3,11 +3,11 @@
 BOOTSTRAP=	@bootstrap@
 
 .if empty(BOOTSTRAP)
 SUBDIRS=	lib add admin create delete info
 .else
-SUBDIRS=	lib admin create info
+SUBDIRS=	lib add admin create info
 .endif
 
 all:
 	@for dir in $(SUBDIRS); do \
 		( cd $$dir && $(MAKE) $@ ) || exit 1; \

Index: pkgtools/pkg_install/files/add/Makefile.in
==================================================================
--- pkgtools/pkg_install/files/add/Makefile.in
+++ pkgtools/pkg_install/files/add/Makefile.in
@@ -16,17 +16,24 @@
 CPPFLAGS=	@CPPFLAGS@ -I. -I$(srcdir) -I../lib
 DEFS=		@DEFS@ -DOPSYS_NAME=\"$(OPSYS)\" -DPKGSRC_MACHINE_ARCH=\"$(PKGSRC_MACHINE_ARCH)\" -DBINDIR=\"$(sbindir)\"
 CFLAGS=		@CFLAGS@
 LDFLAGS=	@LDFLAGS@ -L../lib
 
+BOOTSTRAP=	@bootstrap@
 SSL_SUPPORT=	@ssl_support@
 
+.if empty(BOOTSTRAP)
 LIBS=		-linstall -lnetpgpverify -larchive -lbz2 -lz -lfetch
 .if !empty(SSL_SUPPORT)
 LIBS+=		-lssl -lcrypto
+CPPFLAGS+=	-DHAVE_SSL
 .endif
 LIBS+=		@LIBS@
+.else
+LIBS=		-linstall ${STATIC_LIBARCHIVE} @LIBS@
+CPPFLAGS+=	-DBOOTSTRAP
+.endif
 
 INSTALL=	@INSTALL@
 
 PROG=		pkg_add
 

Index: pkgtools/pkg_install/files/add/main.c
==================================================================
--- pkgtools/pkg_install/files/add/main.c
+++ pkgtools/pkg_install/files/add/main.c
@@ -157,19 +157,23 @@
 		pkgdbdir = xasprintf("%s/%s", Destdir, config_pkg_dbdir);
 		pkgdb_set_dir(pkgdbdir, 4);
 		free(pkgdbdir);
 	}
 
+#ifndef BOOTSTRAP
 	process_pkg_path();
+#endif
+
 	TAILQ_INIT(&pkgs);
 
 	if (argc == 0) {
 		/* If no packages, yelp */
 		warnx("missing package name(s)");
 		usage();
 	}
 
+#ifndef BOOTSTRAP
 	if (strcasecmp(do_license_check, "no") == 0)
 		LicenseCheck = 0;
 	else if (strcasecmp(do_license_check, "yes") == 0)
 		LicenseCheck = 1;
 	else if (strcasecmp(do_license_check, "always") == 0)
@@ -178,10 +182,11 @@
 		errx(1, "Unknown value of the configuration variable"
 		    "CHECK_LICENSE");
 
 	if (LicenseCheck)
 		load_license_lists();
+#endif
 
 	/* Get all the remaining package names, if any */
 	for (; argc > 0; --argc, ++argv) {
 		lpkg_t *lpp;
 

Index: pkgtools/pkg_install/files/add/perform.c
==================================================================
--- pkgtools/pkg_install/files/add/perform.c
+++ pkgtools/pkg_install/files/add/perform.c
@@ -1244,10 +1244,13 @@
 }
 
 static int
 check_signature(struct pkg_task *pkg, int invalid_sig)
 {
+#ifdef BOOTSTRAP
+	return 0;
+#else
 	char *line;
 	size_t len;
 
 	if (strcasecmp(verified_installation, "never") == 0)
 		return 0;
@@ -1280,15 +1283,19 @@
 		}
 		return 0;
 	}
 	warnx("Unknown value of configuration variable VERIFIED_INSTALLATION");
 	return 1;
+#endif
 }
 
 static int
 check_vulnerable(struct pkg_task *pkg)
 {
+#ifdef BOOTSTRAP
+	return 0;
+#else
 	static struct pkg_vulnerabilities *pv;
 	int require_check;
 	char *line;
 	size_t len;
 
@@ -1323,15 +1330,19 @@
 	if (check_input(line, len)) {
 		fprintf(stderr, "Cancelling installation\n");
 		return 1;
 	}
 	return 0;
+#endif
 }
 
 static int
 check_license(struct pkg_task *pkg)
 {
+#ifdef BOOTSTRAP
+	return 0;
+#else
 	if (LicenseCheck == 0)
 		return 0;
 
 	if ((pkg->buildinfo[BI_LICENSE] == NULL ||
 	     *pkg->buildinfo[BI_LICENSE] == '\0')) {
@@ -1351,35 +1362,49 @@
 		return 0;
 	default:
 		warnx("Invalid LICENSE for package `%s'", pkg->pkgname);
 		return 1;
 	}
+#endif
 }
 
 /*
  * Install a single package.
  */
 static int
 pkg_do(const char *pkgpath, int mark_automatic, int top_level)
 {
+#ifndef BOOTSTRAP
 	char *archive_name;
+#endif
 	int status, invalid_sig;
 	struct pkg_task *pkg;
 
 	pkg = xcalloc(1, sizeof(*pkg));
 
 	status = -1;
 
+#ifdef BOOTSTRAP
+	pkg->archive = archive_read_new();
+	archive_read_support_compression_all(pkg->archive);
+	archive_read_support_format_all(pkg->archive);
+	if (archive_read_open_filename(pkg->archive, pkgpath, 1024)) {
+		warnx("no pkg found for '%s', sorry.", pkgpath);
+		archive_read_free(pkg->archive);
+		goto clean_find_archive;
+	}
+#else
 	pkg->archive = find_archive(pkgpath, top_level, &archive_name);
 	if (pkg->archive == NULL) {
 		warnx("no pkg found for '%s', sorry.", pkgpath);
 		goto clean_find_archive;
 	}
 
 	invalid_sig = pkg_verify_signature(archive_name, &pkg->archive, &pkg->entry,
 	    &pkg->pkgname);
 	free(archive_name);
+#endif
 
 	if (pkg->archive == NULL)
 		goto clean_memory;
 
 	if (read_meta_data(pkg))

Index: pkgtools/pkg_install/files/admin/Makefile.in
==================================================================
--- pkgtools/pkg_install/files/admin/Makefile.in
+++ pkgtools/pkg_install/files/admin/Makefile.in
@@ -25,23 +25,24 @@
 INSTALL=	@INSTALL@
 
 PROG=		pkg_admin
 SCRIPTS=	audit-packages download-vulnerability-list
 
+CPPFLAGS=	@CPPFLAGS@ -I. -I$(srcdir) -I../lib
+
 .if empty(BOOTSTRAP)
 LIBS=		-linstall -lnetpgpverify -larchive -lbz2 -lz -lfetch
 .if !empty(SSL_SUPPORT)
 LIBS+=		-lssl -lcrypto
-CFLAGS+=	-DHAVE_SSL
+CPPFLAGS+=	-DHAVE_SSL
 .endif
 LIBS+=		@LIBS@
 OBJS=		audit.o check.o main.o
-CPPFLAGS=	@CPPFLAGS@ -I. -I$(srcdir) -I../lib
 .else
 LIBS=		-linstall @LIBS@
 OBJS=		check.o main.o
-CPPFLAGS=	@CPPFLAGS@ -I. -I$(srcdir) -I../lib -DBOOTSTRAP
+CPPFLAGS+=	-DBOOTSTRAP
 .endif
 
 all: $(PROG) $(SCRIPTS)
 
 .c.o:

Index: pkgtools/pkg_install/files/create/Makefile.in
==================================================================
--- pkgtools/pkg_install/files/create/Makefile.in
+++ pkgtools/pkg_install/files/create/Makefile.in
@@ -22,23 +22,23 @@
 INSTALL=	@INSTALL@
 
 PROG=		pkg_create
 
 SSL_SUPPORT=	@ssl_support@
+CPPFLAGS=	@CPPFLAGS@ -I. -I$(srcdir) -I../lib
 
 .if empty(BOOTSTRAP)
 LIBS=		-linstall -lnetpgpverify -larchive -lbz2 -lz -lfetch @LIBS@
 .if !empty(SSL_SUPPORT)
 LIBS+=		-lssl -lcrypto
 .endif
-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
+LIBS=		-linstall ${STATIC_LIBARCHIVE} @LIBS@
+CPPFLAGS+=	-DBOOTSTRAP
 .endif
+
+OBJS=		main.o perform.o pl.o util.o build.o
 
 all: $(PROG)
 
 .c.o:
 	$(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c $<

Index: pkgtools/pkg_install/files/create/perform.c
==================================================================
--- pkgtools/pkg_install/files/create/perform.c
+++ pkgtools/pkg_install/files/create/perform.c
@@ -223,16 +223,11 @@
          */
 	if (PlistOnly) {
 		write_plist(&plist, stdout, realprefix);
 		retval = TRUE;
 	} else {
-#ifdef BOOTSTRAP
-		warnx("Package building is not supported in bootstrap mode");
-		retval = FALSE;
-#else
 		retval = pkg_build(pkg, full_pkg, suffix, &plist);
-#endif
 	}
 
 	/* Cleanup */
 	free(Comment);
 	free(Desc);

Index: pkgtools/pkg_install/files/info/Makefile.in
==================================================================
--- pkgtools/pkg_install/files/info/Makefile.in
+++ pkgtools/pkg_install/files/info/Makefile.in
@@ -14,23 +14,24 @@
 BOOTSTRAP=	@bootstrap@
 SSL_SUPPORT=	@ssl_support@
 
 CC=		@CC@
 CCLD=		$(CC)
+CPPFLAGS=	@CPPFLAGS@ -I. -I$(srcdir) -I../lib
+DEFS=		@DEFS@
+CFLAGS=		@CFLAGS@
+LDFLAGS=	@LDFLAGS@ -L../lib
+
 .if empty(BOOTSTRAP)
 LIBS=		-linstall -lnetpgpverify -larchive -lbz2 -lz -lfetch @LIBS@
 .if !empty(SSL_SUPPORT)
 LIBS+=		-lssl -lcrypto
 .endif
-CPPFLAGS=	@CPPFLAGS@ -I. -I$(srcdir) -I../lib
 .else
 LIBS=		-linstall @LIBS@
-CPPFLAGS=	@CPPFLAGS@ -I. -I$(srcdir) -I../lib -DBOOTSTRAP
+CPPFLAGS+=	-DBOOTSTRAP
 .endif
-DEFS=		@DEFS@
-CFLAGS=		@CFLAGS@
-LDFLAGS=	@LDFLAGS@ -L../lib
 
 INSTALL=	@INSTALL@
 
 PROG=		pkg_info
 



Home | Main Index | Thread Index | Old Index