]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - builder.sh
require rpm-build-macros 1.651, where shrc.sh was moved from there to here
[packages/rpm-build-tools.git] / builder.sh
index 90e1b93eb434620b977749088bfd6c9938664dda..cada6196cf83cf530c6211b390549569e48bbcc4 100755 (executable)
@@ -554,7 +554,7 @@ depspecname() {
 }
 
 update_shell_title() {
-       [ -t 1 ] || return
+       [ -t 2 ] || return
        local len=${COLUMNS:-80}
        local msg="$(echo "$*" | cut -c-$len)"
 
@@ -918,10 +918,17 @@ create_git_repo() {
        fi
        [ -d "$ASSUMED_NAME/.git" ] || NEW_REPO=yes
        ssh $GIT_PUSH create ${ASSUMED_NAME} || Exit_error err_cvs_add_failed
+       (
+       set -e
        git init
-       git remote add $REMOTE_PLD ${GIT_SERVER}/${PACKAGES_DIR}/${ASSUMED_NAME}.git && \
-               git remote set-url --push  $REMOTE_PLD ssh://${GIT_PUSH}/${PACKAGES_DIR}/${ASSUMED_NAME} \
-               || Exit_error err_remote_problem $REMOTE_PLD
+       git remote add $REMOTE_PLD ${GIT_SERVER}/${PACKAGES_DIR}/${ASSUMED_NAME}.git
+       git remote set-url --push $REMOTE_PLD ssh://${GIT_PUSH}/${PACKAGES_DIR}/${ASSUMED_NAME}
+
+       git config --local push.default current
+       git config --local branch.master.remote $REMOTE_PLD
+       git config --local branch.master.merge refs/heads/master
+       )
+       test $? = 0 || Exit_error err_remote_problem $REMOTE_PLD
 }
 
 get_spec() {
@@ -993,7 +1000,7 @@ get_spec() {
 
                # create symlinks for tools
                if [ "$SYMLINK_TOOLS" != "no" -a -d "$PACKAGE_DIR" ]; then
-                       for a in dropin md5 adapter builder {relup,compile,repackage,rsync,pearize}.sh pldnotify.awk; do
+                       for a in dropin md5 adapter builder {relup,compile,repackage,rsync,pearize}.sh; do
                                # skip tools that don't exist in top dir
                                [ -f $a ] || continue
                                # skip tools that already exist
@@ -1033,15 +1040,22 @@ get_spec() {
        set_spec_target
 }
 
+# find mirrors in this order. first match wins:
+# - package dir (~/rpm/packages/foo)
+# - repository dir (~/rpm/packages)
+# - tools dir dir (~/rpm/packages/rpm-build-tools)
 find_mirror() {
-       cd "$REPO_DIR"
        local url="$1"
-       if [ ! -f "mirrors"  ] ; then
-               ln -s ../rpm-build-tools/mirrors .
-       fi
 
-       IFS="|"
+       update_shell_title "find_mirror[$url][$REPO_DIR]"
+
+       # NOTE: as while loop runs in subshell,
+       # we use exit 2 to indicate  that the match was found
+       # otherwise we end up outputing mirror url and origin url.
+
        local origin mirror name rest ol prefix
+       IFS="|"
+       cat "$PACKAGE_DIR/mirrors" "$REPO_DIR/mirrors" "$REPO_DIR/../rpm-build-tools/mirrors" /dev/null 2>/dev/null | \
        while read origin mirror name rest; do
                # skip comments and empty lines
                if [ -z "$origin" ] || [ "${origin#\#}" != "$origin" ]; then
@@ -1052,10 +1066,9 @@ find_mirror() {
                if [ "$prefix" = "$origin" ] ; then
                        suffix=$(echo "$url" | cut -b $((ol+1))-)
                        echo -n "$mirror$suffix"
-                       return 0
+                       exit 2
                fi
-       done < mirrors
-       echo "$url"
+       done && echo "$url"
 }
 
 # Warning: unpredictable results if same URL used twice
@@ -1559,12 +1572,12 @@ try_upgrade() {
                echo "Updating spec file to version $TNEWVER"
        else
                if [ -n "$FLOAT_VERSION" ]; then
-                       TNOTIFY=$($APPDIR/pldnotify.awk ${BE_VERBOSE:+-vDEBUG=1} $SPECFILE -n) || exit 1
+                       TNOTIFY=$(pldnotify ${BE_VERBOSE:+-vDEBUG=1} $SPECFILE -n) || exit 1
                else
-                       TNOTIFY=$($APPDIR/pldnotify.awk ${BE_VERBOSE:+-vDEBUG=1} $SPECFILE) || exit 1
+                       TNOTIFY=$(pldnotify ${BE_VERBOSE:+-vDEBUG=1} $SPECFILE) || exit 1
                fi
 
-               # pldnotify.awk does not set exit codes, but it has match for ERROR
+               # pldnotify does not set exit codes, but it has match for ERROR
                # in output which means so.
                if [[ "$TNOTIFY" = *ERROR* ]]; then
                        echo >&2 "$TNOTIFY"
This page took 0.03468 seconds and 4 git commands to generate.