File: Github.pm

package info (click to toggle)
devscripts 2.25.22~bpo13%2B1
  • links: PTS, VCS
  • area: main
  • in suites: trixie-backports
  • size: 9,428 kB
  • sloc: perl: 27,181; sh: 12,550; python: 4,466; makefile: 382
file content (32 lines) | stat: -rw-r--r-- 1,122 bytes parent folder | download
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
package Devscripts::Uscan::Templates::Github;

use strict;

sub transform {
    my $watchSource = shift;
    delete $watchSource->{template};
    my $owner   = delete $watchSource->{owner};
    my $project = delete $watchSource->{project};
    die 'Missing owner'   unless $owner;
    die 'Missing project' unless $project;

    $watchSource->{source}
      ||= "https://api.github.com/repos/$owner/$project/git/matching-refs/"
      . ($watchSource->{releaseonly} ? 'release/' : 'tags/');
    $watchSource->{matchingpattern}
      ||= 'https://api.github.com/repos/[^/]+/[^/]+/git/refs/tags/(?:[^/]+\-)?'
      . $watchSource->{versiontype}
      . '(?:(?=")|$)';
    $watchSource->{downloadurlmangle}
      ||= 's%(api.github.com/repos/[^/]+/[^/]+)/git/refs/%$1/tarball/refs/%g';
    $watchSource->{filenamemangle} ||= (
        $watchSource->{component}
        ? 's%.*/(?:[^/]+\-)?@ANY_VERSION@%@PACKAGE@-@COMPONENT@-$1.tar.gz%'
        : 's%.*/(?:[^/]+\-)?@ANY_VERSION@%@PACKAGE@-$1.tar.gz%'
    );
    $watchSource->{searchmode} ||= 'plain';
    $watchSource->{pgpmode}    ||= 'none';
    return $watchSource;
}

1;