]>
Commit | Line | Data |
---|---|---|
b0f3c13a ER |
1 | #!/bin/sh |
2 | # will build package, skipping %prep and %build stage | |
3 | # i use it a lot! | |
4 | # | |
5 | # -glen 2005-03-03 | |
201eefee | 6 | # |
5f775b93 ER |
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 | # | |
201eefee | 17 | # TODO |
1e4db2ae | 18 | # - make builder to understand -bi and use builder for short-circuit |
b0f3c13a ER |
19 | |
20 | set -e | |
21 | ||
22 | rpmbuild() { | |
f0e590fe | 23 | # use gz payload as time is what we need here, not compress ratio |
6816b44c ER |
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 | |
b0f3c13a | 28 | set -x |
3d133bf0 | 29 | /usr/bin/rpmbuild \ |
e3332001 ER |
30 | ${TARGET:+--target $TARGET} \ |
31 | $BCONDS \ | |
32 | --short-circuit \ | |
6816b44c | 33 | --define 'clean %%%{!?__ldconfig:clean}%{?__ldconfig:check} \ |
f0e590fe ER |
34 | exit 0%{nil}' \ |
35 | --define 'check %%check \ | |
36 | exit 0%{nil}' \ | |
6816b44c | 37 | --define '_source_payload w9.gzdio' \ |
c2ccfc4c | 38 | --define '_binary_payload w9.gzdio' \ |
6816b44c ER |
39 | --define '__spec_install_pre %___build_pre' \ |
40 | --define '__spec_clean_body %{nil}' \ | |
3d133bf0 | 41 | "$@" || exit |
b0f3c13a | 42 | } |
e5c7e9c1 | 43 | |
ebdafdf7 ER |
44 | specdump() { |
45 | local a | |
46 | while [ $# -gt 0 ]; do | |
47 | case "$1" in | |
48 | --target|--with|--without) | |
49 | a="$a $1 $2" | |
50 | shift | |
51 | ;; | |
bf76d74e ER |
52 | --define) |
53 | a="$a $1 \"$2\"" | |
54 | shift | |
55 | ;; | |
ebdafdf7 ER |
56 | -*) |
57 | ;; | |
58 | *) | |
59 | a="$a $1" | |
60 | ;; | |
61 | esac | |
62 | shift | |
63 | done | |
64 | set -x | |
bf76d74e | 65 | eval rpm-specdump $a |
ebdafdf7 ER |
66 | } |
67 | ||
d0560858 ER |
68 | specfile="${1%.spec}.spec"; shift |
69 | set -- "$specfile" "$@" | |
91e42acf | 70 | |
ebdafdf7 | 71 | tmp=$(specdump "$@" | awk '$2 == "_target_cpu" {print $3}') |
595e4fde ER |
72 | if [ "$tmp" ]; then |
73 | TARGET="$tmp" | |
74 | fi | |
75 | ||
4dbb5c3b | 76 | BCONDS=$(./builder -nn -ncs --show-bcond-args $specfile) |
36c6591f | 77 | |
e5c7e9c1 ER |
78 | # just create the rpm's if -bb is somewhere in the args |
79 | if [[ *$@* != *-bb* ]]; then | |
4a529b9f | 80 | rpmbuild -bi "$@" |
e5c7e9c1 | 81 | fi |
3d133bf0 | 82 | rpmbuild -bb "$@" |