-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathea4-tool-post-update
executable file
·51 lines (39 loc) · 1.51 KB
/
ea4-tool-post-update
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
51
#!/usr/local/cpanel/3rdparty/bin/perl
# cpanel - ea4-tool-post-update Copyright(c) 2021 cPanel, L.L.C.
# All rights Reserved.
# [email protected] http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
package ea_libicu::ea4_tool_post_update;
use strict;
use warnings;
use lib "../ea-tools/lib/ea4_tool"; # assumes ea-tools is checked out next to this repo
use ea4_tool::util ();
use File::chdir;
use Path::Tiny;
exit( run(@ARGV) ? 0 : 1 ) if !caller;
sub run {
my ( $old_ver, $new_ver ) = @_;
my ( $major_ver, $minor_ver ) = split /\./, $new_ver;
my $tarball_ver = $new_ver;
$tarball_ver =~ s/\./-/;
my $spec = ea4_tool::util::specfile($CWD);
my @lines = path($spec)->lines;
foreach my $line (@lines) {
if ( $line =~ /^%define\s+version_major/ ) {
$line =~ s/[0-9]+/$major_ver/;
}
elsif ( $line =~ /^%define\s+tarball_version/ ) {
$line =~ s/[0-9\-]+/$tarball_ver/;
}
}
path($spec)->spew(@lines);
print "Committing SPEC file change …\n";
my $git = ea4_tool::util::git($CWD);
my $branch = $git->current_branch();
$git->run( add => $spec );
$git->run( commit => "-m", "$branch: ea4-tool-post-update version_major to $major_ver and tarball_version to $tarball_ver" );
ea4_tool::util::pushup( $git, $branch );
print "Done!\n";
return 1;
}
1;