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
22 skip_dep_generators() {
38 printf "--define __%s_provides%%{nil}\n" $dep
39 printf "--define __%s_requires%%{nil}\n" $dep
44 # preprocess args, we must have --target as first arg to rpmbuild
45 # we need to grab also dir where spec resides
47 while [ $# -gt 0 ]; do
64 specdir=$(dirname "$(pwd)/${spec:-.}")
66 # use gz payload as time is what we need here, not compress ratio
68 # we use %__ldconfig variable to test are we on rpm 4.4.9
69 # on 4.4.9 we should not redefine %clean to contain %clean, and redefine %__spec_clean_body instead
70 # on 4.4.2 we must redefine %clean to contain %clean
73 ${TARGET:+--target $TARGET} \
75 --define "_specdir $specdir" --define "_sourcedir $specdir" \
76 --define 'clean %%%{!?__ldconfig:clean}%{?__ldconfig:check} \
78 --define 'check %%check \
80 --define '_source_payload w5.gzdio' \
81 --define '_binary_payload w5.gzdio' \
82 --define '__spec_install_pre %___build_pre' \
83 --define '__spec_clean_body %{nil}' \
84 --define '_enable_debug_packages 0' \
85 ${bb+$(skip_dep_generators)} \
86 ${bb+--define '%py_postclean() %{nil}'} \
92 while [ $# -gt 0 ]; do
94 --target|--with|--without)
111 eval rpm-specdump $a || echo >&2 $?
115 # if no spec name passed, glob *.spec
117 if [ ! -f "$1" -o $# -gt 1 ]; then
118 echo >&2 "ERROR: Too many or too few .spec files found"
119 echo >&2 "Usage: ${0##*/} PACKAGE.spec"
123 # $1 must be spec, ensure it has .spec ext
125 set -- ${spec%.spec}.spec "$@"
128 tmp=$(specdump "$@" | awk '$2 == "_target_cpu" {print $3}')
133 # skip -bi if -bb is somewhere in the args
134 if [[ *$@* = *-bb* ]]; then
137 bb= rpmbuild -bi "$@"