]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Add a function for showing a command whilst executing it.
authorSadie Powell <sadie@witchery.services>
Sat, 18 Jan 2020 14:03:18 +0000 (14:03 +0000)
committerSadie Powell <sadie@witchery.services>
Sat, 18 Jan 2020 14:25:03 +0000 (14:25 +0000)
make/common.pm
tools/mkheaders
tools/test-build
vendor/update

index 49d4b77984bca428430ff0ea9d6402a6b378d74e..636c3d5d6f44b1eed3998db09954bae467dd58c0 100644 (file)
@@ -34,6 +34,7 @@ use File::Spec::Functions qw(rel2abs);
 use make::console;
 
 our @EXPORT = qw(create_directory
+                 execute
                  get_cpu_count
                  get_version
                  read_config_file
@@ -47,6 +48,11 @@ sub create_directory($$) {
        } // 0;
 }
 
+sub execute(@) {
+       print_format "<|BOLD \$|> @_\n";
+       return system @_;
+}
+
 sub get_version {
        state %version;
        return %version if %version;
index 4b1f370f3eada005a79cb460f7d79de4836581a9..ee8142d3b07e912d2f190995a7854ee0d5affde9 100755 (executable)
@@ -37,6 +37,7 @@ use List::Util     qw(uniq);
 use POSIX          qw(strftime);
 
 use lib dirname $RealDir;
+use make::common;
 use make::console;
 
 my @ignored_revisions = (
@@ -144,7 +145,7 @@ for my $path (@paths) {
        }
 }
 
-system 'git', 'commit',
+execute 'git', 'commit',
        '--author', 'InspIRCd Robot <noreply@inspircd.org>',
        '--message', 'Update copyright headers.',
        '--', @updated;
index 48988b687120ca5fbee2289bb9dc8ac9576b6b2e..eb7da05d0fbbf8d9d9c358713a73a47caabd51e3 100755 (executable)
@@ -40,7 +40,7 @@ use make::configure;
 $ENV{INSPIRCD_DEBUG} = 3;
 $ENV{INSPIRCD_VERBOSE} = 1;
 
-system 'git', 'clean', '-dfx';
+execute 'git', 'clean', '-dfx';
 
 my @compilers = $#ARGV >= 0 ? @ARGV : qw(g++ clang++ icpc);
 foreach my $compiler (@compilers) {
@@ -57,19 +57,19 @@ foreach my $compiler (@compilers) {
                say "Attempting to build using the $compiler compiler and the $socketengine socket engine...";
                my @configure_flags;
                if (defined $ENV{TEST_BUILD_MODULES}) {
-                       system './configure', '--enable-extras', $ENV{TEST_BUILD_MODULES};
+                       execute './configure', '--enable-extras', $ENV{TEST_BUILD_MODULES};
                        push @configure_flags, '--disable-auto-extras';
                }
-               if (system './configure', '--development', '--socketengine', $socketengine, @configure_flags) {
+               if (execute './configure', '--development', '--socketengine', $socketengine, @configure_flags) {
                        say "Failed to configure using the $compiler compiler and the $socketengine socket engine!";
                        exit 1;
                }
-               if (system 'make', '--jobs', get_cpu_count, 'install') {
+               if (execute 'make', '--jobs', get_cpu_count, 'install') {
                        say "Failed to compile using the $compiler compiler and the $socketengine socket engine!";
                        exit 1;
                }
                say "Building using the $compiler compiler and the $socketengine socket engine succeeded!";
        }
 
-       system 'git', 'clean', '-dfx';
+       execute 'git', 'clean', '-dfx';
 }
index c57918cb5067dbb218373521b3f332e9257bf419..6f9ff5e86a2e7b6c6b2950edf7de5800035018e7 100755 (executable)
@@ -57,14 +57,14 @@ while (my ($name, $info) = each $data) {
        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!";
        }