From 83f853b5069bf9abe30cbbfa23e39c267f2ec57e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 20 Mar 2011 18:33:50 +0000 Subject: biber darwin/cygwin updates git-svn-id: svn://tug.org/texlive/trunk@21769 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/libexec/place | 63 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 19 deletions(-) (limited to 'Master/tlpkg/libexec/place') diff --git a/Master/tlpkg/libexec/place b/Master/tlpkg/libexec/place index 6da0194d942..8c932529a9e 100755 --- a/Master/tlpkg/libexec/place +++ b/Master/tlpkg/libexec/place @@ -33,7 +33,8 @@ print "place: chicken mode = $chicken\n"; die "usage: $0 PKGNAME\n" unless @ARGV == 1; $package = $ARGV[0]; -my $is_new_package = 0; +# $::opt_verbosity = 3; # debug tlpdb reading + %dirs = (); # dirs we make changes in $TMP = $ENV{"TMPDIR"} || "/tmp"; $tmpfile = "$TMP/$>.tlplace"; # use effective uid in temp file names @@ -65,22 +66,10 @@ else { die "$cooked_master: no top level texmf or texmf-dist"; } die "top-level README in $Root, that can't be right" if <*/README>; -# initialize TLPDB. -my $tlpdb = new TeXLive::TLPDB ("root" => $M); -# create TLTREE from stuff in cooked -my $tltree = TeXLive::TLTREE->new ("svnroot" => $cooked_master); -$tltree->init_from_files; - -# get existing package from TLPDB. -my %Old; -my $tlpold = $tlpdb->get_package ($package); -if (defined($tlpold)) { - foreach ($tlpold->all_files) { - $Old{$_} = 1; - } -} else { - $is_new_package = 1; -} +# get all files in the existing package, if there is one. +# In the unusual case when we have both Master and Build, we'll assume +# we also want all the platform-specific files under bin/; else not. +our %Old = &find_old_files ($package, $DEST eq $TOP ? "with-arch" : ""); # create new tlpsrc. my $tlpsrc = TeXLive::TLPSRC; @@ -103,6 +92,9 @@ if (! -r $tlpsrcfile) { } # make the new tlpobj. +# create TLTREE from stuff in cooked. +my $tltree = TeXLive::TLTREE->new ("svnroot" => $cooked_master); +$tltree->init_from_files; my $tlpnew = $tlpsrc->make_tlpobj($tltree, $M); @@ -158,7 +150,7 @@ for my $file (sort keys %New) { &add_file ("$M/$file") if ! $Old{$file}; } -if ($is_new_package) { +if (keys %Old == 0) { # new package &add_file ("$M/tlpkg/tlpsrc/$package.tlpsrc"); } @@ -193,6 +185,39 @@ system ("svn update `cat $dirlist_file`"); exit (0); + +# return hash whose keys are all the files in PACKAGE from the main +# tlpdb. If second arg is "with-arch", include platform-specific +# files. If PACKAGE is not defined, return undef or the empty list. +# +sub find_old_files { + my ($package,$control) = @_; + my %ret; + + # initialize TLPDB. + my $tlpdb = new TeXLive::TLPDB ("root" => $M); + + my $tlpold = $tlpdb->get_package ($package); + if (defined($tlpold)) { + my @oldpkgs; + if ($control eq "with-arch") { + # also retrieve the platform-specific files, which are dependencies. + @oldpkgs = $tlpdb->expand_dependencies ("-only-arch", $tlpdb,($package)); + } else { + @oldpkgs = ($package); + } + for my $oldpkgname (@oldpkgs) { + my $oldp = $tlpdb->get_package ($oldpkgname); + for my $f ($oldp->all_files) { + $ret{$f} = 1; + } + } + } + + return %ret; +} + + # add a file to the repository. for svn, we also have to add the # containing dir, and the parent of that dir, if they are new. @@ -259,7 +284,7 @@ sub compare_disk_vs_tlpobj { # sub show_tlp_diffs { my ($tlpnew, %Old) = @_; - if (!defined ($tlpold)) { + if (keys %Old == 0) { print "place: $package not present in $M/$InfraLocation/$DatabaseName\n\n"; } else { print "new vs. present $package (present is indented)\n"; -- cgit v1.2.3