blob: 9f546569e868473b0184d9dd53019196668bb6dc [file] [log] [blame]
# -*- sh-shell: rpm -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
%define _centos_ver %{?centos_ver:%{centos_ver}}%{!?centos_ver:8}
%define use_dnf (%{_centos_ver} >= 8)
%if %{use_dnf}
%define yum_repository_enable() (dnf config-manager --set-enabled %1)
%define yum_repository_disable() (dnf config-manager --set-disabled %1)
%else
%define yum_repository_enable() (yum-config-manager --enable %1)
%define yum_repository_disable() (yum-config-manager --disable %1)
%endif
Name: @PACKAGE@
Version: @VERSION@
Release: @RELEASE@%{?dist}
Summary: Apache Arrow release files
License: Apache-2.0
URL: https://arrow.apache.org/
Source0: @PACKAGE@-%{version}.tar.gz
BuildArch: noarch
Requires: epel-release
%if %{use_dnf}
Requires: dnf-command(config-manager)
%else
Requires: yum-utils
%endif
%description
Apache Arrow release files.
%prep
%setup -q
%build
# We use distribution version explicitly because we can't use symbolic link
# on Bintray. CentOS uses 7 and 8 but RHEL uses 7Server and 8Server
# for $releasever. If we can use symbolic link on Bintray, we can use
# $releasever directly.
distribution_version=$(cut -d: -f5 /etc/system-release-cpe)
sed -i'' -e "s/\\\$releasever/${distribution_version}/g" Apache-Arrow.repo
%install
rm -rf $RPM_BUILD_ROOT
%{__install} -Dp -m0644 KEYS \
$RPM_BUILD_ROOT%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-Apache-Arrow
%{__install} -d $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d/
%{__install} -Dp -m0644 Apache-Arrow.repo \
$RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d/Apache-Arrow.repo
%files
%defattr(-, root, root, 0755)
%doc
%dir %{_sysconfdir}/yum.repos.d/
%dir %{_sysconfdir}/pki/rpm-gpg/
%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-Apache-Arrow
%config(noreplace) %{_sysconfdir}/yum.repos.d/Apache-Arrow.repo
%post
if grep -q 'Amazon Linux release 2' /etc/system-release 2>/dev/null; then
%{yum_repository_enable apache-arrow-amazon-linux}
%{yum_repository_disable apache-arrow-centos}
%{yum_repository_disable apache-arrow-rhel}
elif grep -q 'Red Hat Enterprise Linux' /etc/system-release 2>/dev/null; then
%{yum_repository_disable apache-arrow-amazon-linux}
%{yum_repository_disable apache-arrow-centos}
%{yum_repository_enable apache-arrow-rhel}
else
%{yum_repository_disable apache-arrow-amazon-linux}
%{yum_repository_enable apache-arrow-centos}
%{yum_repository_disable apache-arrow-rhel}
fi
%changelog
* Mon Jan 18 2021 Krisztián Szűcs <szucs.krisztian@gmail.com> - 3.0.0-1
- New upstream release.
* Mon Oct 12 2020 Krisztián Szűcs <szucs.krisztian@gmail.com> - 2.0.0-1
- New upstream release.
* Mon Jul 20 2020 Krisztián Szűcs <szucs.krisztian@gmail.com> - 1.0.0-1
- New upstream release.
* Thu Apr 16 2020 Krisztián Szűcs <szucs.krisztian@gmail.com> - 0.17.0-1
- New upstream release.
* Thu Jan 30 2020 Krisztián Szűcs <szucs.krisztian@gmail.com> - 0.16.0-1
- New upstream release.