]> git.ipfire.org Git - thirdparty/dracut.git/blame - git2spec.pl
Always try to add pinctrl-cherryview
[thirdparty/dracut.git] / git2spec.pl
CommitLineData
0e6a94b3
HH
1#!/usr/bin/perl
2
0e6a94b3
HH
3sub create_patches {
4 my $tag=shift;
9af39cbe 5 my $pdir=shift;
0e6a94b3 6 my $num=0;
03a44f0b 7 open( GIT, 'git format-patch -M -N --no-signature -o "'.$pdir.'" '.$tag.' |');
0e6a94b3
HH
8 @lines=<GIT>;
9 close GIT; # be done
10 return @lines;
11};
f2953927 12
0e6a94b3
HH
13use POSIX qw(strftime);
14my $datestr = strftime "%Y%m%d", gmtime;
15
16my $tag=shift;
9af39cbe 17my $pdir=shift;
5f8cd1a4
HH
18$tag=`git describe --abbrev=0 --tags` if not defined $tag;
19chomp($tag);
9af39cbe 20my @patches=&create_patches($tag, $pdir);
0e6a94b3
HH
21my $num=$#patches + 2;
22$tag=~s/[^0-9]+?([0-9]+)/$1/;
23my $release="$num.git$datestr";
24$release="1" if $num == 1;
25
26while(<>) {
27 if (/^Version:/) {
28 print "Version: $tag\n";
29 }
30 elsif (/^Release:/) {
f2953927 31 print "Release: $release%{?dist}\n";
0e6a94b3
HH
32 }
33 elsif ((/^Source0:/) || (/^Source:/)) {
34 print $_;
35 $num=1;
36 for(@patches) {
a9e8ca4a 37 s/.*\///g;
0e6a94b3
HH
38 print "Patch$num: $_";
39 $num++;
40 }
41 print "\n";
42 }
0e6a94b3
HH
43 else {
44 print $_;
45 }
46}