#14 Move "sleep 1" workaround from py3_build to py2_build
Merged 5 years ago by churchyard. Opened 5 years ago by pviktori.
rpms/ pviktori/python-rpm-macros workaround-to-py2  into  master

file modified
+5
@@ -7,19 +7,24 @@ 

  

  # Use the slashes after expand so that the command starts on the same line as

  # the macro

+ # The `sleep 1` commands work around a race in install; see:

+ #   https://bugzilla.redhat.com/show_bug.cgi?id=1644923

  %py2_build() %{expand:\\\

+   sleep 1

    CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\

    %{__python2} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py2_shbang_opts}" %{?*}

    sleep 1

  }

  

  %py2_build_egg() %{expand:\\\

+   sleep 1

    CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\

    %{__python2} %{py_setup} %{?py_setup_args} bdist_egg %{?*}

    sleep 1

  }

  

  %py2_build_wheel() %{expand:\\\

+   sleep 1

    CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\

    %{__python2} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}

    sleep 1

file modified
-3
@@ -12,19 +12,16 @@ 

  %py3_build() %{expand:\\\

    CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\

    %{__python3} %{py_setup} %{?py_setup_args} build --executable="%{__python3} %{py3_shbang_opts}" %{?*}

-   sleep 1

  }

  

  %py3_build_egg() %{expand:\\\

    CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\

    %{__python3} %{py_setup} %{?py_setup_args} bdist_egg %{?*}

-   sleep 1

  }

  

  %py3_build_wheel() %{expand:\\\

    CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\

    %{__python3} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}

-   sleep 1

  }

  

  %py3_install() %{expand:\\\

file modified
+4 -1
@@ -1,6 +1,6 @@ 

  Name:           python-rpm-macros

  Version:        3

- Release:        38%{?dist}

+ Release:        39%{?dist}

  Summary:        The unversioned Python RPM macros

  

  License:        MIT
@@ -73,6 +73,9 @@ 

  

  

  %changelog

+ * Thu Nov 01 2018 Petr Viktorin <pviktori@redhat.com> - 3-39

+ - Move "sleep 1" workaround from py3_build to py2_build (#1644923)

+ 

  * Thu Sep 20 2018 Tomas Orsava <torsava@redhat.com> - 3-38

  - Move the __python2/3 macros to the python-srpm-macros subpackage

  - This facilitates using the %%{__python2/3} in Build/Requires

https://bugzilla.redhat.com/show_bug.cgi?id=1644923

Generally this makes Python3-only builds faster, Python2-only builds slower, and has no effect on dual-support ones.

The workaround is for a rare race condition: %py2_build and %py3_build must not be called in the same second, otherwise timestamp conflicts can confuse pyX_install. See the bug for details.

Pull-Request has been merged by churchyard

5 years ago