- update save-content-to-an-array.diff with upstream version

OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory:rpmlint/rpmlint?expand=0&rev=318
This commit is contained in:
Ludwig Nussel 2015-04-20 14:11:01 +00:00 committed by Git OBS Bridge
parent bda5d592a2
commit dadba5cd0e
3 changed files with 155 additions and 10 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Apr 20 14:10:14 UTC 2015 - lnussel@suse.de
- update save-content-to-an-array.diff with upstream version
-------------------------------------------------------------------
Fri Apr 10 11:16:01 UTC 2015 - lnussel@suse.de

View File

@ -1,20 +1,21 @@
From 6e26550f7b5583ab15ed5573bf8093d0adbf4cb0 Mon Sep 17 00:00:00 2001
From 47b0d8ce1a36006e99ccc5e6c8f75be322b6fbac Mon Sep 17 00:00:00 2001
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Fri, 10 Apr 2015 16:22:26 +0200
Subject: [PATCH rpmlint] save content to an array
Subject: [PATCH] save content to an array
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
due to the following join the generator would be at the end so iterating
through lines wouldn't work
Upstream ticket:
https://sourceforge.net/p/rpmlint/tickets/44/
Modified-by: Ville Skyttä <ville.skytta@iki.fi> (pep8 fixes)
---
InitScriptCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/InitScriptCheck.py b/InitScriptCheck.py
index 1a58562..9d197e5 100644
index 1a58562..aab1d2d 100644
--- a/InitScriptCheck.py
+++ b/InitScriptCheck.py
@@ -103,7 +103,7 @@ class InitScriptCheck(AbstractCheck.AbstractCheck):
@ -22,10 +23,7 @@ index 1a58562..9d197e5 100644
content = None
try:
- content = Pkg.readlines(pkgfile.path)
+ content = [ x for x in Pkg.readlines(pkgfile.path) ]
+ content = [x for x in Pkg.readlines(pkgfile.path)]
except Exception:
e = sys.exc_info()[1]
printWarning(pkg, 'read-error', e)
--
2.3.4

142
update_git.sh Normal file
View File

@ -0,0 +1,142 @@
#!/bin/bash -e
#
# based on qemu's update_git.sh this program updates the patches
# applied on top of a tarball based on commmits in git
GIT_TREE=git://git.code.sf.net/p/rpmlint/code
GIT_LOCAL_TREE=~/git/rpmlint-code
GIT_BRANCH=opensuse-1.6
GIT_UPSTREAM_TAG=v1.6
cleanup()
{
[ -z "$GIT_DIR" ] || rm -rf "$GIT_DIR"
[ -z "$CMP_DIR" ] || rm -rf "$GIT_DIR"
}
trap cleanup EXIT
GIT_DIR=`mktemp -d --tmpdir update_git.XXXXXXXXXX`
CMP_DIR=`mktemp -d --tmpdir update_git.XXXXXXXXXX`
if [ -d "$GIT_LOCAL_TREE" ]; then
echo "Processing $GIT_BRANCH branch of local git tree, using tag:" \
"$GIT_UPSTREAM_TAG"
if ! (cd $GIT_LOCAL_TREE && git show-branch $GIT_BRANCH &>/dev/null); then
echo "Error: Branch $GIT_BRANCH not found - please create a remote" \
"tracking branch of origin/$GIT_BRANCH"
exit
fi
git clone -ls $GIT_LOCAL_TREE $GIT_DIR -b $GIT_BRANCH
if ! (cd $GIT_LOCAL_TREE && git remote show upstream &>/dev/null); then
echo "Remote for upstream git tree not found. Next time add remote" \
"named upstream for $GIT_TREE and update"
(cd $GIT_DIR && git remote add upstream "$GIT_TREE")
(cd $GIT_DIR && git remote update)
fi
else
echo "Processing $GIT_BRANCH branch of remote git tree, using tag:" \
"$GIT_UPSTREAM_TAG"
echo "(For much fast processing, consider establishing a local git tree" \
"at $GIT_LOCAL_TREE)"
git clone $GIT_TREE $GIT_DIR -b $GIT_BRANCH
(cd $GIT_DIR && git remote add upstream "$GIT_TREE")
(cd $GIT_DIR && git remote update)
fi
(cd $GIT_DIR && git format-patch -N $GIT_UPSTREAM_TAG --suffix=.tmp -o $CMP_DIR >/dev/null)
CHANGED_COUNT=0
UNCHANGED_COUNT=0
DELETED_COUNT=0
ADDED_COUNT=0
shopt -s nullglob
patches=()
for i in $CMP_DIR/*.tmp; do
basename="${i##*/}"
newname=${basename%.tmp}
newname=${newname%.diff} # remove .diff suffix it exist
# limit file names to 40 chars before extension
newname=${newname:0:40}.diff
# remove git signature to make content independent of git
# version
head -n -3 "$i" > "$CMP_DIR/$newname"
rm "$i"
localname=${newname#*-}
patches+=("$localname")
if [ -e "$localname" ]; then
if cmp -s "$CMP_DIR/$newname" "$localname"; then
rm "$CMP_DIR/$newname"
let UNCHANGED_COUNT+=1
else
mv "$CMP_DIR/$newname" "$localname"
let CHANGED_COUNT+=1
fi
else
mv "$CMP_DIR/$newname" "$localname"
let ADDED_COUNT+=1
echo " $localname" >> qemu.changes.added
osc add "$localname"
fi
done
# delete dropped patches
for patch in *.diff; do
keep=
for i in "${patches[@]}"; do
if [ "$i" = "$patch" ]; then
keep=1
break
fi
done
if [ -z "$keep" ]; then
osc rm --force $patch
let DELETED_COUNT+=1
echo " $patch" >> qemu.changes.deleted
fi
done
for package in rpmlint; do
skip=
while IFS= read -r line; do
if [ "$line" = "# PATCHLIST END" ]; then
skip=
i=0
for patch in "${patches[@]}"; do
printf "Patch%02d: %s\n" "$i" "$patch"
let i+=1
done
fi
if [ -z "$skip" ]; then
echo "$line"
fi
if [ "$line" = "# PATCHLIST BEGIN" ]; then
skip=1
fi
done < $package.spec > $package.spec.new
if [ -e qemu.changes.deleted ]; then
echo "* Patches dropped:" >> $package.changes.proposed
cat qemu.changes.deleted >> $package.changes.proposed
fi
if [ -e qemu.changes.added ]; then
echo "* Patches added:" >> $package.changes.proposed
cat qemu.changes.added >> $package.changes.proposed
fi
if [ -e $package.changes.proposed ]; then
osc vc --file=$package.changes.proposed $package
rm -f $package.changes.proposed
fi
done
if [ -e qemu.changes.deleted ]; then
rm -f qemu.changes.deleted
fi
if [ -e qemu.changes.added ]; then
rm -f qemu.changes.added
fi
echo "git patch summary"
echo " unchanged: $UNCHANGED_COUNT"
echo " changed: $CHANGED_COUNT"
echo " deleted: $DELETED_COUNT"
echo " added: $ADDED_COUNT"