github.com/uriddle/docker@v0.0.0-20210926094723-4072e6aeb013/hack/make/.build-rpm/docker-engine.spec (about)

     1  Name: docker-engine
     2  Version: %{_version}
     3  Release: %{_release}%{?dist}
     4  Summary: The open-source application container engine
     5  Group: Tools/Docker
     6  
     7  License: ASL 2.0
     8  Source: %{name}.tar.gz
     9  
    10  URL: https://dockerproject.org
    11  Vendor: Docker
    12  Packager: Docker <support@docker.com>
    13  
    14  # docker builds in a checksum of dockerinit into docker,
    15  # # so stripping the binaries breaks docker
    16  %global __os_install_post %{_rpmconfigdir}/brp-compress
    17  %global debug_package %{nil}
    18  
    19  # is_systemd conditional
    20  %if 0%{?fedora} >= 21 || 0%{?centos} >= 7 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1210
    21  %global is_systemd 1
    22  %endif
    23  
    24  # required packages for build
    25  # most are already in the container (see contrib/builder/rpm/generate.sh)
    26  # only require systemd on those systems
    27  %if 0%{?is_systemd}
    28  %if 0%{?suse_version} >= 1210
    29  BuildRequires: systemd-rpm-macros
    30  %{?systemd_requires}
    31  %else
    32  BuildRequires: pkgconfig(systemd)
    33  Requires: systemd-units
    34  BuildRequires: pkgconfig(libsystemd-journal)
    35  %endif
    36  %else
    37  Requires(post): chkconfig
    38  Requires(preun): chkconfig
    39  # This is for /sbin/service
    40  Requires(preun): initscripts
    41  %endif
    42  
    43  # required packages on install
    44  Requires: /bin/sh
    45  Requires: iptables
    46  %if !0%{?suse_version}
    47  Requires: libcgroup
    48  %else
    49  Requires: libcgroup1
    50  %endif
    51  Requires: tar
    52  Requires: xz
    53  %if 0%{?fedora} >= 21 || 0%{?centos} >= 7 || 0%{?rhel} >= 7 || 0%{?oraclelinux} >= 7
    54  # Resolves: rhbz#1165615
    55  Requires: device-mapper-libs >= 1.02.90-1
    56  %endif
    57  %if 0%{?oraclelinux} >= 6
    58  # Require Oracle Unbreakable Enterprise Kernel R4 and newer device-mapper
    59  Requires: kernel-uek >= 4.1
    60  Requires: device-mapper >= 1.02.90-2
    61  %endif
    62  
    63  # docker-selinux conditional
    64  %if 0%{?fedora} >= 20 || 0%{?centos} >= 7 || 0%{?rhel} >= 7 || 0%{?oraclelinux} >= 7
    65  %global with_selinux 1
    66  %endif
    67  
    68  %if 0%{?_experimental}
    69  # yubico-piv-tool conditional
    70  %if 0%{?fedora} >= 20 || 0%{?centos} >= 7 || 0%{?rhel} >= 7
    71  Requires: yubico-piv-tool >= 1.1.0
    72  %endif
    73  %endif
    74  
    75  # start if with_selinux
    76  %if 0%{?with_selinux}
    77  # Version of SELinux we were using
    78  %if 0%{?fedora} == 20
    79  %global selinux_policyver 3.12.1-197
    80  %endif # fedora 20
    81  %if 0%{?fedora} == 21
    82  %global selinux_policyver 3.13.1-105
    83  %endif # fedora 21
    84  %if 0%{?fedora} >= 22
    85  %global selinux_policyver 3.13.1-128
    86  %endif # fedora 22
    87  %if 0%{?centos} >= 7 || 0%{?rhel} >= 7 || 0%{?oraclelinux} >= 7
    88  %global selinux_policyver 3.13.1-23
    89  %endif # centos,oraclelinux 7
    90  %endif # with_selinux
    91  
    92  # RE: rhbz#1195804 - ensure min NVR for selinux-policy
    93  %if 0%{?with_selinux}
    94  Requires: selinux-policy >= %{selinux_policyver}
    95  Requires(pre): %{name}-selinux >= %{epoch}:%{version}-%{release}
    96  %endif # with_selinux
    97  
    98  # conflicting packages
    99  Conflicts: docker
   100  Conflicts: docker-io
   101  Conflicts: docker-engine-cs
   102  
   103  %description
   104  Docker is an open source project to build, ship and run any application as a
   105  lightweight container.
   106  
   107  Docker containers are both hardware-agnostic and platform-agnostic. This means
   108  they can run anywhere, from your laptop to the largest EC2 compute instance and
   109  everything in between - and they don't require you to use a particular
   110  language, framework or packaging system. That makes them great building blocks
   111  for deploying and scaling web apps, databases, and backend services without
   112  depending on a particular stack or provider.
   113  
   114  %prep
   115  %if 0%{?centos} <= 6 || 0%{?oraclelinux} <=6
   116  %setup -n %{name}
   117  %else
   118  %autosetup -n %{name}
   119  %endif
   120  
   121  %build
   122  export DOCKER_GITCOMMIT=%{_gitcommit}
   123  ./hack/make.sh dynbinary
   124  # ./man/md2man-all.sh runs outside the build container (if at all), since we don't have go-md2man here
   125  
   126  %check
   127  ./bundles/%{_origversion}/dynbinary/docker -v
   128  
   129  %install
   130  # install binary
   131  install -d $RPM_BUILD_ROOT/%{_bindir}
   132  install -p -m 755 bundles/%{_origversion}/dynbinary/docker-%{_origversion} $RPM_BUILD_ROOT/%{_bindir}/docker
   133  
   134  # install dockerinit
   135  install -d $RPM_BUILD_ROOT/%{_libexecdir}/docker
   136  install -p -m 755 bundles/%{_origversion}/dynbinary/dockerinit-%{_origversion} $RPM_BUILD_ROOT/%{_libexecdir}/docker/dockerinit
   137  
   138  # install udev rules
   139  install -d $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d
   140  install -p -m 644 contrib/udev/80-docker.rules $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d/80-docker.rules
   141  
   142  # add init scripts
   143  install -d $RPM_BUILD_ROOT/etc/sysconfig
   144  install -d $RPM_BUILD_ROOT/%{_initddir}
   145  
   146  
   147  %if 0%{?is_systemd}
   148  install -d $RPM_BUILD_ROOT/%{_unitdir}
   149  install -p -m 644 contrib/init/systemd/docker.service $RPM_BUILD_ROOT/%{_unitdir}/docker.service
   150  install -p -m 644 contrib/init/systemd/docker.socket $RPM_BUILD_ROOT/%{_unitdir}/docker.socket
   151  %else
   152  install -p -m 644 contrib/init/sysvinit-redhat/docker.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/docker
   153  install -p -m 755 contrib/init/sysvinit-redhat/docker $RPM_BUILD_ROOT/%{_initddir}/docker
   154  %endif
   155  # add bash, zsh, and fish completions
   156  install -d $RPM_BUILD_ROOT/usr/share/bash-completion/completions
   157  install -d $RPM_BUILD_ROOT/usr/share/zsh/vendor-completions
   158  install -d $RPM_BUILD_ROOT/usr/share/fish/vendor_completions.d
   159  install -p -m 644 contrib/completion/bash/docker $RPM_BUILD_ROOT/usr/share/bash-completion/completions/docker
   160  install -p -m 644 contrib/completion/zsh/_docker $RPM_BUILD_ROOT/usr/share/zsh/vendor-completions/_docker
   161  install -p -m 644 contrib/completion/fish/docker.fish $RPM_BUILD_ROOT/usr/share/fish/vendor_completions.d/docker.fish
   162  
   163  # install manpages
   164  install -d %{buildroot}%{_mandir}/man1
   165  install -p -m 644 man/man1/*.1 $RPM_BUILD_ROOT/%{_mandir}/man1
   166  install -d %{buildroot}%{_mandir}/man5
   167  install -p -m 644 man/man5/*.5 $RPM_BUILD_ROOT/%{_mandir}/man5
   168  
   169  # add vimfiles
   170  install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/doc
   171  install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/ftdetect
   172  install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/syntax
   173  install -p -m 644 contrib/syntax/vim/doc/dockerfile.txt $RPM_BUILD_ROOT/usr/share/vim/vimfiles/doc/dockerfile.txt
   174  install -p -m 644 contrib/syntax/vim/ftdetect/dockerfile.vim $RPM_BUILD_ROOT/usr/share/vim/vimfiles/ftdetect/dockerfile.vim
   175  install -p -m 644 contrib/syntax/vim/syntax/dockerfile.vim $RPM_BUILD_ROOT/usr/share/vim/vimfiles/syntax/dockerfile.vim
   176  
   177  # add nano
   178  install -d $RPM_BUILD_ROOT/usr/share/nano
   179  install -p -m 644 contrib/syntax/nano/Dockerfile.nanorc $RPM_BUILD_ROOT/usr/share/nano/Dockerfile.nanorc
   180  
   181  # list files owned by the package here
   182  %files
   183  %doc AUTHORS CHANGELOG.md CONTRIBUTING.md LICENSE MAINTAINERS NOTICE README.md
   184  /%{_bindir}/docker
   185  /%{_libexecdir}/docker/dockerinit
   186  /%{_sysconfdir}/udev/rules.d/80-docker.rules
   187  %if 0%{?is_systemd}
   188  /%{_unitdir}/docker.service
   189  /%{_unitdir}/docker.socket
   190  %else
   191  %config(noreplace,missingok) /etc/sysconfig/docker
   192  /%{_initddir}/docker
   193  %endif
   194  /usr/share/bash-completion/completions/docker
   195  /usr/share/zsh/vendor-completions/_docker
   196  /usr/share/fish/vendor_completions.d/docker.fish
   197  %doc
   198  /%{_mandir}/man1/*
   199  /%{_mandir}/man5/*
   200  /usr/share/vim/vimfiles/doc/dockerfile.txt
   201  /usr/share/vim/vimfiles/ftdetect/dockerfile.vim
   202  /usr/share/vim/vimfiles/syntax/dockerfile.vim
   203  /usr/share/nano/Dockerfile.nanorc
   204  
   205  %post
   206  %if 0%{?is_systemd}
   207  %systemd_post docker
   208  %else
   209  # This adds the proper /etc/rc*.d links for the script
   210  /sbin/chkconfig --add docker
   211  %endif
   212  if ! getent group docker > /dev/null; then
   213      groupadd --system docker
   214  fi
   215  
   216  %preun
   217  %if 0%{?is_systemd}
   218  %systemd_preun docker
   219  %else
   220  if [ $1 -eq 0 ] ; then
   221      /sbin/service docker stop >/dev/null 2>&1
   222      /sbin/chkconfig --del docker
   223  fi
   224  %endif
   225  
   226  %postun
   227  %if 0%{?is_systemd}
   228  %systemd_postun_with_restart docker
   229  %else
   230  if [ "$1" -ge "1" ] ; then
   231      /sbin/service docker condrestart >/dev/null 2>&1 || :
   232  fi
   233  %endif
   234  
   235  %changelog