aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-04-16 19:55:00 +0200
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-04-16 19:55:00 +0200
commit436c026472da2e54de4c8d2f6dd405c680d853fa (patch)
treeaced6f3dd33f6d959eb0a07cc5dedaeb03ec7302
parentb58cbbf013d913355f8d814ce1144f1b2eea8271 (diff)
downloadsbotools2-436c026472da2e54de4c8d2f6dd405c680d853fa.tar.xz
Add tags-replacing mechanism
-rw-r--r--t/Test/Sbotools.pm25
1 files changed, 25 insertions, 0 deletions
diff --git a/t/Test/Sbotools.pm b/t/Test/Sbotools.pm
index ec0abfc..88c4cf5 100644
--- a/t/Test/Sbotools.pm
+++ b/t/Test/Sbotools.pm
@@ -31,6 +31,7 @@ our @EXPORT_OK = qw/
set_sbo_home
make_slackbuilds_txt
restore_perf_dummy
+ replace_tags_txt
/;
local $Test::Builder::Level = $Test::Builder::Level + 1;
@@ -98,6 +99,24 @@ sub restore_perf_dummy {
}
}
+my $tags = 0;
+my $tags_txt = '/usr/sbo/repo/TAGS.txt';
+sub replace_tags_txt {
+ if (-e $tags_txt) {
+ if (! $tags) {
+ $tags = 2;
+ system('mv', $tags_txt, "$tags_txt.bak");
+ }
+ } else {
+ $tags = 1 if $tags == 0;
+ }
+
+ system('mkdir', '-p', '/usr/sbo/repo');
+ open my $fh, '>', $tags_txt;
+ print $fh $_ for @_;
+ close $fh;
+}
+
# Restore original values when exiting
END {
if (%config) {
@@ -106,6 +125,12 @@ END {
if ($made) {
system(qw!rm -rf!, $fname);
}
+ if ($tags) {
+ system(qw!rm -rf !, $tags_txt);
+ }
+ if ($tags == 2) {
+ system('mv', "$tags_txt.bak", $tags_txt);
+ }
}
1;