Debian Codegraph @

storage/mroonga/packages/yum/build-rpm.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 LANG=C
4
5 runscip-shell shell mariadb 1:11.8.8-1 run().()
6 {
7 "$@"
8 if testscip-shell system . . test. $? -ne 0; then
9 echoscip-shell system . . echo. "Failed $@"
10 exit 1
11 fi
12 }
13
14 rpmbuild_options=
15
16 . /vagrant/env.shscip-shell source . . `/vagrant/env.sh`.
17
18 distribution=$(cutscip-shell system . . cut. -d " " -f 1 /etc/redhat-releasescip-shell filesystem . . `/etc/redhat-release`. | trscip-shell system . . tr. "A-Z" "a-z")
19 if grepscip-shell system . . grep. -q Linux /etc/redhat-releasescip-shell filesystem . . `/etc/redhat-release`.; then
20 distribution_version=$(cutscip-shell system . . cut. -d " " -f 4 /etc/redhat-releasescip-shell filesystem . . `/etc/redhat-release`.)
21 else
22 distribution_version=$(cutscip-shell system . . cut. -d " " -f 3 /etc/redhat-releasescip-shell filesystem . . `/etc/redhat-release`.)
23 fi
24 distribution_version=$(echoscip-shell system . . echo. ${distribution_version} | sedscip-shell system . . sed. -e 's/\..*$//g')
25
26 architecture="$(archscip-shell system . . arch.)"
27 case "${architecture}" in
28 i*86)
29 architecture=i386
30 ;;
31 esac
32
33 runscip-shell shell mariadb 1:11.8.8-1 run(). yum groupinstall -y "Development Tools"
34 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y rpm-build rpmdevtools tar wget
35
36 if [scip-shell system . . `[`. -x /usr/bin/rpmdev-setuptreescip-shell filesystem . . `/usr/bin/rpmdev-setuptree`. ]; then
37 rmscip-shell system . . rm. -rf .rpmmacros
38 runscip-shell shell mariadb 1:11.8.8-1 run(). rpmdev-setuptree
39 else
40 runscip-shell shell mariadb 1:11.8.8-1 run(). cat <<EOM > ~/.rpmmacros
41 %_topdir ${HOME}/rpmbuild
42 EOM
43 runscip-shell shell mariadb 1:11.8.8-1 run(). mkdir -p ~/rpmbuild/SOURCES
44 runscip-shell shell mariadb 1:11.8.8-1 run(). mkdir -p ~/rpmbuild/SPECS
45 runscip-shell shell mariadb 1:11.8.8-1 run(). mkdir -p ~/rpmbuild/BUILD
46 runscip-shell shell mariadb 1:11.8.8-1 run(). mkdir -p ~/rpmbuild/RPMS
47 runscip-shell shell mariadb 1:11.8.8-1 run(). mkdir -p ~/rpmbuild/SRPMS
48 fi
49
50 repository="/vagrant/repositories/${distribution}/${distribution_version}"
51 rpm_dir="${repository}/${architecture}/Packages"
52 srpm_dir="${repository}/source/SRPMS"
53 runscip-shell shell mariadb 1:11.8.8-1 run(). mkdir -p "${rpm_dir}" "${srpm_dir}"
54
55 rpmbuild_options=""
56
57 # for debug
58 # rpmbuild_options="${rpmbuild_options} --define 'optflags -O0 -g3'"
59
60 cd
61
62 runscip-shell shell mariadb 1:11.8.8-1 run(). cp /vagrant/tmp/${PACKAGE}-${VERSION}.* rpmbuild/SOURCES/
63 runscip-shell shell mariadb 1:11.8.8-1 run(). cp /vagrant/tmp/${distribution}/*.spec rpmbuild/SPECS/
64
65 package_name=$(cd rpmbuild/SPECS; echoscip-shell system . . echo. *.spec | sedscip-shell system . . sed. -e 's/\.spec$//g')
66
67 case ${distribution} in
68 fedora)
69 USE_MYSQLSERVICES_COMPAT=yes
70 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y mariadb-devel
71 ;;
72 centos)
73 release_rpm=groonga-release-1.3.0-1.noarch.rpm
74 if [scip-shell system . . `[`. ${distribution_version} = 5 ]; then
75 wget http://packages.groonga.org/${distribution}/${release_rpm}
76 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y --nogpgcheck ${release_rpm}
77 rmscip-shell system . . rm. -f ${release_rpm}
78 else
79 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y \
80 http://packages.groonga.org/${distribution}/${release_rpm}
81 fi
82 runscip-shell shell mariadb 1:11.8.8-1 run(). yum makecache
83
84 case ${package_name} in
85 mysql55-${PACKAGE})
86 USE_MYSQLSERVICES_COMPAT=yes
87 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y scl-utils-build
88 if [scip-shell system . . `[`. ${distribution_version} = 6 ]; then
89 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y centos-release-scl
90 fi
91 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y mysql55-mysql-devel mysql55-build
92 ;;
93 mysql5?-community-${PACKAGE})
94 release_rpm=mysql-community-release-el${distribution_version}-7.noarch.rpm
95 runscip-shell shell mariadb 1:11.8.8-1 run(). yum -y install http://repo.mysql.com/${release_rpm}
96 if [scip-shell system . . `[`. "${package_name}" = "mysql57-community-${PACKAGE}" ]; then
97 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y yum-utils
98 runscip-shell shell mariadb 1:11.8.8-1 run(). yum-config-manager --disable mysql56-community
99 runscip-shell shell mariadb 1:11.8.8-1 run(). yum-config-manager --enable mysql57-community
100 if [scip-shell system . . `[`. ${distribution_version} = 6 ]; then
101 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y cmake28
102 fi
103 fi
104 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y mysql-community-devel
105 ;;
106 mariadb-${PACKAGE})
107 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y mariadb-devel
108 ;;
109 mariadb-10.1-${PACKAGE})
110 if [scip-shell system . . `[`. "${architecture}" = "x86_64" ]; then
111 mariadb_architecture="amd64"
112 else
113 mariadb_architecture="x86"
114 fi
115 catscip-shell system . . cat. <<REPO > /etc/yum.repos.d/MariaDB.reposcip-shell filesystem . . `/etc/yum.repos.d/MariaDB.repo`.
116 [mariadb]
117 name = MariaDB
118 baseurl = http://yum.mariadb.org/10.1/${distribution}${distribution_version}-${mariadb_architecture}
119 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
120 gpgcheck=1
121 REPO
122 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y MariaDB-devel
123 if [scip-shell system . . `[`. ${distribution_version} = 6 ]; then
124 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y cmake28
125 fi
126 ;;
127 mariadb-10.2-${PACKAGE})
128 if [scip-shell system . . `[`. "${architecture}" = "x86_64" ]; then
129 mariadb_architecture="amd64"
130 else
131 mariadb_architecture="x86"
132 fi
133 catscip-shell system . . cat. <<REPO > /etc/yum.repos.d/MariaDB.reposcip-shell filesystem . . `/etc/yum.repos.d/MariaDB.repo`.
134 [mariadb]
135 name = MariaDB
136 baseurl = http://yum.mariadb.org/10.2/${distribution}${distribution_version}-${mariadb_architecture}
137 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
138 gpgcheck=1
139 REPO
140 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y MariaDB-devel
141 if [scip-shell system . . `[`. ${distribution_version} = 6 ]; then
142 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y cmake28
143 fi
144 ;;
145 percona-server-56-${PACKAGE})
146 release_rpm_version=0.1-4
147 release_rpm=percona-release-${release_rpm_version}.noarch.rpm
148 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y http://www.percona.com/downloads/percona-release/redhat/${release_rpm_version}/${release_rpm}
149 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y Percona-Server-devel-56
150 ;;
151 percona-server-57-${PACKAGE})
152 release_rpm_version=0.1-4
153 release_rpm=percona-release-${release_rpm_version}.noarch.rpm
154 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y http://www.percona.com/downloads/percona-release/redhat/${release_rpm_version}/${release_rpm}
155 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y Percona-Server-devel-57
156 if [scip-shell system . . `[`. ${distribution_version} = 6 ]; then
157 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y cmake28
158 fi
159 ;;
160 esac
161 ;;
162 esac
163 runscip-shell shell mariadb 1:11.8.8-1 run(). yum install -y ${DEPENDED_PACKAGES}
164
165 if [scip-shell system . . `[`. "${package_name}" = "percona-server-56-${PACKAGE}" ]; then
166 if [scip-shell system . . `[`. "${distribution_version}" = "7" ]; then
167 rpmbuild_options="$rpmbuild_options --define 'dist .el7'"
168 fi
169 fi
170 if [scip-shell system . . `[`. "${package_name}" = "percona-server-57-${PACKAGE}" ]; then
171 if [scip-shell system . . `[`. "${distribution_version}" = "7" ]; then
172 rpmbuild_options="$rpmbuild_options --define 'dist .el7'"
173 fi
174 fi
175 if [scip-shell system . . `[`. "${USE_MYSQLSERVICES_COMPAT}" = "yes" ]; then
176 rpmbuild_options="$rpmbuild_options --define 'mroonga_configure_options --with-libmysqlservices-compat'"
177 fi
178
179 runscip-shell shell mariadb 1:11.8.8-1 run(). eval rpmbuild -ba ${rpmbuild_options} rpmbuild/SPECS/${package_name}.spec
180
181 runscip-shell shell mariadb 1:11.8.8-1 run(). mv rpmbuild/RPMS/*/* "${rpm_dir}/"
182 runscip-shell shell mariadb 1:11.8.8-1 run(). mv rpmbuild/SRPMS/* "${srpm_dir}/"