From 2251131545e472c142436c96f7bebdf3140ec6b9 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Sat, 9 Jan 2021 11:24:15 -1000 Subject: [PATCH] scripts: remove migrated dumpinfo.pl script MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The script was moved over to openwrt.git and is called `dump-target-info.pl` Signed-off-by: Paul Spooren [fixed script path in the master build script] Signed-off-by: Petr Å tetiar --- phase1/master.cfg | 2 +- phase2/master.cfg | 2 +- scripts/dumpinfo.pl | 91 --------------------------------------------- 3 files changed, 2 insertions(+), 93 deletions(-) delete mode 100755 scripts/dumpinfo.pl diff --git a/phase1/master.cfg b/phase1/master.cfg index 2cba85e..49ce32f 100644 --- a/phase1/master.cfg +++ b/phase1/master.cfg @@ -207,7 +207,7 @@ if not os.path.isdir(work_dir+'/source.git'): else: subprocess.call(["git", "pull"], cwd = work_dir+'/source.git') -findtargets = subprocess.Popen([scripts_dir + '/dumpinfo.pl', 'targets'], +findtargets = subprocess.Popen(['./scripts/dump-target-info.pl', 'targets'], stdout = subprocess.PIPE, cwd = work_dir+'/source.git') while True: diff --git a/phase2/master.cfg b/phase2/master.cfg index d9ea18f..58c5e57 100644 --- a/phase2/master.cfg +++ b/phase2/master.cfg @@ -163,7 +163,7 @@ if not os.path.isdir(work_dir+'/source.git'): else: subprocess.call(["git", "pull"], cwd = work_dir+'/source.git') -findarches = subprocess.Popen([scripts_dir + '/dumpinfo.pl', 'architectures'], +findarches = subprocess.Popen(['./scripts/dump-target-info.pl', 'architectures'], stdout = subprocess.PIPE, cwd = work_dir+'/source.git') while True: diff --git a/scripts/dumpinfo.pl b/scripts/dumpinfo.pl deleted file mode 100755 index aa97f8d..0000000 --- a/scripts/dumpinfo.pl +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env perl - -use strict; -use warnings; -use Cwd; - -my (%targets, %architectures); - -$ENV{'TOPDIR'} = Cwd::getcwd(); - - -sub parse_targetinfo { - my ($target_dir, $subtarget) = @_; - - if (open M, "make -C '$target_dir' --no-print-directory DUMP=1 TARGET_BUILD=1 SUBTARGET='$subtarget' |") { - my ($target_name, $target_arch, @target_features); - while (defined(my $line = readline M)) { - chomp $line; - - if ($line =~ /^Target: (.+)$/) { - $target_name = $1; - } - elsif ($line =~ /^Target-Arch-Packages: (.+)$/) { - $target_arch = $1; - } - elsif ($line =~ /^Target-Features: (.+)$/) { - @target_features = split /\s+/, $1; - } - elsif ($line =~ /^@\@$/) { - if ($target_name && $target_arch && - !grep { $_ eq 'broken' or $_ eq 'source-only' } @target_features) { - $targets{$target_name} = $target_arch; - $architectures{$target_arch} ||= []; - push @{$architectures{$target_arch}}, $target_name; - } - - undef $target_name; - undef $target_arch; - @target_features = (); - } - } - close M; - } -} - -sub get_targetinfo { - foreach my $target_makefile (glob "target/linux/*/Makefile") { - my ($target_dir) = $target_makefile =~ m!^(.+)/Makefile$!; - my @subtargets; - - if (open M, "make -C '$target_dir' --no-print-directory DUMP=1 TARGET_BUILD=1 val.FEATURES V=s 2>/dev/null |") { - if (defined(my $line = readline M)) { - chomp $line; - if (grep { $_ eq 'broken' or $_ eq 'source-only' } split /\s+/, $line) { - next; - } - } - } - - if (open M, "make -C '$target_dir' --no-print-directory DUMP=1 TARGET_BUILD=1 val.SUBTARGETS V=s 2>/dev/null |") { - if (defined(my $line = readline M)) { - chomp $line; - @subtargets = split /\s+/, $line; - } - close M; - } - - push @subtargets, 'generic' if @subtargets == 0; - - foreach my $subtarget (@subtargets) { - parse_targetinfo($target_dir, $subtarget); - } - } -} - -if (@ARGV == 1 && $ARGV[0] eq 'targets') { - get_targetinfo(); - foreach my $target_name (sort keys %targets) { - printf "%s %s\n", $target_name, $targets{$target_name}; - } -} -elsif (@ARGV == 1 && $ARGV[0] eq 'architectures') { - get_targetinfo(); - foreach my $target_arch (sort keys %architectures) { - printf "%s %s\n", $target_arch, join ' ', @{$architectures{$target_arch}}; - } -} -else { - print "Usage: $0 targets\n"; - print "Usage: $0 architectures\n"; -} -- 2.30.2