]> git.pld-linux.org Git - packages/rpm-build-tools.git/blob - repackage.sh
- pass all args to rpm-specdump to have bconds present
[packages/rpm-build-tools.git] / repackage.sh
1 #!/bin/sh
2 # will build package, skipping %prep and %build stage
3 # i use it a lot!
4 #
5 # -glen 2005-03-03
6 #
7 # Usage:
8 # do %install and rpm package, skips %clean
9 # SPECS$ ./repackage.sh kdelibs.spec
10 #
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
14 #
15 # See also: SPECS/compile.sh
16 #
17 # TODO
18 # - make builder to understand -bi and use builder for short-circuit
19
20 set -e
21
22 rpmbuild() {
23         # use gz payload as time is what we need here, not compress ratio
24
25         # we use %__ldconfig variable to test are we on rpm 4.4.9
26         # on 4.4.9 we should not redefine %clean to contain %clean, and redefine %__spec_clean_body instead
27         # on 4.4.2 we must redefine %clean to contain %clean
28         set -x
29         /usr/bin/rpmbuild \
30                 ${TARGET:+--target $TARGET} \
31                 $BCONDS \
32                 --short-circuit \
33                 --define 'clean %%%{!?__ldconfig:clean}%{?__ldconfig:check} \
34                 exit 0%{nil}' \
35                 --define 'check %%check \
36                 exit 0%{nil}' \
37                 --define '_source_payload w9.gzdio' \
38                 --define '__spec_install_pre %___build_pre' \
39                 --define '__spec_clean_body %{nil}' \
40                 "$@" || exit
41 }
42
43 specfile="${1%.spec}.spec"; shift
44 set -- "$specfile" "$@"
45
46 tmp=$(rpm-specdump "$@" | awk '$2 == "_target_cpu" {print $3}')
47 if [ "$tmp" ]; then
48         TARGET="$tmp"
49 fi
50
51 BCONDS=$(./builder -nn -ncs --show-bcond-args $specfile)
52
53 # just create the rpm's if -bb is somewhere in the args
54 if [[ *$@* != *-bb* ]]; then
55         rpmbuild -bi "$@"
56 fi
57 rpmbuild -bb "$@"
This page took 0.029201 seconds and 4 git commands to generate.