3 # create_projects_bom.pl - generate list of files to backup
4 # Copyright (C) 2020 Kyle J. McKay. All rights reserved.
5 # License GPLv2+: GNU GPL version 2 or later.
6 # www.gnu.org/licenses/gpl-2.0.html
7 # This is free software: you are free to change and redistribute it.
8 # There is NO WARRANTY, to the extent permitted by law.
12 use vars
qw($VERSION);
13 BEGIN {*VERSION = \'1.0.0'}
14 use lib "__BASEDIR__";
19 exit(&main(@ARGV)||0);
22 BEGIN {@projparts = qw(
52 objects/info/alternates
65 my ($rdir, $pdir) = @_;
66 my $odir = "$rdir/$pdir";
67 opendir LISTDIR
, "$odir" or return;
68 my @tags = grep { !/^\./ && !/[,\s\/\\]/ && ! -l "$odir/$_" && -f "$odir/$_" } readdir(LISTDIR);
70 print "$pdir/$_\n" foreach sort({lc($a) cmp lc($b) || $a cmp $b} @tags);
73 sub bom_for_project($) {
74 my $rroot = $Girocco::Config::reporoot;
77 -l "$rroot/$proj.git
" and return;
79 # For each entry from @projparts that exists, output
80 # a line. BUT, if it exists AND it's a symlink, SKIP
81 # outputting a line for anything beneath it that's also
85 my $test = "$rroot/$proj.git
";
86 foreach (@projparts) {
87 my $idx = index($_, "/");
88 next if $idx > 0 && $links{substr($_, 0, $idx)};
91 print "$proj.git
/$_\n";
93 } elsif ($_ eq "packed
-refs
") {
95 } elsif (-e "$test/$_") {
96 print "$proj.git
/$_\n";
97 list_files($rroot, "$proj.git
/$_") if $_ eq "ctags
";
104 my %projects = map({$_ => 1} Girocco::Project::get_full_list());
106 my $rroot = $Girocco::Config::reporoot;
112 $projects{$_} || (-l "$rroot/$_.git" && -d "$rroot/$_.git
") or
113 die "no such project
: $_\n";
116 my %list = map({$_ => 1} @list);
117 @names = sort({lc($a) cmp lc($b) || $a cmp $b} keys(%list));
119 if (opendir REPOROOT, $rroot) {
121 /^[^._]/ && s/\.git$//i &&
122 -l "$rroot/$_.git" && -d "$rroot/$_.git
"
125 $projects{$_} = 1 foreach @links;
127 @names = sort({lc($a) cmp lc($b) || $a cmp $b} keys(%projects));
129 @names or die "no projects specified
\n";
130 #print map("$_\n", @names);
131 bom_for_project($_) foreach @names;