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
64 my ($rdir, $pdir) = @_;
65 my $odir = "$rdir/$pdir";
66 opendir LISTDIR
, "$odir" or return;
67 my @tags = grep { !/^\./ && !/[,\s\/\\]/ && ! -l "$odir/$_" && -f "$odir/$_" } readdir(LISTDIR);
69 print "$pdir/$_\n" foreach sort({lc($a) cmp lc($b) || $a cmp $b} @tags);
72 sub bom_for_project($) {
73 my $rroot = $Girocco::Config::reporoot;
76 -l "$rroot/$proj.git
" and return;
78 # For each entry from @projparts that exists, output
79 # a line. BUT, if it exists AND it's a symlink, SKIP
80 # outputting a line for anything beneath it that's also
84 my $test = "$rroot/$proj.git
";
85 foreach (@projparts) {
86 my $idx = index($_, "/");
87 next if $idx > 0 && $links{substr($_, 0, $idx)};
90 print "$proj.git
/$_\n";
92 } elsif ($_ eq "packed
-refs
") {
94 } elsif (-e "$test/$_") {
95 print "$proj.git
/$_\n";
96 list_files($rroot, "$proj.git
/$_") if $_ eq "ctags
";
103 my %projects = map({$_ => 1} Girocco::Project::get_full_list());
105 my $rroot = $Girocco::Config::reporoot;
111 $projects{$_} || (-l "$rroot/$_.git" && -d "$rroot/$_.git
") or
112 die "no such project
: $_\n";
115 my %list = map({$_ => 1} @list);
116 @names = sort({lc($a) cmp lc($b) || $a cmp $b} keys(%list));
118 if (opendir REPOROOT, $rroot) {
120 /^[^._]/ && s/\.git$//i &&
121 -l "$rroot/$_.git" && -d "$rroot/$_.git
"
124 $projects{$_} = 1 foreach @links;
126 @names = sort({lc($a) cmp lc($b) || $a cmp $b} keys(%projects));
128 @names or die "no projects specified
\n";
129 #print map("$_\n", @names);
130 bom_for_project($_) foreach @names;