summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2011-11-16 11:41:39 +0000
committerMarc Espie <espie@cvs.openbsd.org>2011-11-16 11:41:39 +0000
commit5d25708d90d1c775fd2c359440762a63ba8c4c4e (patch)
tree7b9ba8a5f5e69a0ca7dfae5e02aa0deccd722bed /usr.sbin/pkg_add
parentb0e808637dd91e51e79cac172cb35079d63f966a (diff)
if the portstree gives us a cache directory, use it.
in lots of multi-packages scenarios that all depend on the main package, this speeds things *a lot*. case in point: in php 5.2, make package goes down from 1mn40 to 53s.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgCreate.pm27
1 files changed, 20 insertions, 7 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
index 425b235bbe7..0792a11fbe7 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgCreate.pm,v 1.52 2011/11/14 12:49:06 espie Exp $
+# $OpenBSD: PkgCreate.pm,v 1.53 2011/11/16 11:41:38 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -632,12 +632,25 @@ sub solve_from_ports
if (defined $cache->{$dep->{pkgpath}}) {
$pkgname = $cache->{$dep->{pkgpath}};
} else {
- my $plist = $self->ask_tree($state, $dep, $portsdir,
- 'print-plist-libs-with-depends', 'wantlib_args=no-wantlib-args');
- if ($? != 0 || !defined $plist->pkgname) {
- $state->error("Can't obtain dependency #1 from ports tree",
- $dep->{pattern});
- return undef;
+ my ($plist, $diskcache);
+ if ($ENV{_DEPENDS_CACHE}) {
+ $diskcache = $dep->{pkgpath};
+ $diskcache =~ s/\//--/g;
+ $diskcache = $ENV{_DEPENDS_CACHE}."/pkgcreate-".
+ $diskcache;
+ }
+ if (defined $diskcache && -f $diskcache) {
+ $plist = OpenBSD::PackingList->fromfile($diskcache);
+ } else {
+ $plist = $self->ask_tree($state, $dep, $portsdir,
+ 'print-plist-libs-with-depends',
+ 'wantlib_args=no-wantlib-args');
+ if ($? != 0 || !defined $plist->pkgname) {
+ $state->error("Can't obtain dependency #1 from ports tree",
+ $dep->{pattern});
+ return undef;
+ }
+ $plist->tofile($diskcache) if defined $diskcache;
}
OpenBSD::SharedLibs::add_libs_from_plist($plist, $state);
$self->add_dep($plist);