]> git.pld-linux.org Git - packages/rpm-build-tools.git/blame - repackage.sh
- 4.2.1
[packages/rpm-build-tools.git] / repackage.sh
CommitLineData
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
20set -e
21
22rpmbuild() {
ace4b218
ER
23 # preprocess args, we must have --target as first arg to rpmbuild
24 local a
25 while [ $# -gt 0 ]; do
26 case "$1" in
27 --target)
28 shift
29 TARGET=$1
30 ;;
31 *)
32 a="$a $1"
33 ;;
34 esac
35 shift
36 done
37
f0e590fe 38 # use gz payload as time is what we need here, not compress ratio
6816b44c
ER
39
40 # we use %__ldconfig variable to test are we on rpm 4.4.9
41 # on 4.4.9 we should not redefine %clean to contain %clean, and redefine %__spec_clean_body instead
42 # on 4.4.2 we must redefine %clean to contain %clean
b0f3c13a 43 set -x
3d133bf0 44 /usr/bin/rpmbuild \
e3332001 45 ${TARGET:+--target $TARGET} \
e3332001 46 --short-circuit \
6816b44c 47 --define 'clean %%%{!?__ldconfig:clean}%{?__ldconfig:check} \
f0e590fe
ER
48 exit 0%{nil}' \
49 --define 'check %%check \
50 exit 0%{nil}' \
df631f48
ER
51 --define '_source_payload w5.gzdio' \
52 --define '_binary_payload w5.gzdio' \
6816b44c
ER
53 --define '__spec_install_pre %___build_pre' \
54 --define '__spec_clean_body %{nil}' \
ace4b218 55 $a || exit
b0f3c13a 56}
e5c7e9c1 57
ebdafdf7
ER
58specdump() {
59 local a
60 while [ $# -gt 0 ]; do
61 case "$1" in
62 --target|--with|--without)
63 a="$a $1 $2"
64 shift
65 ;;
bf76d74e
ER
66 --define)
67 a="$a $1 \"$2\""
68 shift
69 ;;
ebdafdf7
ER
70 -*)
71 ;;
72 *)
73 a="$a $1"
74 ;;
75 esac
76 shift
77 done
78 set -x
fe30f816 79 eval rpm-specdump $a || echo >&2 $?
ebdafdf7
ER
80}
81
ebdafdf7 82tmp=$(specdump "$@" | awk '$2 == "_target_cpu" {print $3}')
595e4fde
ER
83if [ "$tmp" ]; then
84 TARGET="$tmp"
85fi
86
e5c7e9c1
ER
87# just create the rpm's if -bb is somewhere in the args
88if [[ *$@* != *-bb* ]]; then
4a529b9f 89 rpmbuild -bi "$@"
e5c7e9c1 90fi
3d133bf0 91rpmbuild -bb "$@"
This page took 0.043083 seconds and 4 git commands to generate.