Patchwork [21,of,22] dockerrpm: let -py suffix build rpms that includes Python

login
register
mail settings
Submitter Mads Kiilerich
Date May 20, 2014, 2:10 a.m.
Message ID <b0dbf94de851df6a080d.1400551816@mk-desktop>
Download mbox | patch
Permalink /patch/4844/
State Changes Requested
Headers show

Comments

Mads Kiilerich - May 20, 2014, 2:10 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1400551681 -7200
#      Tue May 20 04:08:01 2014 +0200
# Node ID b0dbf94de851df6a080df4110aab749dc862c530
# Parent  6af98f88456e935b4847296f6bf5401b85cdea8b
dockerrpm: let -py suffix build rpms that includes Python

Usage example:
  make rpm-fedora20-py

Patch

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -141,6 +141,7 @@  rpm-py:
 	contrib/buildrpm --rpmbuilddir $(PWD)/build/rpm --withpython --suffix -py
 
 # Valid rpm-$NAME targets have a corresponding contrib/docker/$NAME
+# For building packages including their own Python, add -py
 rpm-%:
 	contrib/dockerrpm $@
 
diff --git a/contrib/docker/centos5 b/contrib/docker/centos5
--- a/contrib/docker/centos5
+++ b/contrib/docker/centos5
@@ -3,3 +3,5 @@  FROM saltstack/centos-5-minimal
 RUN yum install -y gcc make rpm-build gettext tar
 # For using the OS Python
 RUN yum install -y python-devel python-docutils
+# For building own Python
+RUN yum install -y readline-devel openssl-devel ncurses-devel zlib-devel bzip2-devel
diff --git a/contrib/docker/centos6 b/contrib/docker/centos6
--- a/contrib/docker/centos6
+++ b/contrib/docker/centos6
@@ -3,3 +3,5 @@  FROM centos:centos6
 RUN yum install -y gcc make rpm-build gettext tar
 # For using the OS Python
 RUN yum install -y python-devel python-docutils
+# For building own Python
+RUN yum install -y readline-devel openssl-devel ncurses-devel zlib-devel bzip2-devel
diff --git a/contrib/docker/fedora20 b/contrib/docker/fedora20
--- a/contrib/docker/fedora20
+++ b/contrib/docker/fedora20
@@ -3,3 +3,5 @@  FROM fedora:20
 RUN yum install -y gcc make rpm-build gettext tar
 # For using the OS Python
 RUN yum install -y python-devel python-docutils
+# For building own Python
+RUN yum install -y readline-devel openssl-devel ncurses-devel zlib-devel bzip2-devel
diff --git a/contrib/dockerrpm b/contrib/dockerrpm
--- a/contrib/dockerrpm
+++ b/contrib/dockerrpm
@@ -17,6 +17,11 @@  fi
 [ "$1" ] || { echo "Error: platform name must be specified"; exit 1; }
 NAME="$1"
 NAME="${NAME#rpm-}"
+EXTRAOPTIONS=
+if [ -z "${NAME%%*-py}" ]; then
+    NAME="${NAME%-py}"
+    EXTRAOPTIONS="--withpython --suffix -py"
+fi
 
 DFILE="$ROOTDIR/contrib/docker/$NAME"
 [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; }
@@ -31,7 +36,7 @@  echo RUN useradd $DBUILDUSER -u `id -u` 
 ) | $DOCKER build --tag $CONTAINER -
 
 RPMBUILD=$ROOTDIR/build/$NAME
-contrib/buildrpm --rpmbuilddir $RPMBUILD --prepare
+contrib/buildrpm --rpmbuilddir $RPMBUILD --prepare $EXTRAOPTIONS
 
 DSHARED=/mnt/shared
 $DOCKER run -u $DBUILDUSER --rm -v $RPMBUILD:$DSHARED $CONTAINER \