3b7b33
# mock group id allocate for Fedora
3b7b33
%global mockgid 135
3b7b33
812bc6
Name:       mock-core-configs
812bc6
Version:    31.1
812bc6
Release:    1%{?dist}
812bc6
Summary:    Mock core config files basic chroots
3b7b33
812bc6
License:    GPLv2+
812bc6
URL:        https://github.com/rpm-software-management/mock/
3b7b33
# Source is created by
3b7b33
# git clone https://github.com/rpm-software-management/mock.git
3b7b33
# cd mock/mock-core-configs
3b7b33
# git reset --hard %{name}-%{version}
3b7b33
# tito build --tgz
812bc6
Source:     https://github.com/rpm-software-management/mock/releases/download/%{name}-%{version}-1/%{name}-%{version}.tar.gz
812bc6
BuildArch:  noarch
6c5fee
6c5fee
# distribution-gpg-keys contains GPG keys used by mock configs
812bc6
Requires:   distribution-gpg-keys >= 1.29
6c5fee
3b7b33
Requires(post): coreutils
07092d
%if 0%{?fedora} > 29 || 0%{?rhel} > 8
812bc6
BuildRequires:  systemd-rpm-macros
07092d
%endif
131a57
%if 0%{?fedora} || 0%{?mageia} || 0%{?rhel} > 7
3b7b33
# to detect correct default.cfg
812bc6
Requires(post): python3-dnf
812bc6
Requires(post): python3-hawkey
812bc6
Requires(post): system-release
812bc6
Requires(post): python3
812bc6
Requires(post): sed
3b7b33
%endif
7a440f
%if 0%{?rhel} && 0%{?rhel} <= 7
812bc6
Requires(pre):  shadow-utils
3b7b33
# to detect correct default.cfg
812bc6
Requires(post): python
812bc6
Requires(post): yum
812bc6
Requires(post): /etc/os-release
3b7b33
%endif
3b7b33
3b7b33
%description
3b7b33
Config files which allow you to create chroots for:
3b7b33
 * Fedora
3b7b33
 * Epel
3b7b33
 * Mageia
3b7b33
 * Custom chroot
816829
 * OpenSuse Tumbleweed and Leap
