summaryrefslogtreecommitdiff
path: root/Master/tlpkg/libexec/place
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/libexec/place')
-rwxr-xr-xMaster/tlpkg/libexec/place54
1 files changed, 35 insertions, 19 deletions
diff --git a/Master/tlpkg/libexec/place b/Master/tlpkg/libexec/place
index dda37b0d2c8..0693e13f7c3 100755
--- a/Master/tlpkg/libexec/place
+++ b/Master/tlpkg/libexec/place
@@ -21,21 +21,18 @@ use TeXLive::TLPSRC;
use TeXLive::TLPOBJ;
use TeXLive::TLPDB;
use TeXLive::TLTREE;
+use Getopt::Long;
-if ($ARGV[0] eq "-n") {
- $chicken = 1;
- shift;
-} else {
- $chicken = 0;
-}
-print "place: chicken mode = $chicken\n";
-
-my $do_contrib = 0;
-if ($ARGV[0] eq "--contrib") {
- $do_contrib = 1;
- shift;
-}
+my $chicken = 0;
+my $opt_contrib;
+my $opt_mode = "svn";
+exit 2 unless Getopt::Long::GetOptions (
+ "n" => \$chicken,
+ "contrib=s" => \$opt_contrib,
+ "mode=s" => \$opt_mode,
+);
+print "place: chicken mode = $chicken\n";
die "usage: $0 PKGNAME\n" unless @ARGV == 1;
$package = $ARGV[0];
@@ -63,6 +60,9 @@ $cooked_top = getcwd (); # ctan2tl invokes us in the top-level cooked dir
&xchdir ("$mydir/../..");
my $M = $DEST = getcwd (); # svn Master, ordinarily where we write
+
+$M = $DEST = $opt_contrib if (defined($opt_contrib));
+
#
&xchdir ("..");
@@ -101,8 +101,6 @@ for my $dot (@trailingdots) {
# we do those checks (and possible removals) before making the new TL
# package, so the "README." file doesn't get into the data structures.
-die("contrib mode not implemented, move packages manually!\n") if ($do_contrib);
-
if (-d "Master") { # maybe have both Build and Master
&xchdir ("Master");
@@ -175,7 +173,11 @@ foreach $file (sort keys %Old) {
# remove no longer existing files.
if (! $New{$file}) {
- &xsystem ("svn remove \"$M/$file\"");
+ if ($opt_mode eq "svn") {
+ &xsystem ("svn remove \"$M/$file\"");
+ } else {
+ &xsystem ("git rm \"$M/$file\"");
+ }
(my $old_dir = "$M/$file") =~ s,/[^/]*$,,;
$dirs_with_removals{$old_dir}++;
}
@@ -216,7 +218,11 @@ $dirs{"$M/tlpkg/tlpsrc/$package.tlpsrc"}++;
# the directories will not be empty.
if (! $chicken) {
for my $empty_dir (&empty_dirs (keys %dirs_with_removals)) {
- &xsystem ("cd $M && svn remove $empty_dir # empty dir");
+ if ($opt_mode eq "svn") {
+ &xsystem ("cd $M && svn remove $empty_dir # empty dir");
+ } else {
+ &xsystem ("cd $M && rmdir $empty_dir")
+ }
# already in %dirs, so don't need to add.
}
}
@@ -257,8 +263,11 @@ close (DIRLIST) || warn "close($DIRLIST) failed: $!";
# Always run svn update, even without --place. This will let a worker
# detect that a particular package update has already been done by
# someone else.
-print ("\nsvn update of those directories:\n");
-system ("svn update `cat $dirlist_file`");
+if ($opt_mode eq "svn") {
+ print ("\nsvn update of those directories:\n");
+ system ("svn update `cat $dirlist_file`");
+}
+# do nothing in git mode
exit (0);
@@ -307,6 +316,13 @@ sub add_file {
# when it's needed, (grand*)parents must come first, else have svn
# "not working copy" error.
my $newdir = $dir = dirname ($newfile);
+
+ if ($opt_mode eq "git") {
+ &xsystem ("cd $M && git add $newfile");
+ $dirs{$newdir}++;
+ return;
+ }
+
my $needed_dirs = "";
#until (-d "$dir/.svn") {
until (&is_svn_dir($dir)) {