NOCVSSPEC=""
NODIST=""
NOINIT=""
+PREFMIRRORS=""
UPDATE=""
ADD5=""
NO5=""
PACKAGE_RELEASE=""
PACKAGE_VERSION=""
PACKAGE_NAME=""
+ASSUMED_NAME=""
PROTOCOL="ftp"
WGET_RETRIES=${MAX_WGET_RETRIES:-0}
CVS_RETRIES=${MAX_CVS_RETRIES:-1000}
SU_SUDO=""
if [ -n "$HOME_ETC" ]; then
USER_CFG="$HOME_ETC/.builderrc"
+ BUILDER_MACROS="$HOME_ETC/.builder-rpmmacros"
else
USER_CFG=~/.builderrc
+ BUILDER_MACROS=~/.builder-rpmmacros
fi
[ -f "$USER_CFG" ] && . "$USER_CFG"
-ns, --no-srcs - don't download Sources
-ns0, --no-source0 - don't download Source0
-nn, --no-net - don't download anything from the net
+-pm, --prefer-mirrors - prefer mirrors (if any) over distfiles for SOURCES
--no-init - don't initialize builder paths (SPECS and SOURCES)
-ske,
--skip-existing-files - skip existing files in get_files
safe_macrofiles=$(rpm --showrc | awk -F: '/^macrofiles/ { gsub(/^macrofiles[ \t]+:/, "", $0); gsub(/:.*macros.build:/, ":", $0); print $0 } ')
# TODO: move these to /usr/lib/rpm/macros
- cat > .builder-rpmmacros <<'EOF'
+ cat > $BUILDER_MACROS <<'EOF'
%x8664 x86_64 amd64 ia32e
%alt_kernel %{nil}
%_alt_kernel %{nil}
%{nil}
EOF
if [ "$NOINIT" = "yes" ] ; then
- cat >> .builder-rpmmacros <<'EOF'
+ cat >> $BUILDER_MACROS <<'EOF'
%_specdir ./
%_sourcedir ./
EOF
fi
- eval $RPMBUILD --macros "$safe_macrofiles:.builder-rpmmacros" $QUIET $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $* 2>&1
+ eval $RPMBUILD --macros "$safe_macrofiles:$BUILDER_MACROS" $QUIET $RPMOPTS $RPMBUILDOPTS $BCOND $TARGET_SWITCH $* 2>&1
}
cache_rpm_dump() {
PACKAGE_VERSION=$(rpm_dump | awk '$2 == "PACKAGE_VERSION" { print $3; exit}')
PACKAGE_RELEASE=$(rpm_dump | awk '$2 == "PACKAGE_RELEASE" { print $3; exit}')
+ if [ "$PACKAGE_NAME" != "$ASSUMED_NAME" ]; then
+ echo "WARNING! Spec name ($ASSUMED_NAME) does not agree with package name ($PACKAGE_NAME)"
+ fi
+
if [ -n "$BE_VERBOSE" ]; then
echo "- Sources : `nourl $SOURCES`"
if [ -n "$PATCHES" ]; then
fi
if [ "$NOINIT" != "yes" ] ; then
- SOURCE_DIR="`eval $RPM $RPMOPTS --eval '%{_sourcedir}'`"
- SPECS_DIR="`eval $RPM $RPMOPTS --eval '%{_specdir}'`"
+ SOURCE_DIR="`eval $RPM $RPMOPTS --define '"name $ASSUMED_NAME"' --eval '%{_sourcedir}'`"
+ SPECS_DIR="`eval $RPM $RPMOPTS --define '"name $ASSUMED_NAME"' --eval '%{_specdir}'`"
else
SOURCE_DIR="."
SPECS_DIR="."
fi
target="$fp"
- # prefer mirror over distfiles if there's mirror
+ # optionally prefer mirror over distfiles if there's mirror
# TODO: build url list and then try each url from the list
- if [ -z "$NOMIRRORS" ] && im=$(find_mirror "$i") && [ "$im" != "$i" ]; then
+ if [ -n "$PREFMIRRORS" ] && [ -z "$NOMIRRORS" ] && im=$(find_mirror "$i") && [ "$im" != "$i" ]; then
url="$im"
else
url=$(distfiles_url "$i")
NOSRCS="yes"
ALWAYS_CVSUP="no"
shift;;
+ -pm | --prefer-mirrors )
+ PREFMIRRORS="yes"
+ shift;;
--no-init )
NOINIT="yes"
shift;;
CVSTAG="${SPECFILE##*:}"
SPECFILE="${SPECFILE%%:*}"
fi
+ ASSUMED_NAME="$(basename ${SPECFILE%%.spec})"
shift
esac
done