3b7b33
3b7b33
%prep
3b7b33
%setup -q
3b7b33
3b7b33
3b7b33
%build
3b7b33
# nothing to do here
3b7b33
3b7b33
3b7b33
%install
07092d
mkdir -p %{buildroot}%{_sysusersdir}
07092d
%if 0%{?fedora} > 29 || 0%{?rhel} > 8
07092d
cp -a mock.conf %{buildroot}%{_sysusersdir}
07092d
%endif
07092d
fa9d7b
mkdir -p %{buildroot}%{_sysconfdir}/mock/eol
a99de4
cp -a etc/mock/*.cfg %{buildroot}%{_sysconfdir}/mock
fa9d7b
cp -a etc/mock/eol/*cfg %{buildroot}%{_sysconfdir}/mock/eol
3b7b33
3b7b33
# generate files section with config - there is many of them
3b7b33
echo "%defattr(0644, root, mock)" > %{name}.cfgs
3b7b33
find %{buildroot}%{_sysconfdir}/mock -name "*.cfg" \
3b7b33
    | sed -e "s|^%{buildroot}|%%config(noreplace) |" >> %{name}.cfgs
3b7b33
# just for %%ghosting purposes
3b7b33
ln -s fedora-rawhide-x86_64.cfg %{buildroot}%{_sysconfdir}/mock/default.cfg
3b7b33
# bash-completion
3b7b33
if [ -d %{buildroot}%{_datadir}/bash-completion ]; then
3b7b33
    echo %{_datadir}/bash-completion/completions/mock >> %{name}.cfgs
3b7b33
    echo %{_datadir}/bash-completion/completions/mockchain >> %{name}.cfgs
3b7b33
elif [ -d %{buildroot}%{_sysconfdir}/bash_completion.d ]; then
3b7b33
    echo %{_sysconfdir}/bash_completion.d/mock >> %{name}.cfgs
3b7b33
fi
3b7b33
07092d
3b7b33
%pre
07092d
%if 0%{?fedora} > 29 || 0%{?rhel} > 8
07092d
%sysusers_create_package mock mock.conf
07092d
%else
3b7b33
# check for existence of mock group, create it if not found
3b7b33
getent group mock > /dev/null || groupadd -f -g %mockgid -r mock
3b7b33
exit 0
07092d
%endif
3b7b33
3b7b33
%post
3b7b33
if [ -s /etc/os-release ]; then
131a57
    # fedora and rhel7+
3b7b33
    if grep -Fiq Rawhide /etc/os-release; then
3b7b33
        ver=rawhide
6c5fee
    # mageia
6c5fee
    elif [ -s /etc/mageia-release ]; then
6c5fee
        if grep -Fiq Cauldron /etc/mageia-release; then
6c5fee
           ver=cauldron
6c5fee
        fi
3b7b33
    else
3b7b33
        ver=$(source /etc/os-release && echo $VERSION_ID | cut -d. -f1 | grep -o '[0-9]\+')
3b7b33
    fi
3b7b33
else
3b7b33
    # something obsure, use buildtime version
6c5fee
    ver=%{?rhel}%{?fedora}%{?mageia}
6c5fee
fi
131a57
%if 0%{?fedora} || 0%{?mageia} || 0%{?rhel} > 7
6c5fee
if [ -s /etc/mageia-release ]; then
6c5fee
    mock_arch=$(sed -n '/^$/!{$ s/.* \(\w*\)$/\1/p}' /etc/mageia-release)
6c5fee
else
6c5fee
    mock_arch=$(python3 -c "import dnf.rpm; import hawkey; print(dnf.rpm.basearch(hawkey.detect_arch()))")
3b7b33
fi
3b7b33
%else
3b7b33
mock_arch=$(python -c "import rpmUtils.arch; baseArch = rpmUtils.arch.getBaseArch(); print baseArch")
3b7b33
%endif
6c5fee
cfg=%{?fedora:fedora}%{?rhel:epel}%{?mageia:mageia}-$ver-${mock_arch}.cfg
3b7b33
if [ -e %{_sysconfdir}/mock/$cfg ]; then
3b7b33
    if [ "$(readlink %{_sysconfdir}/mock/default.cfg)" != "$cfg" ]; then
3b7b33
        ln -s $cfg %{_sysconfdir}/mock/default.cfg 2>/dev/null || ln -s -f $cfg %{_sysconfdir}/mock/default.cfg.rpmnew
3b7b33
    fi
3b7b33
else
6c5fee
    echo "Warning: file %{_sysconfdir}/mock/$cfg does not exist."
3b7b33
    echo "         unable to update %{_sysconfdir}/mock/default.cfg"
3b7b33
fi
3b7b33
:
3b7b33
3b7b33
3b7b33
%files -f %{name}.cfgs
3b7b33
%license COPYING
07092d
%if 0%{?fedora} > 29 || 0%{?rhel} > 8
07092d
%{_sysusersdir}/mock.conf
07092d
%endif
3b7b33
%dir  %{_sysconfdir}/mock
fa9d7b
%dir  %{_sysconfdir}/mock/eol
3b7b33
%ghost %config(noreplace,missingok) %{_sysconfdir}/mock/default.cfg
3b7b33
3b7b33
%changelog
812bc6
* Mon Aug 19 2019 Miroslav Suchý <msuchy@redhat.com> 31.1-1
812bc6
- add fedora 31 configs and rawhide is now 32
812bc6
- Add local-source repo definition to Fedora Rawhide (miro@hroncok.cz)
812bc6
812bc6
* Mon Aug 19 2019 Miroslav Suchý <msuchy@redhat.com>
812bc6
- add fedora 31 configs and rawhide is now 32
812bc6
- Add local-source repo definition to Fedora Rawhide (miro@hroncok.cz)
812bc6
07092d
* Thu Aug 08 2019 Miroslav Suchý <msuchy@redhat.com> 30.5-1
07092d
- disable updates-modulare repos for now
07092d
- buildrequire systemd-srpm-macros to get _sysusersdir
07092d
- removed info about metadata expire (khoidinhtrinh@gmail.com)
07092d
- added updates-modular to 29 and 30 (khoidinhtrinh@gmail.com)
07092d
- replace groupadd using sysusers.d
07092d
- core-configs: epel-7 profiles to use mirrorlists (praiskup@redhat.com)
07092d
- EOL Fedora 28
07092d
- do not protect packages in chroot [GH#286]
07092d
- Fix value for dist for OpenMandriva 4.0 configs (ngompa13@gmail.com)
07092d
- Add initial OpenMandriva distribution targets (ngompa13@gmail.com)
2993b1
14d70b
* Thu Jun 06 2019 Miroslav Suchý <msuchy@redhat.com> 30.4-1
14d70b
- Add 'fastestmirror=1' to Mageia mock configs (ngompa13@gmail.com)
14d70b
- bootstrap: disable sclo* repos for epel --installroot (praiskup@redhat.com)
14d70b
- drop Fedora ppc64 configs [RHBZ#1714489]
14d70b
d5f57f
* Thu May 16 2019 Miroslav Suchý <msuchy@redhat.com> 30.3-1
d5f57f
- Allow AArch64 systems to build 32-bit ARM packages (ngompa13@gmail.com)
d5f57f
- Fix openSUSE Tumbleweed DistTag definition (ngompa13@gmail.com)
d5f57f
7c816c
* Fri Mar 01 2019 Miroslav Suchý <msuchy@redhat.com> 30.2-1
7c816c
- disable modular repos
7c816c
- Add openSUSE Leap AArch64 configs (ngompa13@gmail.com)
7c816c
- Add openSUSE Leap 15.1 configuration (ngompa13@gmail.com)
7c816c
- Bump releasever in Cauldron to 8 and create symlinks to cauldron configs
7c816c
  (ngompa13@gmail.com)
7c816c
- Add Mageia 7 configs (ngompa13@gmail.com)
7c816c
268a78
* Tue Feb 19 2019 Miroslav Suchý <msuchy@redhat.com> 30.1-1
268a78
- default for config['decompress_program'] (praiskup@redhat.com)
268a78
- require recent distribution-gpg-keys which has F31 key
268a78
- add examples how to enable/install module in F29+ configs
268a78
- add module_platform_id
268a78
- add modular repos
268a78
- enable gpgcheck for debuginfo for rawhide
268a78
- enable gpgcheck for testing and debuginfo for F30
268a78
- EOL Fedora 27 configs
268a78
- remove mdpolicy from F30
268a78
- add Fedora 30 configs
268a78
- add link to distribution-gpg-keys for rhel8 bootstrap
77d782
5fac97
* Fri Nov 16 2018 Miroslav Suchý <msuchy@redhat.com> 29.4-1
5fac97
- use correct gpg keys for rhelbeta-8
5fac97
- add virtual platform module
5fac97
fa9d7b
* Thu Nov 15 2018 Miroslav Suchý <msuchy@redhat.com> 29.3-1
fa9d7b
- add rhelbeta-8-* configs
fa9d7b
- move EOLed configs to /etc/mock/eol directory
fa9d7b
- Add source repos to all fedora configs (sfowler@redhat.com)
fa9d7b
- add epel-7-ppc64.cfg
fa9d7b
20ec61
* Thu Aug 16 2018 Miroslav Suchý <msuchy@redhat.com> 29.2-1
20ec61
- add gpg keys for release rawhide-1 (msuchy@redhat.com)
20ec61
816829
* Mon Aug 13 2018 Miroslav Suchý <msuchy@redhat.com> 29.1-1
816829
- add fedora 29 configs and change rawhide to F30
816829
- defattr is not needed since rpm 4.2
816829
- Replace armv5tl with aarch64 for Mageia Cauldron (ngompa13@gmail.com)
816829
- check gpg keys for rawhide
33b3b1
a99de4
* Wed May 02 2018 Miroslav Suchý <msuchy@redhat.com> 28.4-1
a99de4
- requires distribution-gpg-keys with opensuse keys
a99de4
- Add initial openSUSE distribution targets (ngompa13@gmail.com)
a99de4
- provide fedora-29 configs as symlinks to fedora-rawhide
a99de4
- use cp instead of install to preserve symlinks
a99de4
- use correct url for local repos for s390x for F27+ [RHBZ#1553678]
a99de4
- add CentOS SCL repositories to EPEL 7 (aarch64 & ppc64le)
a99de4
  (tmz@pobox.com)
a99de4
0c5de0
* Thu Mar 01 2018 Miroslav Suchý <msuchy@redhat.com> 28.3-1
0c5de0
- bump up releasever in rawhide configs
0c5de0
- add CentOS SCL repositories to EPEL 6 & 7 (x86_64)
0c5de0
  (tmz@pobox.com)
d7c364
287552
* Mon Jan 22 2018 Miroslav Suchý <msuchy@redhat.com> 28.2-1
287552
- fix wrong RHEL condition
7a440f
131a57
* Mon Jan 22 2018 Miroslav Suchý <msuchy@redhat.com> 28.1-1
131a57
- bump up version to 28.1
131a57
131a57
* Mon Jan 22 2018 Miroslav Suchý <msuchy@redhat.com> 27.5-1
131a57
- add fedora 28 configs
131a57
- remove failovermethod=priority for repos which use dnf
131a57
- remove fedora 24 configs
131a57
- set skip_if_unavailable=False for all repos
131a57
6c5fee
* Mon Oct 09 2017 Miroslav Suchý <msuchy@redhat.com> 27.4-1
6c5fee
- Fix mock & mock-core-config specs to support Mageia (ngompa13@gmail.com)
6c5fee
- Ensure mock-core-configs will select the right default on Mageia
6c5fee
  (ngompa13@gmail.com)
6c5fee
bf877f
* Wed Sep 27 2017 Miroslav Suchý <msuchy@redhat.com> 27.3-1
bf877f
- use primary key for F-27+ on s390x (dan@danny.cz)
bf877f
3b7b33
* Tue Sep 12 2017 Miroslav Suchý <msuchy@redhat.com> 27.2-1
3b7b33
- add source url
3b7b33
- grammar fix
3b7b33
3b7b33
* Thu Sep 07 2017 Miroslav Suchý <msuchy@redhat.com> 27.1-1
3b7b33
- Split from Mock package.
3b7b33
3b7b33