2 # will build package, skipping %prep and %build stage
8 # do %install and rpm package, skips %clean
9 # SPECS$ ./repackage.sh kdelibs.spec
11 # after that is done you could try only package creation (as %clean was
12 # skipped), for adjusting %files lists:
13 # SPECS$ ./repackage.sh kdelibs.spec -bb
15 # See also: SPECS/compile.sh
18 # - make builder to understand -bi and use builder for short-circuit
29 skip_dep_generators() {
45 args+=("--define=__${dep}_provides %%{nil}")
46 args+=("--define=__${dep}_requires %%{nil}")
51 # preprocess args, we must have --target as first arg to rpmbuild
52 # we need to grab also dir where spec resides
54 while [ $# -gt 0 ]; do
71 specdir=$(dirname "$(pwd)/${spec:-.}")
73 # use gz payload as time is what we need here, not compress ratio
75 # we use %__ldconfig variable to test are we on rpm 4.4.9
76 # on 4.4.9 we should not redefine %clean to contain %clean, and redefine %__spec_clean_body instead
77 # on 4.4.2 we must redefine %clean to contain %clean
79 if [ -n "${bb+1}" ]; then
81 args+=(--define '%py_postclean(-x:) %{nil}')
86 ${TARGET:+--target $TARGET} \
88 --define 'disable_short_circuited_deps 0' \
89 --define "_specdir $specdir" --define "_sourcedir $specdir" \
90 --define 'clean %%%{!?__ldconfig:clean}%{?__ldconfig:check} \
92 --define 'check %%check \
94 --define '_source_payload w5.gzdio' \
95 --define '_binary_payload w5.gzdio' \
96 --define '__spec_install_pre %___build_pre' \
97 --define '__spec_clean_body %{nil}' \
98 --define '_enable_debug_packages 0' \
105 while [ $# -gt 0 ]; do
107 --target|--with|--without)
124 eval rpm-specdump $a || echo >&2 $?
128 # if no spec name passed, glob *.spec
130 if [ ! -f "$1" -o $# -gt 1 ]; then
131 echo >&2 "ERROR: Too many or too few .spec files found"
132 echo >&2 "Usage: ${0##*/} PACKAGE.spec"
136 # $1 must be spec, ensure it has .spec ext
138 set -- ${spec%.spec}.spec "$@"
141 tmp=$(specdump "$@" | awk '$2 == "_target_cpu" {print $3}')
146 # skip -bi if -bb is somewhere in the args
147 if [[ *$@* = *-bb* ]]; then
150 bb= rpmbuild -bi "$@"