summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tl-update-containers
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/bin/tl-update-containers')
-rwxr-xr-xMaster/tlpkg/bin/tl-update-containers34
1 files changed, 15 insertions, 19 deletions
diff --git a/Master/tlpkg/bin/tl-update-containers b/Master/tlpkg/bin/tl-update-containers
index f886c226f89..99bf1c30f43 100755
--- a/Master/tlpkg/bin/tl-update-containers
+++ b/Master/tlpkg/bin/tl-update-containers
@@ -25,12 +25,12 @@ use File::Path;
our $mydir;
my $opt_debug = 0;
-my $opt_containerdir = "./tlpkg";
+my $opt_location = ".";
my $opt_relative = 0;
my $help = 0;
GetOptions(
- "containerdir=s" => \$opt_containerdir,
+ "location=s" => \$opt_location,
"debug!" => \$opt_debug,
"help|?" => \$help) or pod2usage(1);
@@ -65,24 +65,21 @@ sub main
tllog($::LOG_DEBUG, "format=$type srcsplit=$srcsplit docsplit=$docsplit\n");
- # read in the old texlive.pkgver and save the revisions.
- # If it's not present, we'll update everything, i.e., populating a
- # directory for the first time.
+ my $nettlpdb = TeXLive::TLPDB->new(root => $opt_location);
+ if (!defined($nettlpdb)) {
+ die "Cannot init tlpdb from $opt_location ...";
+ }
my %archiverevs;
- local *TMP;
- if (open(TMP, "<$opt_containerdir/texlive.pkgver")) {
- while (<TMP>) {
- my ($pkg,$rev) = split;
- $archiverevs{$pkg} = $rev;
- }
- close(TMP);
+ foreach my $pkg ($nettlpdb->list_packages()) {
+ $archiverevs{$pkg} = $nettlpdb->get_package($pkg)->revision();
}
# collect packages to be updated.
my %count;
$count{"new"} = $count{"removed"} = $count{"updated"} = $count{"unchanged"}
= 0;
-
+
+ my $opt_containerdir = "$opt_location/$TeXLive::TLConfig::NetArchive";
my @todopacks = ();
for my $pkg (@packs) {
next if ($pkg eq "00texlive.config");
@@ -115,7 +112,7 @@ sub main
} else {
die "This shouldn't happen! The revision of $pkg in texlive.tlpdb"
. "($newrev) is OLDER than the one in"
- . "$opt_containerdir/texlive.pkgver ($oldrev), goodbye";
+ . "$opt_location/tlpkg/texlive.tlpdb ($oldrev), goodbye";
}
}
@@ -146,16 +143,15 @@ sub main
if (@todopacks) {
# we updated something
- print "$0: updating $opt_containerdir/texlive.pkgver ...\n";
- my $PKGVER = ">$opt_containerdir/texlive.pkgver";
- open (TMP, $PKGVER) || die "open($PKGVER) failed: $!";
- $tlpdb->generate_packagelist (\*TMP);
- close (TMP) || warn "close($PKGVER) failed: $!";
print "$0: $count{new} new, $count{removed} removed, "
. "$count{updated} updated, $count{unchanged} unchanged.\n";
+ # Finally we copy the source tlpdb over to the destination tlpdb
+ $tlpdb->root($opt_location);
+ $tlpdb->save;
} else {
print "$0: nothing to be done.\n";
}
+
}