##// END OF EJS Templates
packaging: switch centos 7 packaging to python 3...
Mathias De Mare -
r46440:de1f4c43 default
parent child Browse files
Show More
@@ -1,134 +1,135 b''
1 $(eval HGROOT := $(shell cd ../..; pwd))
1 $(eval HGROOT := $(shell cd ../..; pwd))
2
2
3 DEBIAN_CODENAMES := \
3 DEBIAN_CODENAMES := \
4 stretch \
4 stretch \
5 buster \
5 buster \
6 bullseye
6 bullseye
7
7
8 UBUNTU_CODENAMES := \
8 UBUNTU_CODENAMES := \
9 xenial \
9 xenial \
10 bionic \
10 bionic \
11 cosmic \
11 cosmic \
12 disco
12 disco
13
13
14 FEDORA_RELEASE := 31
14 FEDORA_RELEASE := 31
15
15
16 CENTOS_RELEASES := \
16 CENTOS_RELEASES := \
17 7 \
17 7 \
18 8
18 8
19
19
20 # Build a Python for these CentOS releases.
20 # Build a Python for these CentOS releases.
21 CENTOS_WITH_PYTHON_RELEASES :=
21 CENTOS_WITH_PYTHON_RELEASES :=
22 CENTOS_WITH_NONVERSIONED_PYTHON :=
22 CENTOS_WITH_NONVERSIONED_PYTHON :=
23 CENTOS_WITH_36_DOCUTILS := 7
23
24
24 help:
25 help:
25 @echo 'Packaging Make Targets'
26 @echo 'Packaging Make Targets'
26 @echo ''
27 @echo ''
27 @echo 'docker-centos{$(strip $(CENTOS_RELEASES))}'
28 @echo 'docker-centos{$(strip $(CENTOS_RELEASES))}'
28 @echo ' Build an RPM for a specific CentOS version using Docker.'
29 @echo ' Build an RPM for a specific CentOS version using Docker.'
29 @echo ''
30 @echo ''
30 @echo 'docker-debian-{$(strip $(DEBIAN_CODENAMES))}'
31 @echo 'docker-debian-{$(strip $(DEBIAN_CODENAMES))}'
31 @echo ' Build Debian packages specific to a Debian distro using Docker.'
32 @echo ' Build Debian packages specific to a Debian distro using Docker.'
32 @echo ''
33 @echo ''
33 @echo 'docker-fedora'
34 @echo 'docker-fedora'
34 @echo ' Build an RPM for a Fedora $(FEDORA_RELEASE) using Docker.'
35 @echo ' Build an RPM for a Fedora $(FEDORA_RELEASE) using Docker.'
35 @echo ''
36 @echo ''
36 @echo 'docker-ubuntu-{$(strip $(UBUNTU_CODENAMES))}'
37 @echo 'docker-ubuntu-{$(strip $(UBUNTU_CODENAMES))}'
37 @echo ' Build Debian package specific to an Ubuntu distro using Docker.'
38 @echo ' Build Debian package specific to an Ubuntu distro using Docker.'
38 @echo ''
39 @echo ''
39 @echo 'docker-ubuntu-{$(strip $(UBUNTU_CODENAMES))}-ppa'
40 @echo 'docker-ubuntu-{$(strip $(UBUNTU_CODENAMES))}-ppa'
40 @echo ' Build a source-only Debian package specific to an Ubuntu distro'
41 @echo ' Build a source-only Debian package specific to an Ubuntu distro'
41 @echo ' using Docker.'
42 @echo ' using Docker.'
42 @echo ''
43 @echo ''
43 @echo 'linux-wheels'
44 @echo 'linux-wheels'
44 @echo ' Build Linux manylinux wheels using Docker.'
45 @echo ' Build Linux manylinux wheels using Docker.'
45 @echo ''
46 @echo ''
46 @echo 'linux-wheels-{x86_64, i686}'
47 @echo 'linux-wheels-{x86_64, i686}'
47 @echo ' Build Linux manylinux wheels for a specific architecture using Docker'
48 @echo ' Build Linux manylinux wheels for a specific architecture using Docker'
48 @echo ''
49 @echo ''
49 @echo 'deb'
50 @echo 'deb'
50 @echo ' Build a Debian package locally targeting the current system'
51 @echo ' Build a Debian package locally targeting the current system'
51 @echo ''
52 @echo ''
52 @echo 'ppa'
53 @echo 'ppa'
53 @echo ' Build a Debian source package locally targeting the current system'
54 @echo ' Build a Debian source package locally targeting the current system'
54 @echo ''
55 @echo ''
55 @echo 'centos{$(strip $(CENTOS_RELEASES))}'
56 @echo 'centos{$(strip $(CENTOS_RELEASES))}'
56 @echo ' Build an RPM for a specific CentOS version locally'
57 @echo ' Build an RPM for a specific CentOS version locally'
57 @echo ''
58 @echo ''
58 @echo 'fedora'
59 @echo 'fedora'
59 @echo ' Build an RPM for Fedora $(FEDORA_RELEASE) locally'
60 @echo ' Build an RPM for Fedora $(FEDORA_RELEASE) locally'
60
61
61 .PHONY: help
62 .PHONY: help
62
63
63 .PHONY: deb
64 .PHONY: deb
64 deb:
65 deb:
65 ./builddeb
66 ./builddeb
66
67
67 .PHONY: ppa
68 .PHONY: ppa
68 ppa:
69 ppa:
69 ./builddeb --source-only
70 ./builddeb --source-only
70
71
71 # Debian targets.
72 # Debian targets.
72 define debian_targets =
73 define debian_targets =
73 .PHONY: docker-debian-$(1)
74 .PHONY: docker-debian-$(1)
74 docker-debian-$(1):
75 docker-debian-$(1):
75 ./dockerdeb debian $(1)
76 ./dockerdeb debian $(1)
76
77
77 endef
78 endef
78
79
79 $(foreach codename,$(DEBIAN_CODENAMES),$(eval $(call debian_targets,$(codename))))
80 $(foreach codename,$(DEBIAN_CODENAMES),$(eval $(call debian_targets,$(codename))))
80
81
81 # Ubuntu targets.
82 # Ubuntu targets.
82 define ubuntu_targets =
83 define ubuntu_targets =
83 .PHONY: docker-ubuntu-$(1)
84 .PHONY: docker-ubuntu-$(1)
84 docker-ubuntu-$(1):
85 docker-ubuntu-$(1):
85 ./dockerdeb ubuntu $(1)
86 ./dockerdeb ubuntu $(1)
86
87
87 .PHONY: docker-ubuntu-$(1)-ppa
88 .PHONY: docker-ubuntu-$(1)-ppa
88 docker-ubuntu-$(1)-ppa:
89 docker-ubuntu-$(1)-ppa:
89 ./dockerdeb ubuntu $(1) --source-only
90 ./dockerdeb ubuntu $(1) --source-only
90
91
91 endef
92 endef
92
93
93 $(foreach codename,$(UBUNTU_CODENAMES),$(eval $(call ubuntu_targets,$(codename))))
94 $(foreach codename,$(UBUNTU_CODENAMES),$(eval $(call ubuntu_targets,$(codename))))
94
95
95 # Fedora targets.
96 # Fedora targets.
96 .PHONY: fedora
97 .PHONY: fedora
97 fedora:
98 fedora:
98 mkdir -p $(HGROOT)/packages/fedora$(FEDORA_RELEASE)
99 mkdir -p $(HGROOT)/packages/fedora$(FEDORA_RELEASE)
99 ./buildrpm
100 ./buildrpm
100 cp $(HGROOT)/contrib/packaging/rpmbuild/RPMS/*/* $(HGROOT)/packages/fedora$(FEDORA_RELEASE)
101 cp $(HGROOT)/contrib/packaging/rpmbuild/RPMS/*/* $(HGROOT)/packages/fedora$(FEDORA_RELEASE)
101 cp $(HGROOT)/contrib/packaging/rpmbuild/SRPMS/* $(HGROOT)/packages/fedora$(FEDORA_RELEASE)
102 cp $(HGROOT)/contrib/packaging/rpmbuild/SRPMS/* $(HGROOT)/packages/fedora$(FEDORA_RELEASE)
102 rm -rf $(HGROOT)/rpmbuild
103 rm -rf $(HGROOT)/rpmbuild
103
104
104 .PHONY: docker-fedora
105 .PHONY: docker-fedora
105 docker-fedora:
106 docker-fedora:
106 ./dockerrpm fedora$(FEDORA_RELEASE)
107 ./dockerrpm fedora$(FEDORA_RELEASE)
107
108
108 # CentOS targets.
109 # CentOS targets.
109 define centos_targets
110 define centos_targets
110 .PHONY: centos$(1)
111 .PHONY: centos$(1)
111 centos$(1):
112 centos$(1):
112 mkdir -p $$(HGROOT)/packages/centos$(1)
113 mkdir -p $$(HGROOT)/packages/centos$(1)
113 ./buildrpm $$(if $$(filter $(1),$$(CENTOS_WITH_PYTHON_RELEASES)),--withpython,$$(if $$(filter $(1),$$(CENTOS_WITH_NONVERSIONED_PYTHON)),--python python,))
114 ./buildrpm $$(if $$(filter $(1),$$(CENTOS_WITH_PYTHON_RELEASES)),--withpython,$$(if $$(filter $(1),$$(CENTOS_WITH_NONVERSIONED_PYTHON)),--python python,))$$(if $$(filter $(1),$$(CENTOS_WITH_36_DOCUTILS)), --docutilspackage python36-docutils,)
114 cp $$(HGROOT)/contrib/packaging/rpmbuild/RPMS/*/* $$(HGROOT)/packages/centos$(1)
115 cp $$(HGROOT)/contrib/packaging/rpmbuild/RPMS/*/* $$(HGROOT)/packages/centos$(1)
115 cp $$(HGROOT)/contrib/packaging/rpmbuild/SRPMS/* $$(HGROOT)/packages/centos$(1)
116 cp $$(HGROOT)/contrib/packaging/rpmbuild/SRPMS/* $$(HGROOT)/packages/centos$(1)
116
117
117 .PHONY: docker-centos$(1)
118 .PHONY: docker-centos$(1)
118 docker-centos$(1):
119 docker-centos$(1):
119 ./dockerrpm centos$(1) $$(if $$(filter $(1),$$(CENTOS_WITH_PYTHON_RELEASES)),--withpython,$$(if $$(filter $(1),$$(CENTOS_WITH_NONVERSIONED_PYTHON)),--python python,))
120 ./dockerrpm centos$(1) $$(if $$(filter $(1),$$(CENTOS_WITH_PYTHON_RELEASES)),--withpython,$$(if $$(filter $(1),$$(CENTOS_WITH_NONVERSIONED_PYTHON)),--python python,))$$(if $$(filter $(1),$$(CENTOS_WITH_36_DOCUTILS)), --docutilspackage python36-docutils,)
120
121
121 endef
122 endef
122
123
123 $(foreach release,$(CENTOS_RELEASES),$(eval $(call centos_targets,$(release))))
124 $(foreach release,$(CENTOS_RELEASES),$(eval $(call centos_targets,$(release))))
124
125
125 .PHONY: linux-wheels
126 .PHONY: linux-wheels
126 linux-wheels: linux-wheels-x86_64 linux-wheels-i686
127 linux-wheels: linux-wheels-x86_64 linux-wheels-i686
127
128
128 .PHONY: linux-wheels-x86_64
129 .PHONY: linux-wheels-x86_64
129 linux-wheels-x86_64:
130 linux-wheels-x86_64:
130 docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`/../..:/src quay.io/pypa/manylinux1_x86_64 /src/contrib/packaging/build-linux-wheels.sh
131 docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`/../..:/src quay.io/pypa/manylinux1_x86_64 /src/contrib/packaging/build-linux-wheels.sh
131
132
132 .PHONY: linux-wheels-i686
133 .PHONY: linux-wheels-i686
133 linux-wheels-i686:
134 linux-wheels-i686:
134 docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`/../..:/src quay.io/pypa/manylinux1_i686 linux32 /src/contrib/packaging/build-linux-wheels.sh
135 docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`/../..:/src quay.io/pypa/manylinux1_i686 linux32 /src/contrib/packaging/build-linux-wheels.sh
@@ -1,163 +1,172 b''
1 #!/bin/bash -e
1 #!/bin/bash -e
2 #
2 #
3 # Build a Mercurial RPM from the current repo, mainly for Fedora/CentOS/RHEL
3 # Build a Mercurial RPM from the current repo, mainly for Fedora/CentOS/RHEL
4
4
5 . $(dirname $0)/packagelib.sh
5 . $(dirname $0)/packagelib.sh
6
6
7 BUILD=1
7 BUILD=1
8 RPMBUILDDIR="$PWD/rpmbuild"
8 RPMBUILDDIR="$PWD/rpmbuild"
9 PYTHONEXE=python3
9 PYTHONEXE=python3
10 DOCUTILSPACKAGE=python3-docutils
10
11
11 while [ "$1" ]; do
12 while [ "$1" ]; do
12 case "$1" in
13 case "$1" in
13 --prepare )
14 --prepare )
14 shift
15 shift
15 BUILD=
16 BUILD=
16 ;;
17 ;;
17 --python)
18 --python)
18 shift
19 shift
19 PYTHONEXE=$1
20 PYTHONEXE=$1
20 shift
21 shift
21 ;;
22 ;;
22 --withpython | --with-python)
23 --withpython | --with-python)
23 shift
24 shift
24 PYTHONVER=2.7.16
25 PYTHONVER=2.7.16
25 PYTHONMD5=f1a2ace631068444831d01485466ece0
26 PYTHONMD5=f1a2ace631068444831d01485466ece0
26 PYTHONEXE=python
27 PYTHONEXE=python
27 ;;
28 ;;
29 --docutilspackage)
30 shift
31 DOCUTILSPACKAGE="$1"
32 shift
33 ;;
28 --rpmbuilddir )
34 --rpmbuilddir )
29 shift
35 shift
30 RPMBUILDDIR="$1"
36 RPMBUILDDIR="$1"
31 shift
37 shift
32 ;;
38 ;;
33 * )
39 * )
34 echo "Invalid parameter $1!" 1>&2
40 echo "Invalid parameter $1!" 1>&2
35 exit 1
41 exit 1
36 ;;
42 ;;
37 esac
43 esac
38 done
44 done
39
45
40 cd "`dirname $0`/../.."
46 cd "`dirname $0`/../.."
41
47
42 specfile=$PWD/contrib/packaging/mercurial.spec
48 specfile=$PWD/contrib/packaging/mercurial.spec
43 if [ ! -f $specfile ]; then
49 if [ ! -f $specfile ]; then
44 echo "Cannot find $specfile!" 1>&2
50 echo "Cannot find $specfile!" 1>&2
45 exit 1
51 exit 1
46 fi
52 fi
47
53
48 if [ ! -d .hg ]; then
54 if [ ! -d .hg ]; then
49 echo 'You are not inside a Mercurial repository!' 1>&2
55 echo 'You are not inside a Mercurial repository!' 1>&2
50 exit 1
56 exit 1
51 fi
57 fi
52
58
53 gethgversion
59 gethgversion
54
60
55 if [ -z "$type" ] ; then
61 if [ -z "$type" ] ; then
56 release=1
62 release=1
57 else
63 else
58 release=0.9_$type
64 release=0.9_$type
59 fi
65 fi
60
66
61 if [ -n "$distance" ] ; then
67 if [ -n "$distance" ] ; then
62 release=$release+${distance}_${node}
68 release=$release+${distance}_${node}
63 fi
69 fi
64
70
65 if [ "$PYTHONVER" ]; then
71 if [ "$PYTHONVER" ]; then
66 release=$release+$PYTHONVER
72 release=$release+$PYTHONVER
67 RPMPYTHONVER=$PYTHONVER
73 RPMPYTHONVER=$PYTHONVER
68 else
74 else
69 RPMPYTHONVER=%{nil}
75 RPMPYTHONVER=%{nil}
70 fi
76 fi
71
77
72 mkdir -p $RPMBUILDDIR/{SOURCES,BUILD,SRPMS,RPMS}
78 mkdir -p $RPMBUILDDIR/{SOURCES,BUILD,SRPMS,RPMS}
73 $HG archive -t tgz $RPMBUILDDIR/SOURCES/mercurial-$version-$release.tar.gz
79 $HG archive -t tgz $RPMBUILDDIR/SOURCES/mercurial-$version-$release.tar.gz
74 if [ "$PYTHONVER" ]; then
80 if [ "$PYTHONVER" ]; then
75 (
81 (
76 mkdir -p build
82 mkdir -p build
77 cd build
83 cd build
78 PYTHON_SRCFILE=Python-$PYTHONVER.tgz
84 PYTHON_SRCFILE=Python-$PYTHONVER.tgz
79 [ -f $PYTHON_SRCFILE ] || curl -Lo $PYTHON_SRCFILE http://www.python.org/ftp/python/$PYTHONVER/$PYTHON_SRCFILE
85 [ -f $PYTHON_SRCFILE ] || curl -Lo $PYTHON_SRCFILE http://www.python.org/ftp/python/$PYTHONVER/$PYTHON_SRCFILE
80 if [ "$PYTHONMD5" ]; then
86 if [ "$PYTHONMD5" ]; then
81 echo "$PYTHONMD5 $PYTHON_SRCFILE" | md5sum -w -c
87 echo "$PYTHONMD5 $PYTHON_SRCFILE" | md5sum -w -c
82 fi
88 fi
83 ln -f $PYTHON_SRCFILE $RPMBUILDDIR/SOURCES/$PYTHON_SRCFILE
89 ln -f $PYTHON_SRCFILE $RPMBUILDDIR/SOURCES/$PYTHON_SRCFILE
84
90
85 DOCUTILSVER=`sed -ne "s/^%global docutilsname docutils-//p" $specfile`
91 DOCUTILSVER=`sed -ne "s/^%global docutilsname docutils-//p" $specfile`
86 DOCUTILS_SRCFILE=docutils-$DOCUTILSVER.tar.gz
92 DOCUTILS_SRCFILE=docutils-$DOCUTILSVER.tar.gz
87 [ -f $DOCUTILS_SRCFILE ] || curl -Lo $DOCUTILS_SRCFILE http://downloads.sourceforge.net/project/docutils/docutils/$DOCUTILSVER/$DOCUTILS_SRCFILE
93 [ -f $DOCUTILS_SRCFILE ] || curl -Lo $DOCUTILS_SRCFILE http://downloads.sourceforge.net/project/docutils/docutils/$DOCUTILSVER/$DOCUTILS_SRCFILE
88 DOCUTILSMD5=`sed -ne "s/^%global docutilsmd5 //p" $specfile`
94 DOCUTILSMD5=`sed -ne "s/^%global docutilsmd5 //p" $specfile`
89 if [ "$DOCUTILSMD5" ]; then
95 if [ "$DOCUTILSMD5" ]; then
90 echo "$DOCUTILSMD5 $DOCUTILS_SRCFILE" | md5sum -w -c
96 echo "$DOCUTILSMD5 $DOCUTILS_SRCFILE" | md5sum -w -c
91 fi
97 fi
92 ln -f $DOCUTILS_SRCFILE $RPMBUILDDIR/SOURCES/$DOCUTILS_SRCFILE
98 ln -f $DOCUTILS_SRCFILE $RPMBUILDDIR/SOURCES/$DOCUTILS_SRCFILE
93 )
99 )
94 fi
100 fi
95
101
96 mkdir -p $RPMBUILDDIR/SPECS
102 mkdir -p $RPMBUILDDIR/SPECS
97 rpmspec=$RPMBUILDDIR/SPECS/mercurial.spec
103 rpmspec=$RPMBUILDDIR/SPECS/mercurial.spec
98
104
99 sed -e "s,^Version:.*,Version: $version," \
105 sed -e "s,^Version:.*,Version: $version," \
100 -e "s,^Release:.*,Release: $release," \
106 -e "s,^Release:.*,Release: $release," \
101 -e "s/^%global pythonexe .*/%global pythonexe $PYTHONEXE/" \
107 -e "s/^%global pythonexe .*/%global pythonexe $PYTHONEXE/" \
102 $specfile > $rpmspec
108 $specfile > $rpmspec
103
109
104 echo >> $rpmspec
110 echo >> $rpmspec
105 echo "%changelog" >> $rpmspec
111 echo "%changelog" >> $rpmspec
106
112
107 if echo $version | grep '+' > /dev/null 2>&1; then
113 if echo $version | grep '+' > /dev/null 2>&1; then
108 latesttag="`echo $version | sed -e 's/+.*//'`"
114 latesttag="`echo $version | sed -e 's/+.*//'`"
109 $HG log -r .:"$latesttag" -fM \
115 $HG log -r .:"$latesttag" -fM \
110 --template '{date|hgdate}\t{author}\t{desc|firstline}\n' | python -c '
116 --template '{date|hgdate}\t{author}\t{desc|firstline}\n' | python -c '
111 import sys, time
117 import sys, time
112
118
113 def datestr(date, format):
119 def datestr(date, format):
114 return time.strftime(format, time.gmtime(float(date[0]) - date[1]))
120 return time.strftime(format, time.gmtime(float(date[0]) - date[1]))
115
121
116 changelog = []
122 changelog = []
117 for l in sys.stdin.readlines():
123 for l in sys.stdin.readlines():
118 tok = l.split("\t")
124 tok = l.split("\t")
119 hgdate = tuple(int(v) for v in tok[0].split())
125 hgdate = tuple(int(v) for v in tok[0].split())
120 changelog.append((datestr(hgdate, "%F"), tok[1], hgdate, tok[2]))
126 changelog.append((datestr(hgdate, "%F"), tok[1], hgdate, tok[2]))
121 prevtitle = ""
127 prevtitle = ""
122 for l in sorted(changelog, reverse=True):
128 for l in sorted(changelog, reverse=True):
123 title = "* %s %s" % (datestr(l[2], "%a %b %d %Y"), l[1])
129 title = "* %s %s" % (datestr(l[2], "%a %b %d %Y"), l[1])
124 if prevtitle != title:
130 if prevtitle != title:
125 prevtitle = title
131 prevtitle = title
126 print
132 print
127 print(title)
133 print(title)
128 print("- %s" % l[3].strip())
134 print("- %s" % l[3].strip())
129 ' >> $rpmspec
135 ' >> $rpmspec
130
136
131 else
137 else
132
138
133 $HG log \
139 $HG log \
134 --template '{date|hgdate}\t{author}\t{desc|firstline}\n' \
140 --template '{date|hgdate}\t{author}\t{desc|firstline}\n' \
135 .hgtags | python -c '
141 .hgtags | python -c '
136 import sys, time
142 import sys, time
137
143
138 def datestr(date, format):
144 def datestr(date, format):
139 return time.strftime(format, time.gmtime(float(date[0]) - date[1]))
145 return time.strftime(format, time.gmtime(float(date[0]) - date[1]))
140
146
141 for l in sys.stdin.readlines():
147 for l in sys.stdin.readlines():
142 tok = l.split("\t")
148 tok = l.split("\t")
143 hgdate = tuple(int(v) for v in tok[0].split())
149 hgdate = tuple(int(v) for v in tok[0].split())
144 print("* %s %s\n- %s" % (datestr(hgdate, "%a %b %d %Y"), tok[1], tok[2]))
150 print("* %s %s\n- %s" % (datestr(hgdate, "%a %b %d %Y"), tok[1], tok[2]))
145 ' >> $rpmspec
151 ' >> $rpmspec
146
152
147 fi
153 fi
148
154
149 sed -i \
155 sed -i \
150 -e "s/^%define withpython.*$/%define withpython $RPMPYTHONVER/" \
156 -e "s/^%define withpython.*$/%define withpython $RPMPYTHONVER/" \
151 $rpmspec
157 $rpmspec
158 sed -i \
159 -e "s/^%global pythondocutils.*$/%global pythondocutils $DOCUTILSPACKAGE/" \
160 $rpmspec
152
161
153 if [ "$BUILD" ]; then
162 if [ "$BUILD" ]; then
154 rpmbuild --define "_topdir $RPMBUILDDIR" -ba $rpmspec --clean
163 rpmbuild --define "_topdir $RPMBUILDDIR" -ba $rpmspec --clean
155 if [ $? = 0 ]; then
164 if [ $? = 0 ]; then
156 echo
165 echo
157 echo "Built packages for $version-$release:"
166 echo "Built packages for $version-$release:"
158 find $RPMBUILDDIR/*RPMS/ -type f -newer $rpmspec
167 find $RPMBUILDDIR/*RPMS/ -type f -newer $rpmspec
159 fi
168 fi
160 else
169 else
161 echo "Prepared sources for $version-$release $rpmspec are in $RPMBUILDDIR/SOURCES/ - use like:"
170 echo "Prepared sources for $version-$release $rpmspec are in $RPMBUILDDIR/SOURCES/ - use like:"
162 echo "rpmbuild --define '_topdir $RPMBUILDDIR' -ba $rpmspec --clean"
171 echo "rpmbuild --define '_topdir $RPMBUILDDIR' -ba $rpmspec --clean"
163 fi
172 fi
@@ -1,16 +1,17 b''
1 FROM centos:centos7
1 FROM centos:centos7
2
2
3 RUN groupadd -g %GID% build && \
3 RUN groupadd -g %GID% build && \
4 useradd -u %UID% -g %GID% -s /bin/bash -d /build -m build
4 useradd -u %UID% -g %GID% -s /bin/bash -d /build -m build
5
5
6 RUN yum install -y epel-release
6 RUN yum install -y \
7 RUN yum install -y \
7 gcc \
8 gcc \
8 gettext \
9 gettext \
9 make \
10 make \
10 python-devel \
11 python3-devel \
11 python-docutils \
12 python36-docutils \
12 rpm-build \
13 rpm-build \
13 tar
14 tar
14
15
15 # For creating repo meta data
16 # For creating repo meta data
16 RUN yum install -y createrepo
17 RUN yum install -y createrepo
@@ -1,172 +1,173 b''
1 %global emacs_lispdir %{_datadir}/emacs/site-lisp
1 %global emacs_lispdir %{_datadir}/emacs/site-lisp
2
2
3 %define withpython %{nil}
3 %define withpython %{nil}
4
4
5 %global pythonexe python3
5 %global pythonexe python3
6 %global pythondocutils python3-docutils
6
7
7 %if "%{?withpython}"
8 %if "%{?withpython}"
8
9
9 %global pythonver %{withpython}
10 %global pythonver %{withpython}
10 %global pythonname Python-%{withpython}
11 %global pythonname Python-%{withpython}
11 %global docutilsname docutils-0.14
12 %global docutilsname docutils-0.14
12 %global docutilsmd5 c53768d63db3873b7d452833553469de
13 %global docutilsmd5 c53768d63db3873b7d452833553469de
13 %global pythonhg python-hg
14 %global pythonhg python-hg
14 %global hgpyprefix /opt/%{pythonhg}
15 %global hgpyprefix /opt/%{pythonhg}
15 # byte compilation will fail on some some Python /test/ files
16 # byte compilation will fail on some some Python /test/ files
16 %global _python_bytecompile_errors_terminate_build 0
17 %global _python_bytecompile_errors_terminate_build 0
17
18
18 %else
19 %else
19
20
20 %global pythonver %(%{pythonexe} -c 'import sys;print(".".join(map(str, sys.version_info[:2])))')
21 %global pythonver %(%{pythonexe} -c 'import sys;print(".".join(map(str, sys.version_info[:2])))')
21
22
22 %endif
23 %endif
23
24
24 Summary: A fast, lightweight Source Control Management system
25 Summary: A fast, lightweight Source Control Management system
25 Name: mercurial
26 Name: mercurial
26 Version: snapshot
27 Version: snapshot
27 Release: 0
28 Release: 0
28 License: GPLv2+
29 License: GPLv2+
29 Group: Development/Tools
30 Group: Development/Tools
30 URL: https://mercurial-scm.org/
31 URL: https://mercurial-scm.org/
31 Source0: %{name}-%{version}-%{release}.tar.gz
32 Source0: %{name}-%{version}-%{release}.tar.gz
32 %if "%{?withpython}"
33 %if "%{?withpython}"
33 Source1: %{pythonname}.tgz
34 Source1: %{pythonname}.tgz
34 Source2: %{docutilsname}.tar.gz
35 Source2: %{docutilsname}.tar.gz
35 %endif
36 %endif
36 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
37 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
37
38
38 BuildRequires: make, gcc, gettext
39 BuildRequires: make, gcc, gettext
39 %if "%{?withpython}"
40 %if "%{?withpython}"
40 BuildRequires: readline-devel, openssl-devel, ncurses-devel, zlib-devel, bzip2-devel
41 BuildRequires: readline-devel, openssl-devel, ncurses-devel, zlib-devel, bzip2-devel
41 %else
42 %else
42 BuildRequires: %{pythonexe} >= %{pythonver}, %{pythonexe}-devel, %{pythonexe}-docutils >= 0.5
43 BuildRequires: %{pythonexe} >= %{pythonver}, %{pythonexe}-devel, %{pythondocutils}
43 Requires: %{pythonexe} >= %{pythonver}
44 Requires: %{pythonexe} >= %{pythonver}
44 %endif
45 %endif
45 # The hgk extension uses the wish tcl interpreter, but we don't enforce it
46 # The hgk extension uses the wish tcl interpreter, but we don't enforce it
46 #Requires: tk
47 #Requires: tk
47
48
48 %description
49 %description
49 Mercurial is a fast, lightweight source control management system designed
50 Mercurial is a fast, lightweight source control management system designed
50 for efficient handling of very large distributed projects.
51 for efficient handling of very large distributed projects.
51
52
52 %prep
53 %prep
53
54
54 %if "%{?withpython}"
55 %if "%{?withpython}"
55 %setup -q -n mercurial-%{version}-%{release} -a1 -a2
56 %setup -q -n mercurial-%{version}-%{release} -a1 -a2
56 # despite the comments in cgi.py, we do this to prevent rpmdeps from picking /usr/local/bin/python up
57 # despite the comments in cgi.py, we do this to prevent rpmdeps from picking /usr/local/bin/python up
57 sed -i '1c#! /usr/bin/env %{pythonexe}' %{pythonname}/Lib/cgi.py
58 sed -i '1c#! /usr/bin/env %{pythonexe}' %{pythonname}/Lib/cgi.py
58 %else
59 %else
59 %setup -q -n mercurial-%{version}-%{release}
60 %setup -q -n mercurial-%{version}-%{release}
60 %endif
61 %endif
61
62
62 %build
63 %build
63
64
64 export HGPYTHON3=1
65 export HGPYTHON3=1
65
66
66 %if "%{?withpython}"
67 %if "%{?withpython}"
67
68
68 PYPATH=$PWD/%{pythonname}
69 PYPATH=$PWD/%{pythonname}
69 cd $PYPATH
70 cd $PYPATH
70 ./configure --prefix=%{hgpyprefix}
71 ./configure --prefix=%{hgpyprefix}
71 make all %{?_smp_mflags}
72 make all %{?_smp_mflags}
72 cd -
73 cd -
73
74
74 cd %{docutilsname}
75 cd %{docutilsname}
75 LD_LIBRARY_PATH=$PYPATH $PYPATH/python setup.py build
76 LD_LIBRARY_PATH=$PYPATH $PYPATH/python setup.py build
76 cd -
77 cd -
77
78
78 # verify Python environment
79 # verify Python environment
79 LD_LIBRARY_PATH=$PYPATH PYTHONPATH=$PWD/%{docutilsname} $PYPATH/python -c 'import sys, zlib, bz2, ssl, curses, readline'
80 LD_LIBRARY_PATH=$PYPATH PYTHONPATH=$PWD/%{docutilsname} $PYPATH/python -c 'import sys, zlib, bz2, ssl, curses, readline'
80
81
81 # set environment for make
82 # set environment for make
82 export PATH=$PYPATH:$PATH
83 export PATH=$PYPATH:$PATH
83 export LD_LIBRARY_PATH=$PYPATH
84 export LD_LIBRARY_PATH=$PYPATH
84 export CFLAGS="-L $PYPATH"
85 export CFLAGS="-L $PYPATH"
85 export PYTHONPATH=$PWD/%{docutilsname}
86 export PYTHONPATH=$PWD/%{docutilsname}
86
87
87 %endif
88 %endif
88
89
89 make all PYTHON=%{pythonexe}
90 make all PYTHON=%{pythonexe}
90 make -C contrib/chg
91 make -C contrib/chg
91
92
92 sed -i -e '1s|#!/usr/bin/env python$|#!/usr/bin/env %{pythonexe}|' contrib/hg-ssh
93 sed -i -e '1s|#!/usr/bin/env python$|#!/usr/bin/env %{pythonexe}|' contrib/hg-ssh
93
94
94 %install
95 %install
95 rm -rf $RPM_BUILD_ROOT
96 rm -rf $RPM_BUILD_ROOT
96
97
97 export HGPYTHON3=1
98 export HGPYTHON3=1
98
99
99 %if "%{?withpython}"
100 %if "%{?withpython}"
100
101
101 PYPATH=$PWD/%{pythonname}
102 PYPATH=$PWD/%{pythonname}
102 cd $PYPATH
103 cd $PYPATH
103 make install DESTDIR=$RPM_BUILD_ROOT
104 make install DESTDIR=$RPM_BUILD_ROOT
104 # these .a are not necessary and they are readonly and strip fails - kill them!
105 # these .a are not necessary and they are readonly and strip fails - kill them!
105 rm -f %{buildroot}%{hgpyprefix}/lib/{,python2.*/config}/libpython2.*.a
106 rm -f %{buildroot}%{hgpyprefix}/lib/{,python2.*/config}/libpython2.*.a
106 cd -
107 cd -
107
108
108 cd %{docutilsname}
109 cd %{docutilsname}
109 LD_LIBRARY_PATH=$PYPATH $PYPATH/python setup.py install --root="$RPM_BUILD_ROOT"
110 LD_LIBRARY_PATH=$PYPATH $PYPATH/python setup.py install --root="$RPM_BUILD_ROOT"
110 cd -
111 cd -
111
112
112 PATH=$PYPATH:$PATH LD_LIBRARY_PATH=$PYPATH make install PYTHON=%{pythonexe} DESTDIR=$RPM_BUILD_ROOT PREFIX=%{hgpyprefix} MANDIR=%{_mandir}
113 PATH=$PYPATH:$PATH LD_LIBRARY_PATH=$PYPATH make install PYTHON=%{pythonexe} DESTDIR=$RPM_BUILD_ROOT PREFIX=%{hgpyprefix} MANDIR=%{_mandir}
113 mkdir -p $RPM_BUILD_ROOT%{_bindir}
114 mkdir -p $RPM_BUILD_ROOT%{_bindir}
114 ( cd $RPM_BUILD_ROOT%{_bindir}/ && ln -s ../..%{hgpyprefix}/bin/hg . )
115 ( cd $RPM_BUILD_ROOT%{_bindir}/ && ln -s ../..%{hgpyprefix}/bin/hg . )
115 ( cd $RPM_BUILD_ROOT%{_bindir}/ && ln -s ../..%{hgpyprefix}/bin/python2.? %{pythonhg} )
116 ( cd $RPM_BUILD_ROOT%{_bindir}/ && ln -s ../..%{hgpyprefix}/bin/python2.? %{pythonhg} )
116
117
117 %else
118 %else
118
119
119 make install PYTHON=%{pythonexe} DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} MANDIR=%{_mandir}
120 make install PYTHON=%{pythonexe} DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} MANDIR=%{_mandir}
120
121
121 %endif
122 %endif
122
123
123 install -m 755 contrib/chg/chg $RPM_BUILD_ROOT%{_bindir}/
124 install -m 755 contrib/chg/chg $RPM_BUILD_ROOT%{_bindir}/
124 install -m 755 contrib/hgk $RPM_BUILD_ROOT%{_bindir}/
125 install -m 755 contrib/hgk $RPM_BUILD_ROOT%{_bindir}/
125 install -m 755 contrib/hg-ssh $RPM_BUILD_ROOT%{_bindir}/
126 install -m 755 contrib/hg-ssh $RPM_BUILD_ROOT%{_bindir}/
126
127
127 bash_completion_dir=$RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
128 bash_completion_dir=$RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
128 mkdir -p $bash_completion_dir
129 mkdir -p $bash_completion_dir
129 install -m 644 contrib/bash_completion $bash_completion_dir/mercurial.sh
130 install -m 644 contrib/bash_completion $bash_completion_dir/mercurial.sh
130
131
131 zsh_completion_dir=$RPM_BUILD_ROOT%{_datadir}/zsh/site-functions
132 zsh_completion_dir=$RPM_BUILD_ROOT%{_datadir}/zsh/site-functions
132 mkdir -p $zsh_completion_dir
133 mkdir -p $zsh_completion_dir
133 install -m 644 contrib/zsh_completion $zsh_completion_dir/_mercurial
134 install -m 644 contrib/zsh_completion $zsh_completion_dir/_mercurial
134
135
135 mkdir -p $RPM_BUILD_ROOT%{emacs_lispdir}
136 mkdir -p $RPM_BUILD_ROOT%{emacs_lispdir}
136 install -m 644 contrib/mercurial.el $RPM_BUILD_ROOT%{emacs_lispdir}/
137 install -m 644 contrib/mercurial.el $RPM_BUILD_ROOT%{emacs_lispdir}/
137 install -m 644 contrib/mq.el $RPM_BUILD_ROOT%{emacs_lispdir}/
138 install -m 644 contrib/mq.el $RPM_BUILD_ROOT%{emacs_lispdir}/
138
139
139 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/mercurial/hgrc.d
140 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/mercurial/hgrc.d
140
141
141 %clean
142 %clean
142 rm -rf $RPM_BUILD_ROOT
143 rm -rf $RPM_BUILD_ROOT
143
144
144 %files
145 %files
145 %defattr(-,root,root,-)
146 %defattr(-,root,root,-)
146 %doc CONTRIBUTORS COPYING doc/README doc/hg*.txt doc/hg*.html *.cgi contrib/*.fcgi contrib/*.wsgi
147 %doc CONTRIBUTORS COPYING doc/README doc/hg*.txt doc/hg*.html *.cgi contrib/*.fcgi contrib/*.wsgi
147 %doc %attr(644,root,root) %{_mandir}/man?/hg*
148 %doc %attr(644,root,root) %{_mandir}/man?/hg*
148 %doc %attr(644,root,root) contrib/*.svg
149 %doc %attr(644,root,root) contrib/*.svg
149 %dir %{_datadir}/zsh/
150 %dir %{_datadir}/zsh/
150 %dir %{_datadir}/zsh/site-functions/
151 %dir %{_datadir}/zsh/site-functions/
151 %{_datadir}/zsh/site-functions/_mercurial
152 %{_datadir}/zsh/site-functions/_mercurial
152 %dir %{_datadir}/emacs/site-lisp/
153 %dir %{_datadir}/emacs/site-lisp/
153 %{_datadir}/emacs/site-lisp/mercurial.el
154 %{_datadir}/emacs/site-lisp/mercurial.el
154 %{_datadir}/emacs/site-lisp/mq.el
155 %{_datadir}/emacs/site-lisp/mq.el
155 %{_bindir}/hg
156 %{_bindir}/hg
156 %{_bindir}/chg
157 %{_bindir}/chg
157 %{_bindir}/hgk
158 %{_bindir}/hgk
158 %{_bindir}/hg-ssh
159 %{_bindir}/hg-ssh
159 %dir %{_sysconfdir}/bash_completion.d/
160 %dir %{_sysconfdir}/bash_completion.d/
160 %config(noreplace) %{_sysconfdir}/bash_completion.d/mercurial.sh
161 %config(noreplace) %{_sysconfdir}/bash_completion.d/mercurial.sh
161 %dir %{_sysconfdir}/mercurial
162 %dir %{_sysconfdir}/mercurial
162 %dir %{_sysconfdir}/mercurial/hgrc.d
163 %dir %{_sysconfdir}/mercurial/hgrc.d
163 %if "%{?withpython}"
164 %if "%{?withpython}"
164 %{_bindir}/%{pythonhg}
165 %{_bindir}/%{pythonhg}
165 %{hgpyprefix}
166 %{hgpyprefix}
166 %else
167 %else
167 %{_libdir}/python%{pythonver}/site-packages/%{name}-*-py%{pythonver}.egg-info
168 %{_libdir}/python%{pythonver}/site-packages/%{name}-*-py%{pythonver}.egg-info
168 %{_libdir}/python%{pythonver}/site-packages/%{name}
169 %{_libdir}/python%{pythonver}/site-packages/%{name}
169 %{_libdir}/python%{pythonver}/site-packages/hgext
170 %{_libdir}/python%{pythonver}/site-packages/hgext
170 %{_libdir}/python%{pythonver}/site-packages/hgext3rd
171 %{_libdir}/python%{pythonver}/site-packages/hgext3rd
171 %{_libdir}/python%{pythonver}/site-packages/hgdemandimport
172 %{_libdir}/python%{pythonver}/site-packages/hgdemandimport
172 %endif
173 %endif
General Comments 0
You need to be logged in to leave comments. Login now