X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fupdate;h=3c04bc63af0bdea5e019b5454635a38b1871745e;hb=c7b938502295ddc5b2c89e0854d8c5c19ede32dc;hp=c57918cb5067dbb218373521b3f332e9257bf419;hpb=47fe6c5540352fd5eafc2ae5c4ec6c4b61984591;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/vendor/update b/vendor/update index c57918cb5..3c04bc63a 100755 --- a/vendor/update +++ b/vendor/update @@ -18,15 +18,7 @@ # -BEGIN { - require 5.10.0; - unless (-f 'configure') { - print "Error: $0 must be run from the main source directory!\n"; - exit 1; - } -} - -use feature ':5.10'; +use v5.10.0; use strict; use warnings FATAL => qw(all); @@ -50,21 +42,21 @@ close $fh; my ($data, $error) = from_toml $contents; print_error "unable to parse $config: $!" if $error; -while (my ($name, $info) = each $data) { - print_format "Updating <|GREEN $name|> ...\n"; +while (my ($name, $info) = each %{$data}) { + say console_format "Updating <|GREEN $name|> ..."; my $unpackdir = File::Temp->newdir; my $vendordir = catdir $RealDir, $name; my $success = 0; if (defined $info->{git}) { - $success ||= system 'git', 'clone', $info->{git}, $unpackdir; + $success ||= execute 'git', 'clone', $info->{git}, $unpackdir; chomp(my $tag = `git -C $unpackdir describe --abbrev=0 --tags HEAD 2>/dev/null`) unless $success; - $success ||= system 'git', '-C', $unpackdir, 'checkout', $tag if $tag; + $success ||= execute 'git', '-C', $unpackdir, 'checkout', $tag if $tag; chomp($info->{version} = `git -C $unpackdir describe --always --tags HEAD 2>/dev/null`); } elsif (defined $info->{tarball}) { my $tarball = catfile $unpackdir, basename $info->{tarball}; - $success ||= system 'wget', '--output-document', $tarball, $info->{tarball}; - $success ||= system 'tar', 'fx', $tarball, '-C', $unpackdir, '--strip-components', 1; + $success ||= execute 'wget', '--output-document', $tarball, $info->{tarball}; + $success ||= execute 'tar', 'fx', $tarball, '-C', $unpackdir, '--strip-components', 1; } else { print_error "unable to update $name; no git or tarball specified!"; } @@ -91,7 +83,7 @@ close $fh; open($fh, '>', $readme) or print_error "unable to write $readme: $!"; print $fh $contents =~ s/\n\#\#.*//rs; -for my $name (sort keys $data) { +for my $name (sort keys %{$data}) { my $info = $data->{$name}; printf $fh "\n## %s\n\n", $name; printf $fh "**Author** — [%s](mailto:%s)\n\n", $info->{author}, $info->{email} if $info->{email}; @@ -101,4 +93,4 @@ for my $name (sort keys $data) { my $website = $info->{website} // $info->{git}; printf $fh "**Website** — [%s](%s)\n", $website, $website; } -close $fh; \ No newline at end of file +close $fh;