Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
![]() |
9700e166c3 | |
![]() |
836b4e3d7c | |
![]() |
c8afc5ecbc | |
![]() |
9059912187 |
|
@ -0,0 +1,8 @@
|
||||||
|
# The first profile is the default
|
||||||
|
[gitpublishprofile "rhel"]
|
||||||
|
base = rhel7/master-1.4.3
|
||||||
|
prefix = RHEL-7.4 dtc PATCH
|
||||||
|
to = rhvirt-patches@redhat.com
|
||||||
|
suppresscc = all
|
||||||
|
message = True
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
v*.tar.gz
|
|
@ -0,0 +1,67 @@
|
||||||
|
include Makefile.common
|
||||||
|
|
||||||
|
REDHAT:=$(shell pwd)
|
||||||
|
SCRIPTS:=$(REDHAT)/scripts
|
||||||
|
RPMBUILD:=$(REDHAT)/rpmbuild
|
||||||
|
|
||||||
|
# Hide command calls without debug option
|
||||||
|
ifeq ($(DEBUG),1)
|
||||||
|
DS=
|
||||||
|
else
|
||||||
|
DS=@
|
||||||
|
endif
|
||||||
|
|
||||||
|
BREW_OPTIONS:=$(BREW_FLAGS) --scratch
|
||||||
|
|
||||||
|
# Hide progress bar in scripts
|
||||||
|
ifeq ($(NOPROGRESS),1)
|
||||||
|
BREW_OPTIONS:=$(BREW_OPTIONS) --noprogress
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Do not wait for build finish
|
||||||
|
ifeq ($(NOWAIT),1)
|
||||||
|
BREW_OPTIONS:=$(BREW_OPTIONS) --nowait
|
||||||
|
endif
|
||||||
|
|
||||||
|
# create an empty localversion file if you don't want a local buildid
|
||||||
|
ifneq ($(NOLOCALVERSION),1)
|
||||||
|
ifeq ($(LOCALVERSION),)
|
||||||
|
LOCALVERSION=$(shell cat ../localversion 2>/dev/null)
|
||||||
|
endif
|
||||||
|
ifeq ($(LOCALVERSION),)
|
||||||
|
LOCALVERSION:=.test
|
||||||
|
else
|
||||||
|
LOCALVERSION:=.$(LOCALVERSION)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
LOCALVERSION:=
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: rh-brew rh-srpm rh-prep rh-help rh-clean-sources
|
||||||
|
all: rh-help
|
||||||
|
|
||||||
|
rh-clean-sources:
|
||||||
|
$(DS)for i in $(RPMBUILD)/SOURCES/*; do \
|
||||||
|
rm -f $$i; \
|
||||||
|
done; \
|
||||||
|
|
||||||
|
rh-prep: rh-clean-sources
|
||||||
|
$(DS)if [ -n "$(SOURCES_FILELIST)" ]; then \
|
||||||
|
echo "Copying Sources: $(SOURCES_FILELIST)"; \
|
||||||
|
cp $(SOURCES_FILELIST) $(RPMBUILD)/SOURCES; \
|
||||||
|
fi
|
||||||
|
$(DS)$(SCRIPTS)/process-patches.sh "$(SCRIPTS)" "$(NAME)" "$(VERSION)" "$(RELEASE)" "$(DATE)" "$(COMMIT)" "$(TARFILE)" "$(TARURL)" "$(SPECFILE)" "$(BUILD_DIR)" "$(MARKER)" "$(LOCALVERSION)" "$(RHEV)" "$(ZRELEASE)"
|
||||||
|
|
||||||
|
rh-srpm: rh-prep
|
||||||
|
$(DS)rpmbuild --define "_sourcedir $(RPMBUILD)/SOURCES" --define "_builddir $(RPMBUILD)/BUILD" --define "_srcrpmdir $(RPMBUILD)/SRPMS" --define "_rpmdir $(RPMBUILD)/RPMS" --define "_specdir $(RPMBUILD)/SPECS" --define "dist $(DIST)" --nodeps -bs $(RPMBUILD)/SPECS/$(SPECFILE)
|
||||||
|
|
||||||
|
rh-brew: rh-srpm
|
||||||
|
@echo "Build $(SRPM_NAME)$(LOCALVERSION).src.rpm as $(BUILD_TARGET)"
|
||||||
|
$(DS)brew build $(BREW_OPTIONS) $(BUILD_TARGET) $(RPMBUILD)/SRPMS/$(SRPM_NAME)$(LOCALVERSION).src.rpm
|
||||||
|
|
||||||
|
rh-help:
|
||||||
|
@echo "rh-brew: Build package on brew"
|
||||||
|
@echo "rh-srpm: Prepare srpm package"
|
||||||
|
@echo "rh-prep: Prepare sources and spec file in rpmbuild/"
|
||||||
|
@echo "rh-help: Print this help"
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
UNAME:=dtc
|
||||||
|
NAME:=dtc
|
||||||
|
RHEV:=0
|
||||||
|
VERSION:=1.4.3
|
||||||
|
DATE:=
|
||||||
|
COMMIT:=
|
||||||
|
RELEASE:=1
|
||||||
|
ZRELEASE:=
|
||||||
|
RELEASE_SEPARATOR:=-
|
||||||
|
|
||||||
|
TARFILE:=v$(VERSION).tar.gz
|
||||||
|
TARURL:=https://github.com/dgibson/dtc/archive/v1.4.3.tar.gz
|
||||||
|
TARSHA1:=cef129e4444a52dcd704c08c6375fa3894954048
|
||||||
|
MARKER:=fa8bc7f928ac25f23532afc8beb2073efc8fb063
|
||||||
|
SOURCES_FILELIST:=
|
||||||
|
|
||||||
|
SPECFILE:=$(NAME).spec
|
||||||
|
DIST:=.el7
|
||||||
|
BUILD_TARGET:=rhel-7.3-candidate
|
||||||
|
|
||||||
|
ifeq ($(RHEV),1)
|
||||||
|
NAME_SUFFIX:=-rhev
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(VERSION),)
|
||||||
|
BUILD_DIR:=$(UNAME)-$(VERSION)
|
||||||
|
SRPM_NAME:=$(NAME)$(NAME_SUFFIX)-$(VERSION)$(RELEASE_SEPARATOR)$(RELEASE)$(DIST)
|
||||||
|
else
|
||||||
|
BUILD_DIR:=$(UNAME)-$(GITCOMMIT
|
||||||
|
SRPM_NAME:=$(NAME)$(NAME_SUFFIX)-$(DATE)-$(RELEASE).git$(COMMIT)$(DIST)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(ZRELEASE),)
|
||||||
|
SRPM_NAME:=$(SRPM_NAME).$(ZRELEASE)
|
||||||
|
endif
|
|
@ -0,0 +1,86 @@
|
||||||
|
Name: dtc
|
||||||
|
Version: %%VERSION%%
|
||||||
|
Release: %%RELEASE%%%{?dist}%%ZRELEASE%%%%LOCALVERSION%%
|
||||||
|
Summary: Device Tree Compiler
|
||||||
|
Group: Development/Tools
|
||||||
|
License: GPLv2+
|
||||||
|
URL: https://github.com/dgibson/dtc
|
||||||
|
Source: https://github.com/dgibson/dtc/archive/v%{version}.tar.gz
|
||||||
|
|
||||||
|
%%PATCHLIST%%
|
||||||
|
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
|
|
||||||
|
BuildRequires: flex, bison
|
||||||
|
ExclusiveArch: %{power64} aarch64
|
||||||
|
|
||||||
|
%description
|
||||||
|
The Device Tree Compiler generates flattened Open Firmware style device trees
|
||||||
|
for use with PowerPC machines that lack an Open Firmware implementation
|
||||||
|
|
||||||
|
%package -n libfdt
|
||||||
|
Summary: Device tree library
|
||||||
|
Group: Development/Libraries
|
||||||
|
|
||||||
|
%description -n libfdt
|
||||||
|
libfdt is a library to process Open Firmware style device trees on various
|
||||||
|
architectures.
|
||||||
|
|
||||||
|
%package -n libfdt-devel
|
||||||
|
Summary: Development headers for device tree library
|
||||||
|
Group: Development/Libraries
|
||||||
|
Requires: libfdt = %{version}-%{release}
|
||||||
|
|
||||||
|
%description -n libfdt-devel
|
||||||
|
This package provides development files for libfdt
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -n dtc-%{version}
|
||||||
|
|
||||||
|
%%PATCHAPPLY%%
|
||||||
|
|
||||||
|
%build
|
||||||
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
make install DESTDIR=$RPM_BUILD_ROOT PREFIX=/usr LIBDIR=%{_libdir}
|
||||||
|
rm -rf $RPM_BUILD_ROOT/%{_libdir}/*.a
|
||||||
|
|
||||||
|
# we don't want or need ftdump, so drop
|
||||||
|
rm -f $RPM_BUILD_ROOT/%{_bindir}/ftdump
|
||||||
|
|
||||||
|
%clean
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%doc GPL
|
||||||
|
%{_bindir}/*
|
||||||
|
|
||||||
|
%files -n libfdt
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%doc GPL
|
||||||
|
%{_libdir}/libfdt-%{version}.so
|
||||||
|
%{_libdir}/libfdt.so.*
|
||||||
|
|
||||||
|
%files -n libfdt-devel
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%{_libdir}/libfdt.so
|
||||||
|
%{_includedir}/*
|
||||||
|
|
||||||
|
%post -n libfdt -p /sbin/ldconfig
|
||||||
|
|
||||||
|
%postun -n libfdt -p /sbin/ldconfig
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Mon Mar 06 2017 Miroslav Rezanina <mrezanin@redhat.com> - 1.4.3-1
|
||||||
|
- Rebase to 1.4.3 [bz#1427157]
|
||||||
|
- Resolves: bz#1427157
|
||||||
|
(package libfdt 1.4.3, when available)
|
||||||
|
|
||||||
|
* Tue Aug 19 2014 Miroslav Rezanina <mrezanin@redhat.com> - 1.4.0-2
|
||||||
|
- Update power macro for ppc64le
|
||||||
|
|
||||||
|
* Fri Jul 25 2014 Miroslav Rezanina <mrezanin@redhat.com> - 1.4.0-1
|
||||||
|
- Initial version
|
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def filter_file(inf):
|
||||||
|
ts_chunkstart = re.compile("diff --git ")
|
||||||
|
ts_redhat = re.compile(".*\/redhat\/")
|
||||||
|
ts_gitfile = re.compile(".*\/\.git")
|
||||||
|
skip = False
|
||||||
|
f = open(inf,"r")
|
||||||
|
for line in f.readlines():
|
||||||
|
if ts_chunkstart.match(line) is not None:
|
||||||
|
if ts_redhat.match(line) is not None or ts_gitfile.match(line) is not None:
|
||||||
|
skip = True
|
||||||
|
else:
|
||||||
|
skip = False
|
||||||
|
if skip == False:
|
||||||
|
sys.stdout.write(line)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
print("Usage: %s <filename>" % sys.argv[0])
|
||||||
|
exit(1)
|
||||||
|
filter_file(sys.argv[1])
|
||||||
|
|
|
@ -0,0 +1,327 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# See $desc, below, for program description
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# Author(s):
|
||||||
|
# Jeff Cody <jcody@redhat.com>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify it under
|
||||||
|
# the terms of the GNU General Public License as published by the Free Software
|
||||||
|
# Foundation; under version 2 of the license
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
# details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along with
|
||||||
|
# this program; if not, see <http://www.gnu.org/licenses/gpl-2.0.html>.
|
||||||
|
#
|
||||||
|
|
||||||
|
set -C -u -e
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
desc="
|
||||||
|
$0 compares the commits in a specified git range, with the corresponding
|
||||||
|
upstream commit. This assumes that you have both the downstream and
|
||||||
|
upstream repositories added as remotes in your git repo.
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
$0 -r qemu-kvm-0.12.1.2-2.370.el6..my_feature_branch -u v1.5.0
|
||||||
|
|
||||||
|
Ouput key:
|
||||||
|
[----] Indicates the patches upstream and downstream are identical
|
||||||
|
[####] Indicates the number of differences (#### is substituted)
|
||||||
|
[down] Indicates the patch only exists downstream"
|
||||||
|
|
||||||
|
def_upstream="v1.7.0"
|
||||||
|
def_diffprog=meld
|
||||||
|
def_range="HEAD^!"
|
||||||
|
def_color='y'
|
||||||
|
def_pause='y'
|
||||||
|
def_sensitivity=0
|
||||||
|
def_summary='n'
|
||||||
|
|
||||||
|
upstream=`git config backport-diff.upstream || true`
|
||||||
|
diffprog=`git config backport-diff.diffprog || true`
|
||||||
|
range=`git config backport-diff.range || true`
|
||||||
|
color=`git config backport-diff.color || true`
|
||||||
|
pause=`git config backport-diff.pause || true`
|
||||||
|
sensitivity=`git config backport-diff.sensitivity || true`
|
||||||
|
summary=`git config backport-diff.summary || true`
|
||||||
|
|
||||||
|
if [[ -z "$upstream" ]]
|
||||||
|
then
|
||||||
|
upstream=$def_upstream
|
||||||
|
git config backport-diff.upstream $upstream || true
|
||||||
|
fi
|
||||||
|
if [[ -z "$diffprog" ]]
|
||||||
|
then
|
||||||
|
diffprog=$def_diffprog
|
||||||
|
git config backport-diff.diffprog $diffprog || true
|
||||||
|
fi
|
||||||
|
if [[ -z "$range" ]]
|
||||||
|
then
|
||||||
|
range=$def_range
|
||||||
|
git config backport-diff.range $range || true
|
||||||
|
fi
|
||||||
|
if [[ -z "$color" ]]
|
||||||
|
then
|
||||||
|
color=$def_color
|
||||||
|
git config backport-diff.color $color || true
|
||||||
|
fi
|
||||||
|
if [[ -z "$pause" ]]
|
||||||
|
then
|
||||||
|
pause=$def_pause
|
||||||
|
git config backport-diff.pause $pause || true
|
||||||
|
fi
|
||||||
|
if [[ -z "$sensitivity" ]]
|
||||||
|
then
|
||||||
|
sensitivity=$def_sensitivity
|
||||||
|
git config backport-diff.sensitivity $sensitivity || true
|
||||||
|
fi
|
||||||
|
if [[ -z "$summary" ]]
|
||||||
|
then
|
||||||
|
summary=$def_summary
|
||||||
|
git config backport-diff.summary $summary || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo ""
|
||||||
|
echo "$0 [OPTIONS]"
|
||||||
|
echo "$desc"
|
||||||
|
echo ""
|
||||||
|
echo "OPTIONS:"
|
||||||
|
echo " -r git range
|
||||||
|
optional; default is '$range'
|
||||||
|
"
|
||||||
|
echo " -u upstream git tag / branch / id
|
||||||
|
optional; default is '$upstream'
|
||||||
|
"
|
||||||
|
echo " -n do not use colors
|
||||||
|
"
|
||||||
|
echo " -d diff program to use
|
||||||
|
optional; default is '$diffprog'
|
||||||
|
"
|
||||||
|
echo " -p do not pause when viewing diffs
|
||||||
|
"
|
||||||
|
echo " -s sensitivity level of diff compares
|
||||||
|
0: only show functional code differences
|
||||||
|
1: show (0) + contextual differences
|
||||||
|
2+: offer to compare all patches, regardless of any differences
|
||||||
|
"
|
||||||
|
echo " -S summary only (no diff viewing)
|
||||||
|
"
|
||||||
|
echo " -h help"
|
||||||
|
echo ""
|
||||||
|
echo "You can set each of the default options using git-config:"
|
||||||
|
echo " git config backport-diff.upstream"
|
||||||
|
echo " git config backport-diff.diffprog"
|
||||||
|
echo " git config backport-diff.range"
|
||||||
|
echo " git config backport-diff.color"
|
||||||
|
echo " git config backport-diff.pause"
|
||||||
|
echo " git config backport-diff.summary"
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts ":r:u:nd:phs:S" opt
|
||||||
|
do
|
||||||
|
case $opt in
|
||||||
|
r) range=$OPTARG
|
||||||
|
;;
|
||||||
|
u) upstream=$OPTARG
|
||||||
|
;;
|
||||||
|
n) color='n'
|
||||||
|
;;
|
||||||
|
d) diffprog=$OPTARG
|
||||||
|
;;
|
||||||
|
p) pause='n'
|
||||||
|
;;
|
||||||
|
s) sensitivity=$OPTARG
|
||||||
|
if ! [[ "$sensitivity" =~ ^[0-9]+$ ]]
|
||||||
|
then
|
||||||
|
echo "Invalid argument for -s" >&2
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
S) summary='y'
|
||||||
|
;;
|
||||||
|
h) usage
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
\?) echo "Unknown option: -$OPTARG" >&2
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $color == 'y' ]]
|
||||||
|
then
|
||||||
|
bold=$(tput bold)
|
||||||
|
color1=$(tput setaf 1)
|
||||||
|
color2=$(tput setaf 2)
|
||||||
|
color3=$(tput setaf 3)
|
||||||
|
color4=$(tput setaf 4)
|
||||||
|
color5=$(tput setaf 5)
|
||||||
|
color6=$(tput setaf 6)
|
||||||
|
color7=$(tput setaf 7)
|
||||||
|
reset=$(tput sgr0)
|
||||||
|
else
|
||||||
|
bold=
|
||||||
|
color1=
|
||||||
|
color2=
|
||||||
|
color3=
|
||||||
|
color4=
|
||||||
|
color5=
|
||||||
|
color6=
|
||||||
|
color7=
|
||||||
|
reset=
|
||||||
|
fi
|
||||||
|
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo $reset
|
||||||
|
}
|
||||||
|
|
||||||
|
total=`git rev-list "$range" |wc -l`
|
||||||
|
|
||||||
|
# verify the upstream exists
|
||||||
|
upstream_valid='n'
|
||||||
|
# branch
|
||||||
|
if git show-ref --quiet --verify refs/heads/${upstream}
|
||||||
|
then
|
||||||
|
upstream_valid='y'
|
||||||
|
# tag
|
||||||
|
elif git show-ref --quiet --verify refs/tags/${upstream}
|
||||||
|
then
|
||||||
|
upstream_valid='y'
|
||||||
|
# remote branch
|
||||||
|
elif git show-ref --quiet --verify refs/remotes/${upstream}
|
||||||
|
then
|
||||||
|
upstream_valid='y'
|
||||||
|
# commit id
|
||||||
|
elif git rev-list --max-count=1 --quiet $upstream >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
upstream_valid='y'
|
||||||
|
fi
|
||||||
|
|
||||||
|
numdiff=0
|
||||||
|
label=
|
||||||
|
subjlist=
|
||||||
|
cnt=0
|
||||||
|
compare_git()
|
||||||
|
{
|
||||||
|
echo "Key:"
|
||||||
|
printf "[----] : patches are identical\n"
|
||||||
|
printf "[${bold}####${reset}] : number of functional differences between upstream/downstream patch\n"
|
||||||
|
printf "[${bold}${color1}down${reset}] : patch is downstream-only\n"
|
||||||
|
printf "The flags [${bold}FC${reset}] indicate (F)unctional and (C)ontextual differences, respectively\n\n"
|
||||||
|
# don't pipe the git job into read, to avoid subshells
|
||||||
|
while read hashsubj
|
||||||
|
do
|
||||||
|
let cnt=$cnt+1;
|
||||||
|
subj=${hashsubj:40}
|
||||||
|
downhash=${hashsubj:0:40}
|
||||||
|
# A little bit hackish, but find the match by looking at upstream
|
||||||
|
# subject lines, and using the last one. Not all backports contain
|
||||||
|
# the phrase "cherry-pick", so we can't really try and find the
|
||||||
|
# upstream hash from that...
|
||||||
|
uphash=`git log $upstream --pretty=format:"%H" --fixed-strings --grep="${subj}" |tail -n 1`
|
||||||
|
if [[ -n "$uphash" ]]
|
||||||
|
then
|
||||||
|
numdiff=`diff -u <(git diff $uphash^! |egrep ^[-+])\
|
||||||
|
<(git diff $downhash^! |egrep ^[-+])\
|
||||||
|
| egrep '^[-+]' | egrep -v '^[-+]{3}' |wc -l || true`
|
||||||
|
# for contextual diff checking, we will ignore hashes and line number offsets
|
||||||
|
condiff=`diff -u <(git diff $uphash^\! |sed -e s/^@@.*@@//g |egrep -v ^index |egrep -v ^diff)\
|
||||||
|
<(git diff $downhash^\!|sed -e s/^@@.*@@//g |egrep -v ^index |egrep -v ^diff)\
|
||||||
|
| egrep '^[-+]' | egrep -v '^[-+]{3}'|wc -l || true`
|
||||||
|
f="-"
|
||||||
|
c="-"
|
||||||
|
if [[ $sensitivity -gt 1 ]]
|
||||||
|
then
|
||||||
|
showdiff=1
|
||||||
|
else
|
||||||
|
showdiff=0
|
||||||
|
fi
|
||||||
|
if [[ $condiff -ne 0 ]]
|
||||||
|
then
|
||||||
|
c=${bold}C${reset}
|
||||||
|
if [[ $sensitivity -gt 0 ]]
|
||||||
|
then
|
||||||
|
showdiff=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ $numdiff -ne 0 ]]
|
||||||
|
then
|
||||||
|
f=${bold}F${reset}
|
||||||
|
showdiff=1
|
||||||
|
printf "%03d/${total}:[${bold}%04d${reset}] [${f}${c}] ${bold}${color4}'%s'${reset}\n" $cnt $numdiff "$subj"
|
||||||
|
else
|
||||||
|
printf "%03d/$total:[----] [${f}${c}] '%s'\n" $cnt "$subj"
|
||||||
|
fi
|
||||||
|
if [[ $showdiff -eq 1 ]]
|
||||||
|
then
|
||||||
|
if [[ $diffprog == "meld" ]]
|
||||||
|
then
|
||||||
|
label="--label=\"Patch #$cnt: $subj\" --label=\" \""
|
||||||
|
fi
|
||||||
|
subjlist[$cnt]=$subj
|
||||||
|
exe[$cnt]="${label} <(git show $uphash^!) <(git show $downhash^!) 2>/dev/null"
|
||||||
|
shortexe[$cnt]="<(git show ${uphash:0:7}^\!) <(git show ${downhash:0:7}^\!)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
printf "%03d/$total:[${bold}${color1}down${reset}] ${bold}${color4}'%s'${reset}\n" $cnt "$subj"
|
||||||
|
fi
|
||||||
|
done < <(git log --pretty=tformat:"%H%s" --reverse $range)
|
||||||
|
}
|
||||||
|
|
||||||
|
show_diff()
|
||||||
|
{
|
||||||
|
echo "Do you want to view the diffs using ${bold}${diffprog}${reset}? y/[n]: "
|
||||||
|
read -n 1 view
|
||||||
|
echo ""
|
||||||
|
if [[ "$view" == "y" ]]
|
||||||
|
then
|
||||||
|
for idx in ${!exe[*]}
|
||||||
|
do
|
||||||
|
if [[ $pause == 'y' ]]
|
||||||
|
then
|
||||||
|
echo "Press [Enter] to view diff(diff) of ${idx}/${total}: ${bold}${color4}${subjlist[$idx]}${reset}"
|
||||||
|
read
|
||||||
|
else
|
||||||
|
echo "Viewing diff(diff) of ${idx}/${total}: ${bold}${color4}${subjlist[$idx]}${reset}"
|
||||||
|
fi
|
||||||
|
eval ${diffprog} ${exe[$idx]} || true
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $upstream_valid != 'y' ]]
|
||||||
|
then
|
||||||
|
echo "Upstream $upstream is not valid (does not exist)!"
|
||||||
|
echo "Do you need to add the remote upstream repo?"
|
||||||
|
exit 2
|
||||||
|
fi >&2
|
||||||
|
|
||||||
|
compare_git
|
||||||
|
|
||||||
|
if [[ $summary != 'y' ]]
|
||||||
|
then
|
||||||
|
show_diff
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${!shortexe[*]} != '' ]]
|
||||||
|
then
|
||||||
|
echo ""
|
||||||
|
echo "To view diffs later, you may run:"
|
||||||
|
for idx in ${!shortexe[*]}
|
||||||
|
do
|
||||||
|
printf "%03d/$total: '${diffprog} ${shortexe[$idx]}'\n" $idx
|
||||||
|
done
|
||||||
|
fi
|
|
@ -0,0 +1,215 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# See $desc, below, for program description
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# Author(s):
|
||||||
|
# Jeff Cody <jcody@redhat.com>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify it under
|
||||||
|
# the terms of the GNU General Public License as published by the Free Software
|
||||||
|
# Foundation; under version 2 of the license
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
# details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along with
|
||||||
|
# this program; if not, see <http://www.gnu.org/licenses/gpl-2.0.html>.
|
||||||
|
#
|
||||||
|
|
||||||
|
set -C -u -e
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
desc="
|
||||||
|
$0 iterates through a git commit range, and performs the
|
||||||
|
following on each commit:
|
||||||
|
- git checkout
|
||||||
|
- make clean
|
||||||
|
- configure
|
||||||
|
- make
|
||||||
|
|
||||||
|
It will also optionally perform a git-reset and git-clean between
|
||||||
|
checkouts, if requested via the '-f' option.
|
||||||
|
|
||||||
|
The script will exit and report on first error on any of the above steps,
|
||||||
|
(except no error checking is performed on 'make clean')
|
||||||
|
|
||||||
|
NOTE: While executing, the script will checkout out each commit
|
||||||
|
in the range in the current git tree. On exit, the HEAD
|
||||||
|
at the time the script was called is checked out"
|
||||||
|
|
||||||
|
|
||||||
|
# default range is the last commit
|
||||||
|
def_range="HEAD^!"
|
||||||
|
def_config_opt="--target-list=x86_64-softmmu"
|
||||||
|
# you may want to have make perform multiple jobs, e.g. -j4
|
||||||
|
# this is ommitted as the default in case the project makefile
|
||||||
|
# is not safe for parallel make processes
|
||||||
|
def_make_opt=""
|
||||||
|
def_log="output-$$.log"
|
||||||
|
def_logdir=""
|
||||||
|
force_clean='n'
|
||||||
|
|
||||||
|
logfile=$def_log
|
||||||
|
range=`git config compile-check.range || true`
|
||||||
|
config_opt=`git config compile-check.configopt || true`
|
||||||
|
make_opt=`git config compile-check.makeopt || true`
|
||||||
|
logdir=`git config compile-check.logdir || true`
|
||||||
|
|
||||||
|
if [[ -z "$range" ]]
|
||||||
|
then
|
||||||
|
range=$def_range
|
||||||
|
git config compile-check.range $range || true
|
||||||
|
fi
|
||||||
|
if [[ -z "$config_opt" ]]
|
||||||
|
then
|
||||||
|
config_opt=$def_config_opt
|
||||||
|
git config compile-check.configopt $config_opt || true
|
||||||
|
fi
|
||||||
|
if [[ -z "$make_opt" ]]
|
||||||
|
then
|
||||||
|
make_opt=$def_make_opt
|
||||||
|
git config compile-check.makeopt $make_opt || true
|
||||||
|
fi
|
||||||
|
if [[ -z "$logdir" ]]
|
||||||
|
then
|
||||||
|
logdir=$def_logdir
|
||||||
|
git config compile-check.logdir $logdir || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo ""
|
||||||
|
echo "$0 [OPTIONS]"
|
||||||
|
echo "$desc"
|
||||||
|
echo ""
|
||||||
|
echo "OPTIONS:"
|
||||||
|
echo " -r git range
|
||||||
|
optional; default is '$range'
|
||||||
|
"
|
||||||
|
echo " -c configure options
|
||||||
|
optional; default is '$config_opt'
|
||||||
|
"
|
||||||
|
echo " -m make options
|
||||||
|
optional; default is '$make_opt'
|
||||||
|
"
|
||||||
|
echo " -d log dir
|
||||||
|
optional; default is '$logdir'
|
||||||
|
"
|
||||||
|
echo " -l log filename
|
||||||
|
optional; default is output-PROCID, where PROCID is the bash process id
|
||||||
|
note: you may specify a full path for the log filename here, and exclude the
|
||||||
|
-d option.
|
||||||
|
"
|
||||||
|
echo " -f force a git reset and clean
|
||||||
|
this will cause a 'git reset --hard; git clean -fdx' to be run between checkouts.
|
||||||
|
!! WARNING: This may cause data loss in your git tree.
|
||||||
|
READ the git-clean and git-reset man pages and make
|
||||||
|
sure you understand the implications of
|
||||||
|
'git clean -fdx' and 'git reset --hard' before using !!
|
||||||
|
If you specify this option, make sure the logfile falls outside of the tree.
|
||||||
|
"
|
||||||
|
echo " -h help"
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts ":r:c:m:l:d:hf" opt
|
||||||
|
do
|
||||||
|
case $opt in
|
||||||
|
r) range=$OPTARG
|
||||||
|
;;
|
||||||
|
c) config_opt=$OPTARG
|
||||||
|
;;
|
||||||
|
m) make_opt=$OPTARG
|
||||||
|
;;
|
||||||
|
d) logdir=$OPTARG
|
||||||
|
;;
|
||||||
|
l) logfile=$OPTARG
|
||||||
|
;;
|
||||||
|
f) force_clean='y'
|
||||||
|
;;
|
||||||
|
h) usage
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
\?) echo "Unknown option: -$OPTARG" >&2
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# append a '/' to logdir if $logdir was specified without one
|
||||||
|
[[ -n "$logdir" ]] && [[ ${logdir:${#logdir}-1} != "/" ]] && logdir="${logdir}/"
|
||||||
|
|
||||||
|
logfile="${logdir}${logfile}"
|
||||||
|
|
||||||
|
head=`git rev-parse --abbrev-ref=strict HEAD`
|
||||||
|
if [ HEAD = "$head" ]
|
||||||
|
then
|
||||||
|
# we're at a detached head, get hash
|
||||||
|
head=`git rev-parse HEAD`
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
total=`git rev-list "$range" |wc -l`
|
||||||
|
|
||||||
|
echo "log output: $logfile"
|
||||||
|
|
||||||
|
rm -f "$logfile"
|
||||||
|
date > "$logfile"
|
||||||
|
echo "git compile check for $range." >> "$logfile"
|
||||||
|
echo "* configure options='$config_opt'" >> "$logfile"
|
||||||
|
echo "* make options='$make_opt'" >> "$logfile"
|
||||||
|
echo "Performing a test compile on $total patches" | tee -a "$logfile"
|
||||||
|
echo "-------------------------------------------------------------" >> "$logfile"
|
||||||
|
echo "" | tee -a "$logfile"
|
||||||
|
|
||||||
|
clean_repo() {
|
||||||
|
if [[ $force_clean == 'y' ]]
|
||||||
|
then
|
||||||
|
git reset --hard >> "$logfile" 2>&1 || true
|
||||||
|
git clean -fdx >> "$logfile" 2>&1 || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# we want to cleanup and return the git tree back to the previous head
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo ""
|
||||||
|
echo -n "Cleaning up..."
|
||||||
|
clean_repo
|
||||||
|
git checkout $head > /dev/null 2>&1
|
||||||
|
echo "done."
|
||||||
|
}
|
||||||
|
|
||||||
|
cnt=1
|
||||||
|
# don't pipe the git job into read, to avoid subshells
|
||||||
|
while read hash
|
||||||
|
do
|
||||||
|
txt=`git log --pretty=tformat:"%h: %s" $hash^!`
|
||||||
|
echo "${cnt}/${total}: compiling: $txt" | tee -a "$logfile"
|
||||||
|
let cnt=$cnt+1;
|
||||||
|
echo "####################" >> "$logfile"
|
||||||
|
clean_repo
|
||||||
|
make clean > /dev/null 2>&1 || true
|
||||||
|
git checkout $hash >> "$logfile" 2>&1 && \
|
||||||
|
./configure $config_opt >> "$logfile" 2>&1 && \
|
||||||
|
make $make_opt >> "$logfile" 2>&1 ||
|
||||||
|
(
|
||||||
|
S=$?
|
||||||
|
# don't complain for SIGINT, SIGTERM, SIGQUIT
|
||||||
|
if [ $S -ne 130 ] && [ $S -ne 131 ] && [ $S -ne 143 ]
|
||||||
|
then
|
||||||
|
echo "" | tee -a "$logfile"
|
||||||
|
echo "ERROR: commit $hash failed to build!" | tee -a "$logfile"
|
||||||
|
git show --stat $hash | tee -a "$logfile"
|
||||||
|
fi
|
||||||
|
exit 1
|
||||||
|
)
|
||||||
|
done < <(git log $range --pretty=tformat:"%H" --reverse)
|
||||||
|
|
||||||
|
echo "
|
||||||
|
All patches in $range compiled successfully!" | tee -a "$logfile"
|
||||||
|
exit 0
|
|
@ -0,0 +1,77 @@
|
||||||
|
SCRIPTS=$1
|
||||||
|
shift
|
||||||
|
NAME=$1
|
||||||
|
shift
|
||||||
|
VERSION=$1
|
||||||
|
shift
|
||||||
|
RELEASE=$1
|
||||||
|
shift
|
||||||
|
DATE=$1
|
||||||
|
shift
|
||||||
|
COMMIT=$1
|
||||||
|
shift
|
||||||
|
TARBALL=$1
|
||||||
|
shift
|
||||||
|
TARURL=$1
|
||||||
|
shift
|
||||||
|
SPECNAME=$1
|
||||||
|
shift
|
||||||
|
BUILDDIR_NAME=$1
|
||||||
|
shift
|
||||||
|
MARKER=$1
|
||||||
|
shift
|
||||||
|
LOCALVERSION=$1
|
||||||
|
shift
|
||||||
|
RHEV=$1
|
||||||
|
shift
|
||||||
|
ZRELEASE=$1
|
||||||
|
|
||||||
|
SOURCES=rpmbuild/SOURCES
|
||||||
|
SRPMDIR=rpmbuild/SRPM
|
||||||
|
BUILDDIR=${SOURCES}/${BUILDDIR_NAME}
|
||||||
|
SPEC=rpmbuild/SPECS/${SPECNAME}
|
||||||
|
|
||||||
|
# Pre-cleaning
|
||||||
|
rm -rf .tmp asection psection patchlist
|
||||||
|
|
||||||
|
if [ ! -f ${TARBALL} ]; then
|
||||||
|
wget ${TARURL}
|
||||||
|
fi
|
||||||
|
cp ${TARBALL} ${SOURCES}/${TARBALL}
|
||||||
|
|
||||||
|
if [ -n "${ZRELEASE}" ]; then
|
||||||
|
ZRELEASE=.${ZRELEASE}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Handle patches
|
||||||
|
git format-patch --first-parent --no-renames -k --no-binary ${MARKER}.. > patchlist
|
||||||
|
for patchfile in `cat patchlist`; do
|
||||||
|
${SCRIPTS}/frh.py ${patchfile} > .tmp
|
||||||
|
if grep -q '^diff --git ' .tmp; then
|
||||||
|
num=$(echo $patchfile | sed 's/\([0-9]*\).*/\1/')
|
||||||
|
echo "Patch${num}: ${patchfile}" >> psection
|
||||||
|
echo "%patch${num} -p1" >> asection
|
||||||
|
mv .tmp ${SOURCES}/${patchfile}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Handle spec file
|
||||||
|
cp ${SPECNAME}.template ${SPEC}
|
||||||
|
|
||||||
|
sed -i -e "/%%PATCHLIST%%/r psection
|
||||||
|
/%%PATCHLIST%%/d
|
||||||
|
/%%PATCHAPPLY%%/r asection
|
||||||
|
/%%PATCHAPPLY%%/d
|
||||||
|
s/%%VERSION%%/${VERSION}/
|
||||||
|
s/%%RELEASE%%/${RELEASE}/
|
||||||
|
s/%%ZRELEASE%%/${ZRELEASE}/
|
||||||
|
s/%%DATE%%/${DATE}/
|
||||||
|
s/%%COMMIT%%/${COMMIT}/
|
||||||
|
s/%%LOCALVERSION%%/${LOCALVERSION}/
|
||||||
|
s/%%TARBALL%%/${TARBALL}/
|
||||||
|
s/%%RHEV%%/${RHEV}/" $SPEC
|
||||||
|
|
||||||
|
# Final cleaning
|
||||||
|
rm -rf `cat patchlist`
|
||||||
|
rm -rf .tmp asection psection patchlist
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
sha1sum < $1 | cut -d ' ' -f 1
|
Loading…
Reference in New Issue