]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - builder.sh
do not remove macros.build from macrofiles for parsing spec
[packages/rpm-build-tools.git] / builder.sh
index 405d47115ea5d206c124312f2466d9fd1ae22dce..47336ade958309dfe16f30f055d6195796575875 100755 (executable)
@@ -468,7 +468,7 @@ insert_gitlog() {
        # rpm5.org/rpm.org do not parse any other date format than 'Wed Jan 1 1997'
        # otherwise i'd use --date=iso here
        # http://rpm5.org/cvs/fileview?f=rpm/build/parseChangelog.c&v=2.44.2.1
-       # http://rpm.org/gitweb?p=rpm.git;a=blob;f=build/parseChangelog.c#l31
+       # http://rpm.org/gitweb?p=rpm.git;a=blob;f=build/parseChangelog.c;h=56ba69daa41d65ec9fd18c9f371b8ff14118cdca;hb=a113baa510a004476edc44b5ebaaf559238a18b6#l33
        # NOTE: changelog date is always in UTC for rpmbuild
        # * 1265749244 +0000 Random Hacker <nikt@pld-linux.org> 9370900
        git rev-list --date-order -${log_entries:-20} HEAD 2>/dev/null | while read sha1; do
@@ -581,10 +581,7 @@ set_spec_target() {
 
 # runs rpm with minimal macroset
 minirpm() {
-       # we reset macros not to contain macros.build as all the %() macros are
-       # executed here, while none of them are actually needed.
-       # at the time of this writing macros.build + macros contained 70 "%(...)" macros.
-       safe_macrofiles=$(rpm $TARGET_SWITCH --showrc | awk -F: '/^macrofiles/ { gsub(/^macrofiles[ \t]+:/, "", $0); gsub(/:.*macros.build:/, ":", $0); print $0 } ')
+       safe_macrofiles=$(rpm $TARGET_SWITCH --showrc | awk -F: '/^macrofiles/ { gsub(/^macrofiles[ \t]+:/, "", $0); print $0 } ')
 
        # TODO: move these to /usr/lib/rpm/macros
        cat > $BUILDER_MACROS <<'EOF'
@@ -851,8 +848,8 @@ init_builder() {
                        PACKAGE_DIR=$REPO_DIR/$ASSUMED_NAME
                fi
        else
-               REPO_DIR="."
-               PACKAGE_DIR="."
+               PACKAGE_DIR=$(pwd)
+               REPO_DIR=$PACKAGE_DIR
        fi
        export GIT_WORK_TREE=$PACKAGE_DIR
        export GIT_DIR=$PACKAGE_DIR/.git
@@ -2081,23 +2078,36 @@ fetch_build_requires()
                fi
 }
 
+init_repository() {
+       local remoterepo=$1
+       local localrepo=$2
+
+       if [ ! -e $localrepo ]; then
+               git clone -o $REMOTE_PLD ${GIT_SERVER}/$remoterepo $localrepo
+               git --git-dir=$localrepo/.git remote set-url --push  $REMOTE_PLD ssh://${GIT_PUSH}/$remoterepo
+       fi
+}
+
 init_rpm_dir() {
        local TOP_DIR=$(eval $RPM $RPMOPTS --eval '%{_topdir}')
        local rpmdir=$(eval $RPM $RPMOPTS --eval '%{_rpmdir}')
        local buildir=$(eval $RPM $RPMOPTS --eval '%{_builddir}')
        local srpmdir=$(eval $RPM $RPMOPTS --eval '%{_srcrpmdir}')
+       local TEMPLATES=template-specs
        local tmp
 
        echo "Initializing rpm directories to $TOP_DIR from $GIT_SERVER"
        mkdir -p $TOP_DIR $rpmdir $buildir $srpmdir
 
        cd "$TOP_DIR"
-       if [ ! -e ../rpm-build-tools ]; then
-               git clone  ${GIT_SERVER}/${PACKAGES_DIR}/rpm-build-tools.git ../rpm-build-tools
-       fi
-       for a in adapter builder fetchsrc_request; do
+       init_repository ${PACKAGES_DIR}/rpm-build-tools.git ../rpm-build-tools
+       init_repository projects/$TEMPLATES ../$TEMPLATES
+       for a in adapter builder fetchsrc_request compile repackage; do
                ln -sf ../rpm-build-tools/${a}.sh $a
        done
+       for a in md5; do
+               ln -sf ../rpm-build-tools/${a} $a
+       done
        ln -sf ../rpm-build-tools/mirrors mirrors
        init_builder
 }
@@ -2108,7 +2118,7 @@ mr_proper() {
        DONT_PRINT_REVISION="yes"
 
        # remove spec and sources
-       PATH=$CLEAN_PATH $RPMBUILD --clean --rmsource --rmspec --nodeps --define "_specdir $PACKAGE_DIR" --define "_sourcedir $PACKAGE_DIR" --define "_builddir $builddir" $PACKAGE_DIR/$SPECFILE
+       PATH=$CLEAN_PATH $RPMBUILD --clean --rmsource --rmspec --nodeps --define "__urlgetfile() %nil" --define "_specdir $PACKAGE_DIR" --define "_sourcedir $PACKAGE_DIR" --define "_builddir $builddir" $PACKAGE_DIR/$SPECFILE
        rm -rf $PACKAGE_DIR/{.git,.gitignore}
        rmdir --ignore-fail-on-non-empty $PACKAGE_DIR
 }
This page took 0.028925 seconds and 4 git commands to generate.