Smarter plist regen.

- back substitute VAR_SUBST (hence swap ARCH/MACHINE_ARCH)
- pass PKGDIR to make-plist.

- don't create PLIST-auto/PFRAG.shared-auto. Move originals around, and
create new ones directly (guard against accidentally deleting old ones).

Todo: add regexp to dispatch stuff to fragments automatically, based on
MULTI_PACKAGES.
This commit is contained in:
espie 2001-05-23 14:18:24 +00:00
parent 3f025d2169
commit d19ed8bd90
2 changed files with 34 additions and 8 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl -w
# $OpenBSD: make-plist,v 1.11 2001/05/07 15:25:44 espie Exp $
# $OpenBSD: make-plist,v 1.12 2001/05/23 14:18:25 espie Exp $
# Copyright (c) 1999 Marc Espie
#
@ -38,17 +38,34 @@ use strict;
use File::Find;
use File::Spec;
my ($plist, $pshared);
my @backsubst;
my (%newdir, %occupied, %ldconfig, %has_stuff, %infodir, @files, @libfiles);
die "Update bsd.port.mk" if @ARGV == 0;
$plist = shift;
$pshared = $plist;
$pshared =~ s/PLIST/PFRAG.shared/;
open(PLIST, ">$plist-auto") or die "Can't write to $plist-auto";
my $plistdir = shift;
die "Update bsd.port.mk" if -f $plistdir;
$plist = File::Spec->catfile($plistdir, 'PLIST');
$pshared = File::Spec->catfile($plistdir, 'PFRAG.shared');
if (-e "$plist.orig" or -e "$pshared.orig") {
die "You must clean up old files first";
}
rename($plist, "$plist.orig") or die "Can't rename $plist to $plist.orig";
rename($pshared, "$pshared.orig");
open(PLIST, '>', $plist) or die "Can't write to $plist";
select PLIST;
for (@ARGV) {
if (m/\=/) {
my $back = $`;
my $v = $';
push(@backsubst, ["\${$back}", $v]) if $v ne '';
}
}
print "\@comment \$OpenBSD\$\n";
# compare all files against those dates
@ -89,6 +106,11 @@ sub parse_mtree {
sub strip {
local($_) = shift;
s|^\Q$base\E/||;
for my $l (@backsubst) {
my $v = $l->[1];
my $r = $l->[0];
s/\Q$v\E/$r/g;
}
# If the resulting name is arch-dependent, we warn.
# We don't fix it automatically, as this may need special handling.
if (m/i386|m68k|sparc/) {

View File

@ -1,6 +1,6 @@
#-*- mode: Fundamental; tab-width: 4; -*-
# ex:ts=4 sw=4 filetype=make:
FULL_REVISION=$$OpenBSD: bsd.port.mk,v 1.411 2001/05/23 13:28:14 espie Exp $$
FULL_REVISION=$$OpenBSD: bsd.port.mk,v 1.412 2001/05/23 14:18:24 espie Exp $$
# $FreeBSD: bsd.port.mk,v 1.264 1996/12/25 02:27:44 imp Exp $
# $NetBSD: bsd.port.mk,v 1.62 1998/04/09 12:47:02 hubertf Exp $
#
@ -604,7 +604,7 @@ SCRIPTS_ENV+= ${_INSTALL_MACROS}
# Create the generic variable substitution list, from subst vars
SUBST_VARS+=ARCH MACHINE_ARCH HOMEPAGE PREFIX SYSCONFDIR FLAVOR_EXT
SUBST_VARS+=MACHINE_ARCH ARCH HOMEPAGE PREFIX SYSCONFDIR FLAVOR_EXT
_SED_SUBST=sed
.for _v in ${SUBST_VARS}
_SED_SUBST+=-e 's,$${${_v}},${${_v}},g'
@ -1974,11 +1974,15 @@ RECURSIVE_FETCH_LIST?= Yes
# when port is installed or package created.
#
.if ${FAKE:L} == "yes"
_tmp:=
. for _v in ${SUBST_VARS}
_tmp += ${_v}='${${_v}}'
. endfor
plist: fake
@DESTDIR=${WRKINST} PREFIX=${WRKINST}${PREFIX} LDCONFIG="${LDCONFIG}" \
MTREE_FILE=${WRKPKG}/mtree.spec \
INSTALL_PRE_COOKIE=${_INSTALL_PRE_COOKIE} \
perl ${PORTSDIR}/infrastructure/install/make-plist ${PLIST}
perl ${PORTSDIR}/infrastructure/install/make-plist ${PKGDIR} ${_tmp}
.endif
update-patches: