mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 11:58:12 +02:00
contrib/makerepo: add --dist argument to set the distribution
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
9e224cf37d
commit
dd498c59b7
1 changed files with 36 additions and 11 deletions
|
|
@ -82,36 +82,61 @@ get_patch_origin() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print_synopsis() {
|
||||||
|
echo "SYNOPSIS: $(basename "$0") [--dist|-d DIST] [local|--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 " - '--dist' implies '--local'. This argument is passed to ${FEDPKG}."
|
||||||
|
echo " TIP: symlink your local git clone of upstream to './.git/local'."
|
||||||
|
}
|
||||||
|
|
||||||
unset REVERT_COUNT
|
unset REVERT_COUNT
|
||||||
LOCAL=0
|
LOCAL=0
|
||||||
for ARG; do
|
DIST=""
|
||||||
|
while [ $# -ne 0 ]; do
|
||||||
|
ARG="$1"
|
||||||
|
shift
|
||||||
case "$ARG" in
|
case "$ARG" in
|
||||||
-h|'-?'|help|--help)
|
-h|'-?'|help|--help)
|
||||||
echo "SYNOPSIS: $(basename "$0") [local|-l] [-?|-h|--help|help] [NUM]"
|
print_synopsis
|
||||||
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 upstream to './.git/local'."
|
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
local|-l)
|
local|--local|-l)
|
||||||
LOCAL=1
|
LOCAL=1
|
||||||
;;
|
;;
|
||||||
|
--dist|-d)
|
||||||
|
LOCAL=1
|
||||||
|
DIST="$1"
|
||||||
|
shift
|
||||||
|
if [ "x$DIST" = x ]; then
|
||||||
|
print_synopsis
|
||||||
|
die "--dist needs an argument"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -n "${REVERT_COUNT+x}" ]; then
|
if [ -n "${REVERT_COUNT+x}" ]; then
|
||||||
|
print_synopsis
|
||||||
die "invalid argument \"$ARG\""
|
die "invalid argument \"$ARG\""
|
||||||
fi
|
fi
|
||||||
case "$ARG" in
|
case "$ARG" in
|
||||||
''|*[!0-9]*) die "invalid argument \"$ARG\": should be an integer (number of patches to revert)";;
|
''|*[!0-9]*)
|
||||||
|
print_synopsis
|
||||||
|
die "invalid argument \"$ARG\": should be an integer (number of patches to revert)"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
REVERT_COUNT="$ARG"
|
REVERT_COUNT="$ARG"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "x$DIST" != x ]; then
|
||||||
|
DIST=" --dist $DIST"
|
||||||
|
fi
|
||||||
|
|
||||||
# generate the clean dir
|
# generate the clean dir
|
||||||
$FEDPKG prep || die "error while \`$FEDPKG prep\`"
|
$FEDPKG $DIST prep || die "error while \`$FEDPKG$DIST prep\`"
|
||||||
|
|
||||||
if [[ "x$(ls -1d ./NetworkManager-[0-9].*/ 2>/dev/null)" != x && -f NetworkManager.spec ]]; then
|
if [[ "x$(ls -1d ./NetworkManager-[0-9].*/ 2>/dev/null)" != x && -f NetworkManager.spec ]]; then
|
||||||
DIRNAME="$(basename "$(ls -1d ./NetworkManager-[0-9].*/ || die "could not find directory")")"
|
DIRNAME="$(basename "$(ls -1d ./NetworkManager-[0-9].*/ || die "could not find directory")")"
|
||||||
|
|
@ -355,7 +380,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 $DIST local
|
||||||
mv ./.makerepo.git/ "$DIRNAME/.git"
|
mv ./.makerepo.git/ "$DIRNAME/.git"
|
||||||
pushd "$DIRNAME"
|
pushd "$DIRNAME"
|
||||||
git checkout -- .gitignore
|
git checkout -- .gitignore
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue