X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=builder.sh;h=a379799be718371f338266fa06f3b9466b43e3c7;hb=6277f15fe3544a76a0055c05f8301a5e6dbbd9ba;hp=33199265bfcdc9730b7e5f89aa555b54275e13be;hpb=aa189b0508256710bd407008876f8ef51e1578d8;p=packages%2Frpm-build-tools.git diff --git a/builder.sh b/builder.sh index 3319926..a379799 100644 --- a/builder.sh +++ b/builder.sh @@ -22,13 +22,14 @@ # - builder -u fetches current version first (well that's okay, how you compare versions if you have no old spec?) # - when Icon: field is present, -5 and -a5 doesn't work # - builder -R skips installing BR if spec is not present before builder invocation (need to run builder twice) +# - does not respect NoSource: X, and tries to cvs up such files [ example: VirtualBox-bin.spec and its Source0 ] # TODO: # - ability to do ./builder -bb foo.spec foo2.spec foo3.spec RCSID='$Id$' r=${RCSID#* * } rev=${r%% *} -VERSION="v0.23/$rev" +VERSION="v0.35/$rev" VERSIONSTRING="\ Build package utility from PLD Linux CVS repository $VERSION (C) 1999-2009 Free Penguins". @@ -68,6 +69,8 @@ DATE=`date +%Y-%m-%d_%H-%M-%S` # Example: LOGFILE='../log.$PACKAGE_NAME' # Example: LOGFILE='../LOGS/log.$PACKAGE_NAME.$DATE' +# Example: LOGFILE='$PACKAGE_NAME/$PACKAGE_NAME.$DATE.log' +# Example: LOGFILE='$PACKAGE_NAME.$DATE.log' # Yes, you can use variable name! Note _single_ quotes! LOGFILE='' @@ -287,7 +290,7 @@ Usage: builder [-D|--debug] [-V|--version] [--short-version] [-a|--as_anon] [-b| -nd, --no-distfiles - don't download from distfiles -nm, --no-mirrors - don't download from mirror, if source URL is given, -nu, --no-urls - don't try to download from FTP/HTTP location, --ns, --no-srcs - don't download Sources +-ns, --no-srcs - don't download Sources/Patches -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 @@ -372,7 +375,7 @@ Usage: builder [-D|--debug] [-V|--version] [--short-version] [-a|--as_anon] [-b| depspecname() { local package="$1" - package=$(echo "$package" | sed -e '/perl(.*)/{s,perl(\(.*\)),perl-\1,;s,::,-,g}') + package=$(echo "$package" | sed -e '/perl(.*)/{s,perl(\(.*\)),perl-\1,;s,::,-,g};' -e 's/-\(devel\|static\)$//' ) echo "$package" } @@ -409,7 +412,7 @@ update_shell_title() { # set TARGET from BuildArch: from SPECFILE set_spec_target() { if [ -n "$SPECFILE" ] && [ -z "$TARGET" ]; then - tmp=$(awk '/^BuildArch:/ { print $NF}' $ASSUMED_NAME/$SPECFILE) + tmp=$(awk '/^BuildArch:/ { print $NF; exit }' $ASSUMED_NAME/$SPECFILE) if [ "$tmp" ]; then target_platform=$(rpm -E '%{_target_vendor}-%{_target_os}%{?_gnu}') TARGET="$tmp" @@ -560,16 +563,16 @@ parse_spec() { cd $PACKAGE_DIR cache_rpm_dump - if [ "$NOSRCS" != "yes" ]; then - SOURCES=$(rpm_dump | awk '$2 ~ /^SOURCEURL[0-9]+/ {print substr($2, length("SOURCEURL") + 1), $3}' | LC_ALL=C sort -n | awk '{print $2}') - fi - if (rpm_dump | grep -qEi ":.*nosource.*1"); then FAIL_IF_NO_SOURCES="no" fi - PATCHES=$(rpm_dump | awk '$2 ~ /^PATCHURL[0-9]+/ {print substr($2, length("PATCHURL") + 1), $3}' | LC_ALL=C sort -n | awk '{print $2}') - ICONS=$(awk '/^Icon:/ {print $2}' ${SPECFILE}) + if [ "$NOSRCS" != "yes" ]; then + SOURCES=$(rpm_dump | awk '$2 ~ /^SOURCEURL[0-9]+/ {print substr($2, length("SOURCEURL") + 1), $3}' | LC_ALL=C sort -n | awk '{print $2}') + PATCHES=$(rpm_dump | awk '$2 ~ /^PATCHURL[0-9]+/ {print substr($2, length("PATCHURL") + 1), $3}' | LC_ALL=C sort -n | awk '{print $2}') + ICONS=$(awk '/^Icon:/ {print $2}' ${SPECFILE}) + fi + PACKAGE_NAME=$(rpm_dump | awk '$2 == "PACKAGE_NAME" { print $3; exit}') PACKAGE_VERSION=$(rpm_dump | awk '$2 == "PACKAGE_VERSION" { print $3; exit}') PACKAGE_RELEASE=$(rpm_dump | awk '$2 == "PACKAGE_RELEASE" { print $3; exit}') @@ -680,7 +683,8 @@ get_spec() { cd "$REPO_DIR" if [ ! -f "$ASSUMED_NAME/$SPECFILE" ]; then - SPECFILE="$(basename $SPECFILE .spec).spec" + # XXX: still needed? + SPECFILE=$(basename $SPECFILE) fi if [ "$NOCVSSPEC" != "yes" ]; then @@ -700,7 +704,7 @@ get_spec() { # create symlinks for tools if [ "$SYMLINK_TOOLS" != "no" ]; then - for a in dropin md5 adapter builder {relup,compile,repackage}.sh; do + for a in dropin md5 adapter builder {relup,compile,repackage,rsync}.sh; do [ -f $a ] || continue ln -s ../$a $ASSUMED_NAME cvsignore_df $a @@ -1012,13 +1016,13 @@ get_files() { if echo $i | grep -vE '(http|ftp|https|cvs|svn)://' | grep -qE '\.(gz|bz2)$']; then echo "Warning: no URL given for $i" fi + target="$fp" if [ -z "$NODIST" ] && [ -n "$srcmd5" ]; then if good_md5 "$i" && good_size "$i"; then echo "$fp having proper md5sum already exists" continue fi - target="$fp" # optionally prefer mirror over distfiles if there's mirror # TODO: build url list and then try each url from the list @@ -1070,6 +1074,7 @@ get_files() { update_shell_title "${GETURI2%% *}: $url_attic" ${GETURI2} ${OUTFILEOPT} "$target" "$url_attic" fi + test -s "$target" || rm -f "$target" fi fi @@ -1096,11 +1101,12 @@ get_files() { im="$i" fi update_shell_title "${GETURI%% *}: $im" - ${GETURI} "$im" || \ + ${GETURI} "$im" ${OUTFILEOPT} "$target" || \ if [ "`echo $im | grep -E 'ftp://'`" ]; then update_shell_title "${GETURI2%% *}: $im" - ${GETURI2} "$im" + ${GETURI2} "$im" ${OUTFILEOPT} "$target" fi + test -s "$target" || rm -f "$target" fi if [ "$cvsup" = 1 ]; then @@ -1895,7 +1901,7 @@ init_rpm_dir() { echo "- run cvs co SPECS" echo "To checkout *all* packages:" - echo "- run cvs up in $TOP_DIR/packages dir" + echo "- run cvs up -dP in $TOP_DIR/packages dir" echo "" echo "To commit with your developer account:" @@ -2207,19 +2213,21 @@ while [ $# -gt 0 ]; do Exit_error err_invalid_cmdline "$1" ;; *) - SPECFILE="${1}" + SPECFILE=$1; shift # check if specname was passed as specname:cvstag if [ "${SPECFILE##*:}" != "${SPECFILE}" ]; then CVSTAG="${SPECFILE##*:}" SPECFILE="${SPECFILE%%:*}" fi + # always have SPECFILE ending with .spec extension + SPECFILE=${SPECFILE%%.spec}.spec ASSUMED_NAME=$(basename ${SPECFILE%%.spec}) - shift esac done -if [ -f CVS/Entries ] && [ -z "$CVSTAG" ]; then - CVSTAG=$(awk -vSPECFILE=$(basename ${SPECFILE%.spec}.spec) -F/ '$2 == SPECFILE && $6 ~ /^T/{print substr($6, 2)}' CVS/Entries) +[ -d "$ASSUMED_NAME" ] && CVS_ENTRIES="$ASSUMED_NAME/CVS/Entries" || CVS_ENTRIES="CVS/Entries" +if [ -f "$CVS_ENTRIES" ] && [ -z "$CVSTAG" ]; then + CVSTAG=$(awk -vSPECFILE=$(basename $SPECFILE) -F/ '$2 == SPECFILE && $6 ~ /^T/{print substr($6, 2)}' ${CVS_ENTRIES}) if [ "$CVSTAG" ]; then echo >&2 "builder: Sticky tag $CVSTAG active. Use -r TAGNAME to override." fi