Compare commits

...

No commits in common. "stream-virt-rhel-rhel-8.10.0" and "c8-stream-rhel" have entirely different histories.

5 changed files with 1 additions and 133 deletions

6
.gitignore vendored
View File

@ -1,7 +1 @@
*~
*.log
*.tar.gz
*.rpm
Sys-Virt-v*/
x86_64/
SOURCES/Sys-Virt-v8.0.0.tar.gz

View File

@ -1 +1 @@
8b2ec05c0cd17a0d161e74d9ca4120be3f921f7b Sys-Virt-v8.0.0.tar.gz
8b2ec05c0cd17a0d161e74d9ca4120be3f921f7b SOURCES/Sys-Virt-v8.0.0.tar.gz

View File

@ -1 +0,0 @@
SHA512 (Sys-Virt-v8.0.0.tar.gz) = 7caaba7b6c4d862bf7ad55b3a464d0acd105b7f594b80995b49e4243f6a9dd32eefceab997c6aa45497c07c607c7c7f8a047fd600668ac4b49d237de21f6996c

View File

@ -1,125 +0,0 @@
#!/usr/bin/perl
#
# Update the local patches and RPM spec with patches from
# an upstream tree with matching branch name.
#
# For example
#
# - Checkout upstream GIT repo for virt-viewer
# - Create a branch name matching current RHEL (eg rhel-6.4)
# - Populate the branch by cherry-picking patches from master
#
# This script will then
#
# - Setup the upstream GIT repo as a remote named 'upstream'
# - Extract version number from RPM spec
# - Look for a tag 'v$VERSION' in upstream GIT
# - Run 'git format-patches v$VERSION..upstream/rhel-6.4'
# - Re-write the RPM spec to update all PatchNNN lines
#
# The only manual step required is to fill in the changelog
#
use strict;
use warnings;
my $gitupstream = "git+ssh://git.engineering.redhat.com/srv/git/users/berrange/perl-Sys-Virt-rhel.git";
my $rpmspec = "perl-Sys-Virt.spec";
open SPEC, "$rpmspec" or die "cannot read $rpmspec: $!";
my @spec = <SPEC>;
close SPEC;
my $version;
foreach my $line (@spec) {
if ($line =~ /^Version:\s*(\S+)\s*$/) {
$version = $1;
}
}
die "cannot find Version: line in RPM spec"
unless $version;
my $gittag = "v" . $version;
open GIT, "-|", "git", "branch" or die "cannot run git branch: $!";
my $gitbranch;
while (<GIT>) {
if (/^\*\s+(\S+)\s*$/) {
$gitbranch = $1;
}
}
close GIT;
die "cannot find current git branch" unless $gitbranch;
die "can only deal with rhel/stream branches" unless $gitbranch =~ /(rhel|stream)/;
my $haveupstream;
open GIT, "-|", "git", "remote" or die "cannot run git remote: $!";
while (<GIT>) {
if (/upstream/) {
$haveupstream = 1;
}
}
close GIT;
unless ($haveupstream) {
`git remote add upstream $gitupstream`;
}
`git fetch upstream`;
$haveupstream = 0;
open GIT, "-|", "git", "branch", "-a" or die "cannot find git branch -a: $!";
while (<GIT>) {
if (m,upstream/$gitbranch,) {
$haveupstream = 1;
}
}
close GIT;
die "cannot find upstream/$gitbranch" unless $haveupstream;
`git format-patch --no-signature -N $gittag..upstream/$gitbranch`;
opendir DH, "." or die "cannot read current directory: $!";
my @patches
= grep {
/^\d\d\d.*\.patch/
} readdir(DH);
closedir DH;
@patches = sort @patches;
shift @patches if @patches && $patches[0] =~ /0000-/;
open SPEC, ">$rpmspec" or die "cannot update $rpmspec: $!";
foreach my $line (@spec) {
print SPEC $line unless $line =~ /Patch/ && $line !~ /Patch0:/;
my $i;
if ($line =~ /Patch0/) {
for ($i = 0 ; $i <= $#patches ; $i++) {
printf SPEC "Patch%d: %s\n", $i+1, $patches[$i];
}
}
}
close SPEC or die "cannot save $rpmspec: $!";
if (@patches) {
`git add *.patch $rpmspec`;
}