chiark / gitweb /
0efb98ba0db2bfbff46d1dadb5da5725ee883b79
[ypp-sc-tools.web-live.git] / yarrg / web / source.tar.gz
1 <%perl>
2 use IO::Pipe;
3 use CommodsWeb;
4
5 $r->content_type('application/octet-stream');
6 $m->flush_buffer();
7
8 $ENV{'YPPSC_YARRG_SRCBASE'}= $sourcebasedir;
9 my $pipe= new IO::Pipe or die $!;
10 my $pid= fork();  defined $pid or die $!;
11 if (!$pid) {
12         $pipe->writer();
13         exec '/bin/sh','-c','
14                 cd -P "$YPPSC_YARRG_SRCBASE"
15                 (
16                  git-ls-files -z;
17                  if test -d .git; then find .git -print0; fi
18                 ) | cpio -Hustar -o --quiet -0 -R 1000:1000
19         ';
20         die $!;
21 }
22 $pipe->reader();
23
24 my ($d, $l);
25 while ($l= read $pipe, $d, 65536) {
26         print $d;
27         $m->flush_buffer();
28 }
29 waitpid $pid,0;
30 defined $l or die "read pipe $!";
31 $pipe->error and die "pipe error $!";
32 close $pipe;
33 # deliberately ignore errors
34
35 </%perl>