summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-01-25 09:48:55 +0000
committerdavidovski <david@davidovski.xyz>2022-01-25 09:48:55 +0000
commit13e29297924facf15bedc440b20d174ab9b9f96c (patch)
tree5248d154a8eeeec215f57b51e184b2c9706b0f24
parent26c3c10aeb9c6495c632228071dcad48abdcc7dc (diff)
added listing deps
-rwxr-xr-xsrc/xib.pl36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/xib.pl b/src/xib.pl
index c6a8081..7a677c6 100755
--- a/src/xib.pl
+++ b/src/xib.pl
@@ -24,6 +24,7 @@
use strict;
use warnings;
use Getopt::Long "HelpMessage";
+use File::Basename;
our $BUILDFILES_REPO = "https://xi.davidovski.xyz/git/buildfiles.git";
@@ -52,13 +53,46 @@ sub pull_buildfiles{
list_buildfiles();
}
+sub list_dependencies{
+ my $file = $_;
+ my @deps = ();
+
+ open (my $fh, "<", $file) or warn "Cannot open $file";
+
+ while (my $line = <$fh>) {
+ if ($line =~ /DEPS=\((.+)\)/) {
+ my @words = split(/ /, $1);
+ push(@deps, @words);
+ }
+ }
+
+ return @deps;
+}
+
sub list_buildfiles{
my @files = glob("$buildfiles/repo/*/*.xibuild");
+ return @files;
+}
+
+sub determine_build_order{
+ my %pkgs = ();
+
+ my @files = list_buildfiles();
+
foreach (@files) {
- print("$_\n");
+ my $pkg_file = $_;
+ my $pkg_name = basename($pkg_file, ".xibuild");
+
+ my @deps = list_dependencies($pkg_file)
+ $pkgs{"$pkg_file"} = @deps;
+ }
+
+ for (keys %pkgs) {
+ print("$_ has the deps: $pkgs{$_}\n")
}
}
unless (caller) {
prepare_xib_environment();
+ determine_build_order();
}