update makerepo.sh
This commit is contained in:
parent
f5efae3b83
commit
37b9dd1f1b
40
makerepo.sh
40
makerepo.sh
@ -9,6 +9,13 @@ die() {
|
|||||||
|
|
||||||
DIRNAME=NetworkManager-0.9.9.0
|
DIRNAME=NetworkManager-0.9.9.0
|
||||||
|
|
||||||
|
|
||||||
|
if grep -q '^NAME="Red Hat Enterprise Linux' /etc/os-release ; then
|
||||||
|
FEDPKG=rhpkg
|
||||||
|
else
|
||||||
|
FEDPKG=fedpkg
|
||||||
|
fi
|
||||||
|
|
||||||
split_patch() {
|
split_patch() {
|
||||||
# patches created with git-format-patch that contain more then one
|
# patches created with git-format-patch that contain more then one
|
||||||
# commit, cannot be easily reverted with patch, because patch works
|
# commit, cannot be easily reverted with patch, because patch works
|
||||||
@ -53,6 +60,15 @@ unset REVERT_COUNT
|
|||||||
LOCAL=0
|
LOCAL=0
|
||||||
for ARG; do
|
for ARG; do
|
||||||
case "$ARG" in
|
case "$ARG" in
|
||||||
|
-h|-?|help|--help)
|
||||||
|
echo "SYNOPSIS: $(basename "$0") [local|-l] [-?|-h|--help|help] [NUM]"
|
||||||
|
echo " - If [NUM] is omitted, it will revert all patches from the spec file,"
|
||||||
|
echo " otherwise only the last NUM patches."
|
||||||
|
echo " - When specifying 'local', it will also call \`$FEDPKG local\` to configure"
|
||||||
|
echo " and build the output directory."
|
||||||
|
echo " TIP: symlink your local git clone of NetworkManager to './.git/local'."
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
local|-l)
|
local|-l)
|
||||||
LOCAL=1
|
LOCAL=1
|
||||||
;;
|
;;
|
||||||
@ -72,12 +88,13 @@ srcdir="$(dirname "$(readlink -f "$0")")"
|
|||||||
|
|
||||||
(test -f $srcdir/NetworkManager.spec \
|
(test -f $srcdir/NetworkManager.spec \
|
||||||
&& test -f $srcdir/sources) || {
|
&& test -f $srcdir/sources) || {
|
||||||
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the NM pkg dir"
|
echo "**Error**: Directory "\`$srcdir\'" does not look like the NM pkg dir."
|
||||||
|
echo "Copy the file \"$(readlink -f "$0")\" to the dist-git base directory"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# generate the clean dir
|
# generate the clean dir
|
||||||
fedpkg prep || die "error while \`fedpkg prep\`"
|
$FEDPKG prep || die "error while \`$FEDPKG prep\`"
|
||||||
|
|
||||||
pushd "$DIRNAME"
|
pushd "$DIRNAME"
|
||||||
git init .
|
git init .
|
||||||
@ -90,6 +107,7 @@ pushd "$DIRNAME"
|
|||||||
git fetch local 'refs/remotes/origin/*:refs/remotes/origin/*'
|
git fetch local 'refs/remotes/origin/*:refs/remotes/origin/*'
|
||||||
fi
|
fi
|
||||||
git remote add origin git://anongit.freedesktop.org/NetworkManager/NetworkManager
|
git remote add origin git://anongit.freedesktop.org/NetworkManager/NetworkManager
|
||||||
|
git remote 'set-url' --push origin "ssh://$USER@git.freedesktop.org/git/NetworkManager/NetworkManager"
|
||||||
git commit --allow-empty -m '*** empty initial commit' # useful, to rebase the following commit
|
git commit --allow-empty -m '*** empty initial commit' # useful, to rebase the following commit
|
||||||
git add -f -A .
|
git add -f -A .
|
||||||
git commit -m '*** add all'
|
git commit -m '*** add all'
|
||||||
@ -150,16 +168,18 @@ pushd "$DIRNAME"
|
|||||||
git commit --allow-empty -m "$COMMIT_MSG"
|
git commit --allow-empty -m "$COMMIT_MSG"
|
||||||
|
|
||||||
# first try git-am to preserve the commit message, otherwise just revert the last commit
|
# first try git-am to preserve the commit message, otherwise just revert the last commit
|
||||||
git am "../${LAST_PATCH[$i]}" || (
|
if git am "../${LAST_PATCH[$i]}"; then
|
||||||
git am --abort
|
|
||||||
COMMIT_MSG="$(git log -n1 --format='%s' "$BASECOMMIT_REVERT" | sed 's/<< revert \(Patch.*"\)$/>> reapply \1/')"
|
|
||||||
git commit --allow-empty -m "$COMMIT_MSG"
|
|
||||||
)
|
|
||||||
|
|
||||||
# The tree to the version before should be identical after reapplying the patch.
|
# The tree to the version before should be identical after reapplying the patch.
|
||||||
# Just to be sure, reset the commit.
|
# Just to be sure, reset the commit.
|
||||||
git reset "${BASECOMMIT[$((i+1))]}" -- .
|
git reset "${BASECOMMIT[$((i+1))]}" -- .
|
||||||
EDITOR=true git commit --amend --no-edit
|
COMMIT_MSG="$(git log -n1 --format='%s' "$BASECOMMIT_REVERT" | sed 's/<< revert \(Patch.*"\)$/-- after reapplying \1\n\ngit-am did not fully restore the previous state/')"
|
||||||
|
git commit -m "$COMMIT_MSG" || echo "NOTHING TO COMMIT"
|
||||||
|
else
|
||||||
|
git am --abort
|
||||||
|
git reset "${BASECOMMIT[$((i+1))]}" -- .
|
||||||
|
COMMIT_MSG="$(git log -n1 --format='%s' "$BASECOMMIT_REVERT" | sed 's/<< revert \(Patch.*"\)$/>> reapply \1/')"
|
||||||
|
git commit --allow-empty -m "$COMMIT_MSG"
|
||||||
|
fi
|
||||||
git reset --hard HEAD
|
git reset --hard HEAD
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -168,7 +188,7 @@ popd
|
|||||||
if [[ $LOCAL != 0 ]]; then
|
if [[ $LOCAL != 0 ]]; then
|
||||||
rm -rf ./.makerepo.git/
|
rm -rf ./.makerepo.git/
|
||||||
mv "$DIRNAME/.git" ./.makerepo.git/
|
mv "$DIRNAME/.git" ./.makerepo.git/
|
||||||
fedpkg local
|
$FEDPKG local
|
||||||
mv ./.makerepo.git/ "$DIRNAME/.git"
|
mv ./.makerepo.git/ "$DIRNAME/.git"
|
||||||
pushd "$DIRNAME"
|
pushd "$DIRNAME"
|
||||||
git checkout -- .gitignore
|
git checkout -- .gitignore
|
||||||
|
Loading…
Reference in New Issue
Block a user