File: load

package info (click to toggle)
task 2.6.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 7,076 kB
  • sloc: cpp: 45,964; python: 12,713; sh: 785; perl: 189; makefile: 21
file content (50 lines) | stat: -rwxr-xr-x 1,073 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /usr/bin/perl

use strict;
use warnings;

if (open my $fh, '>', 'perf.rc')
{
  print $fh "data.location=.\n",
            "color=on\n",
            "_forcecolor=on\n",
            "verbose=label\n",
            "hooks=off\n",
            "color.debug=\n";
  close $fh;
}

my $filename = 'sample-text.txt';
open(my $fh, '<:encoding(UTF-8)', $filename)
  or die "Could not open file '$filename' $!";

# Read all the data.
my $id = 1;
while (my $line = <$fh>)
{
  if ($. % 20 != 19)
  {
    # Names are both projects and tags.
    $line =~ s/([A-Z]{2,})/$1 project:$1 +$1/g;
  }

  if ($. % 20 == 19)
  {
    my $anno_id = $id - 1;
    qx{../src/task rc:perf.rc rc.gc=off $anno_id annotate $line};
    print "[$.] task rc:perf.rc rc.gc=off $anno_id annotate $line\n" if $?;
  }
  elsif ($. % 4 == 1)
  {
    qx{../src/task rc:perf.rc rc.gc=off add $line};
    print "[$.] task rc:perf.rc rc.gc=off add $line\n" if $?;
    ++$id;
  }
  else
  {
    qx{../src/task rc:perf.rc rc.gc=off log $line};
    print "[$.] task rc:perf.rc rc.gc=off log $line\n" if $?;
  }
}

exit 0;