-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrelease.pl
More file actions
32 lines (22 loc) · 781 Bytes
/
release.pl
File metadata and controls
32 lines (22 loc) · 781 Bytes
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
#!/usr/bin/perl
use strict;
use XML::Simple;
use File::Basename;
use Digest::SHA;
my $repofile = $ARGV[0];
my $version = $ARGV[1];
my $zipfile = $ARGV[2];
my $url = $ARGV[3];
my $repo = XMLin($repofile, ForceArray => 1, KeepRoot => 0, KeyAttr => 0, NoAttr => 0);
$repo->{plugins}[0]->{plugin}[0]->{version} = $version;
open (my $fh, "<", $zipfile) or die $!;
binmode $fh;
my $digest = Digest::SHA->new;
$digest->addfile($fh);
close $fh;
$repo->{plugins}[0]->{plugin}[0]->{sha}[0] = $digest->hexdigest;
print("version: $version\n");
print("sha : ", $digest->hexdigest, "\n");
$url .= "/$zipfile";
$repo->{plugins}[0]->{plugin}[0]->{url}[0] = $url;
XMLout($repo, RootName => 'extensions', NoSort => 1, XMLDecl => 1, KeyAttr => '', OutputFile => $repofile, NoAttr => 0);