summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tl-update-containers
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-10-15 18:38:31 +0000
committerNorbert Preining <preining@logic.at>2008-10-15 18:38:31 +0000
commitb6b561ebcebad385e1b35ddf226fc26e37d86a74 (patch)
tree18ee4aab88ce93061a1c31283cf34ae92266edca /Master/tlpkg/bin/tl-update-containers
parenta3cf6c01c4f7947b52b6d3972fd6983bbe104156 (diff)
remove outdated .doc and .src containers, and add an option --dry-run
git-svn-id: svn://tug.org/texlive/trunk@10983 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/bin/tl-update-containers')
-rwxr-xr-xMaster/tlpkg/bin/tl-update-containers91
1 files changed, 57 insertions, 34 deletions
diff --git a/Master/tlpkg/bin/tl-update-containers b/Master/tlpkg/bin/tl-update-containers
index dcbe30eed10..305e5c3271e 100755
--- a/Master/tlpkg/bin/tl-update-containers
+++ b/Master/tlpkg/bin/tl-update-containers
@@ -34,10 +34,12 @@ my $opt_recreate = 0;
my $opt_relative = 0;
my $opt_version = 0;
my $opt_help = 0;
+my $opt_dry = 0;
TeXLive::TLUtils::process_logging_options();
GetOptions(
"all|a" => \$opt_all,
+ "dry-run" => \$opt_dry,
"location=s" => \$opt_location,
"no-setup" => \$opt_nosetup,
"recreate" => \$opt_recreate,
@@ -218,47 +220,65 @@ sub main
# tlpobj are removed, and thus also in the tlpdb to be saved!!!
my $objcopy = $obj->copy;
if ($srcsplit) {
- my $objsrc = $obj->srcfiles_package;
- $objcopy->clear_srcfiles;
- if ($objsrc) {
- my ($s,$m) = $objsrc->make_container($type, $Master, $opt_containerdir,
- "$pkg.source", $opt_relative);
- if ($s > 0) {
- # something was created
- # important, we have to add it to the original $obj
- $obj->srccontainersize($s);
- }
- if ($m ne "") {
- $obj->srccontainermd5($m);
+ if (!$opt_dry) {
+ my $objsrc = $obj->srcfiles_package;
+ $objcopy->clear_srcfiles;
+ if ($objsrc) {
+ my ($s,$m) = $objsrc->make_container($type, $Master, $opt_containerdir,
+ "$pkg.source", $opt_relative);
+ if ($s > 0) {
+ # something was created
+ # important, we have to add it to the original $obj
+ $obj->srccontainersize($s);
+ }
+ if ($m ne "") {
+ $obj->srccontainermd5($m);
+ }
+ } else {
+ # no src files in the package, so remove old .source containers
+ push @removepacks, "$pkg.source";
}
}
+ } else {
+ # remove the .source container
+ push @removepacks, "$pkg.source";
}
if ($docsplit) {
- my $objdoc = $obj->docfiles_package;
- $objcopy->clear_docfiles;
- if ($objdoc) {
- my ($s,$m) = $objdoc->make_container($type, $Master, $opt_containerdir,
- "$pkg.doc", $opt_relative);
- if ($s > 0) {
- # something was created
- $obj->doccontainersize($s);
- }
- if ($m ne "") {
- $obj->doccontainermd5($m);
+ if (!$opt_dry) {
+ my $objdoc = $obj->docfiles_package;
+ $objcopy->clear_docfiles;
+ if ($objdoc) {
+ my ($s,$m) = $objdoc->make_container($type, $Master, $opt_containerdir,
+ "$pkg.doc", $opt_relative);
+ if ($s > 0) {
+ # something was created
+ $obj->doccontainersize($s);
+ }
+ if ($m ne "") {
+ $obj->doccontainermd5($m);
+ }
+ } else {
+ # no doc files in the package, so remove old .doc containers
+ push @removepacks, "$pkg.doc";
}
}
+ } else {
+ # remove the .doc containers
+ push @removepacks, "$pkg.doc";
}
- my ($s,$m) = $objcopy->make_container($type, $Master, $opt_containerdir,
- $pkg, $opt_relative);
- if ($s > 0) {
- $obj->containersize($s);
- }
- if ($m ne "") {
- $obj->containermd5($m);
+ if (!$opt_dry) {
+ my ($s,$m) = $objcopy->make_container($type, $Master, $opt_containerdir,
+ $pkg, $opt_relative);
+ if ($s > 0) {
+ $obj->containersize($s);
+ }
+ if ($m ne "") {
+ $obj->containermd5($m);
+ }
}
# add the updated (or new) TLPOBJ to NET TLPDB
# that way the other container sizes are not destroyed
- $nettlpdb->add_tlpobj($obj);
+ $nettlpdb->add_tlpobj($obj) unless $opt_dry;
}
# next we remove those containers which have been gone!
@@ -282,8 +302,8 @@ sub main
}
}
info("$op has disappeared, removing its containers\n");
- `rm $opt_containerdir/$op.*`;
- $nettlpdb->remove_package($op);
+ `rm $opt_containerdir/$op.*` unless $opt_dry;
+ $nettlpdb->remove_package($op) unless $opt_dry;
$count{"removed"}++;
}
@@ -299,6 +319,9 @@ sub main
}
}
+
+ return(0) if $opt_dry;
+
# STRANGE: It seems that calling -recreate did not save the
# docfiles into the texlive.tlpdb, no idea why. So update should now
# do that.
@@ -307,7 +330,7 @@ sub main
# do a last check that all the containers are actually present
foreach my $p ($nettlpdb->list_packages) {
- next if $p =~ /00texlive.*\./;
+ next if $p =~ /00texlive/;
if (! -r "$opt_containerdir/$p.tar.lzma") {
tlwarn ("container for $p is missing, strange!\n");
}