Mercurial > hg
annotate contrib/packaging/dockerrpm @ 46326:3e23794b9e1c
run-tests: work around the Windows firewall popup for server processes
Windows doesn't have a `python3` executable, so cc0b332ab9fc attempted to work
around the issue by copying the current python to `python3.exe`. That put it in
`_tmpbindir` because of failures in `test-run-tests.t` when using `_bindir`,
which looked like a process was trying to open it to write out a copy while it
was in use. (Interestingly, I couldn't reproduce this running the test by
itself in a loop for a couple of hours, but it happens constantly when running
all tests.) The problem with using `_tmpbindir` is that it is the randomly
generated path for the test run, and instead of Windows Firewall remembering the
executable signature or image hash when allowing the process to open a server
port, it apparently remembers the image path. That means every run will trigger
a popup to allow it, which is bad for firing off a test run and walking away.
I tried to symlink to the python executable, but that currently requires admin
priviledges[1]. This will prompt the first time if the underlying python binary
has never opened a server port, but appears to avoid it on subsequent runs.
[1] https://bugs.python.org/issue40687
Differential Revision: https://phab.mercurial-scm.org/D9815
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 18 Jan 2021 00:50:01 -0500 |
parents | e66a3bfcb19b |
children | 4713bcf78037 |
rev | line source |
---|---|
22438
f5abb231b80a
dockerrpm: check that docker is running correctly before building
Mads Kiilerich <madski@unity3d.com>
parents:
21642
diff
changeset
|
1 #!/bin/bash -e |
21255
62a2749895e4
build: initial support for in-tree autobuilding recipes
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
2 |
62a2749895e4
build: initial support for in-tree autobuilding recipes
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
3 BUILDDIR=$(dirname $0) |
38004
1868db0d1515
packaging: move some docker scripts into contrib/packaging/
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33597
diff
changeset
|
4 export ROOTDIR=$(cd $BUILDDIR/../..; pwd) |
21255
62a2749895e4
build: initial support for in-tree autobuilding recipes
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
5 |
22439
d2a00ced3cce
dockerrpm: better handling of specification of docker name
Mads Kiilerich <madski@unity3d.com>
parents:
22438
diff
changeset
|
6 PLATFORM="$1" |
22443 | 7 shift # extra params are passed to buildrpm |
22439
d2a00ced3cce
dockerrpm: better handling of specification of docker name
Mads Kiilerich <madski@unity3d.com>
parents:
22438
diff
changeset
|
8 |
43359
e66a3bfcb19b
packaging: make dockerrpm fedora target more generic
Mads Kiilerich <mads@kiilerich.com>
parents:
43355
diff
changeset
|
9 DOCKERFILE="$PLATFORM" |
e66a3bfcb19b
packaging: make dockerrpm fedora target more generic
Mads Kiilerich <mads@kiilerich.com>
parents:
43355
diff
changeset
|
10 OS_RELEASE="${PLATFORM//[a-z]/}" |
e66a3bfcb19b
packaging: make dockerrpm fedora target more generic
Mads Kiilerich <mads@kiilerich.com>
parents:
43355
diff
changeset
|
11 case "$PLATFORM" in |
e66a3bfcb19b
packaging: make dockerrpm fedora target more generic
Mads Kiilerich <mads@kiilerich.com>
parents:
43355
diff
changeset
|
12 fedora*) |
e66a3bfcb19b
packaging: make dockerrpm fedora target more generic
Mads Kiilerich <mads@kiilerich.com>
parents:
43355
diff
changeset
|
13 DOCKERFILE="${PLATFORM//[0-9]/}.template" |
e66a3bfcb19b
packaging: make dockerrpm fedora target more generic
Mads Kiilerich <mads@kiilerich.com>
parents:
43355
diff
changeset
|
14 ;; |
e66a3bfcb19b
packaging: make dockerrpm fedora target more generic
Mads Kiilerich <mads@kiilerich.com>
parents:
43355
diff
changeset
|
15 esac |
e66a3bfcb19b
packaging: make dockerrpm fedora target more generic
Mads Kiilerich <mads@kiilerich.com>
parents:
43355
diff
changeset
|
16 |
38458
e5916f1236f3
packaging: replace dockerlib.sh with a Python script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38457
diff
changeset
|
17 DOCKER=$($BUILDDIR/hg-docker docker-path) |
e5916f1236f3
packaging: replace dockerlib.sh with a Python script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38457
diff
changeset
|
18 |
e5916f1236f3
packaging: replace dockerlib.sh with a Python script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38457
diff
changeset
|
19 CONTAINER=hg-docker-$PLATFORM |
e5916f1236f3
packaging: replace dockerlib.sh with a Python script
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38457
diff
changeset
|
20 |
41234
4c0d4bbdc395
packaging: allow running packaging with custom uid+gid for CentOS
Mathias De Mare <mathias.de_mare@nokia.com>
parents:
38458
diff
changeset
|
21 if [[ -z "${HG_DOCKER_OWN_USER}" ]]; then |
4c0d4bbdc395
packaging: allow running packaging with custom uid+gid for CentOS
Mathias De Mare <mathias.de_mare@nokia.com>
parents:
38458
diff
changeset
|
22 DOCKERUID=1000 |
4c0d4bbdc395
packaging: allow running packaging with custom uid+gid for CentOS
Mathias De Mare <mathias.de_mare@nokia.com>
parents:
38458
diff
changeset
|
23 DOCKERGID=1000 |
4c0d4bbdc395
packaging: allow running packaging with custom uid+gid for CentOS
Mathias De Mare <mathias.de_mare@nokia.com>
parents:
38458
diff
changeset
|
24 else |
4c0d4bbdc395
packaging: allow running packaging with custom uid+gid for CentOS
Mathias De Mare <mathias.de_mare@nokia.com>
parents:
38458
diff
changeset
|
25 DOCKERUID=$(id -u) |
4c0d4bbdc395
packaging: allow running packaging with custom uid+gid for CentOS
Mathias De Mare <mathias.de_mare@nokia.com>
parents:
38458
diff
changeset
|
26 DOCKERGID=$(id -g) |
4c0d4bbdc395
packaging: allow running packaging with custom uid+gid for CentOS
Mathias De Mare <mathias.de_mare@nokia.com>
parents:
38458
diff
changeset
|
27 fi |
4c0d4bbdc395
packaging: allow running packaging with custom uid+gid for CentOS
Mathias De Mare <mathias.de_mare@nokia.com>
parents:
38458
diff
changeset
|
28 |
43359
e66a3bfcb19b
packaging: make dockerrpm fedora target more generic
Mads Kiilerich <mads@kiilerich.com>
parents:
43355
diff
changeset
|
29 $BUILDDIR/hg-docker build \ |
e66a3bfcb19b
packaging: make dockerrpm fedora target more generic
Mads Kiilerich <mads@kiilerich.com>
parents:
43355
diff
changeset
|
30 --build-arg UID=$DOCKERUID \ |
e66a3bfcb19b
packaging: make dockerrpm fedora target more generic
Mads Kiilerich <mads@kiilerich.com>
parents:
43355
diff
changeset
|
31 --build-arg GID=$DOCKERGID \ |
e66a3bfcb19b
packaging: make dockerrpm fedora target more generic
Mads Kiilerich <mads@kiilerich.com>
parents:
43355
diff
changeset
|
32 --build-arg OS_RELEASE=${OS_RELEASE:-latest} \ |
e66a3bfcb19b
packaging: make dockerrpm fedora target more generic
Mads Kiilerich <mads@kiilerich.com>
parents:
43355
diff
changeset
|
33 $BUILDDIR/docker/$DOCKERFILE $CONTAINER |
22440
cf7b5c011737
dockerrpm: run docker build process as the current user, not as root
Mads Kiilerich <madski@unity3d.com>
parents:
22439
diff
changeset
|
34 |
22441
bb9a06d14857
dockerrpm: prepare source outside docker and just run rpmbuild inside docker
Mads Kiilerich <madski@unity3d.com>
parents:
22440
diff
changeset
|
35 RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM |
43355
433cdcb37321
packaging: move dockerrpm output directory creation to dockerrpm
Mads Kiilerich <mads@kiilerich.com>
parents:
41234
diff
changeset
|
36 mkdir -p $RPMBUILDDIR |
38013
917f635b5c6a
packaging: make packaging scripts less reliant on pwd
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38008
diff
changeset
|
37 $ROOTDIR/contrib/packaging/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $* |
22441
bb9a06d14857
dockerrpm: prepare source outside docker and just run rpmbuild inside docker
Mads Kiilerich <madski@unity3d.com>
parents:
22440
diff
changeset
|
38 |
bb9a06d14857
dockerrpm: prepare source outside docker and just run rpmbuild inside docker
Mads Kiilerich <madski@unity3d.com>
parents:
22440
diff
changeset
|
39 DSHARED=/mnt/shared |
38457
11eda1f1b6e7
packaging: consistently create build user in Dockerfiles
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38013
diff
changeset
|
40 DBUILDUSER=build |
11eda1f1b6e7
packaging: consistently create build user in Dockerfiles
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38013
diff
changeset
|
41 |
33597
a3ac1ea611ce
docker: pass proxy arguments to docker process
Mathias De Maré <mathias.de_mare@nokia.com>
parents:
27788
diff
changeset
|
42 $DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ |
22441
bb9a06d14857
dockerrpm: prepare source outside docker and just run rpmbuild inside docker
Mads Kiilerich <madski@unity3d.com>
parents:
22440
diff
changeset
|
43 rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec --clean |
22444
49ea49823769
dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents:
22443
diff
changeset
|
44 |
33597
a3ac1ea611ce
docker: pass proxy arguments to docker process
Mathias De Maré <mathias.de_mare@nokia.com>
parents:
27788
diff
changeset
|
45 $DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ |
22444
49ea49823769
dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents:
22443
diff
changeset
|
46 createrepo $DSHARED |
49ea49823769
dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents:
22443
diff
changeset
|
47 |
49ea49823769
dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents:
22443
diff
changeset
|
48 cat << EOF > $RPMBUILDDIR/mercurial.repo |
49ea49823769
dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents:
22443
diff
changeset
|
49 # Place this file in /etc/yum.repos.d/mercurial.repo |
49ea49823769
dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents:
22443
diff
changeset
|
50 [mercurial] |
23124
4c490626af13
buildrpm: fix use of invalid $PLATFORM in mercurial.repo
Mads Kiilerich <madski@unity3d.com>
parents:
22444
diff
changeset
|
51 name=Mercurial packages for $PLATFORM |
22444
49ea49823769
dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents:
22443
diff
changeset
|
52 # baseurl=file://$RPMBUILDDIR/ |
23124
4c490626af13
buildrpm: fix use of invalid $PLATFORM in mercurial.repo
Mads Kiilerich <madski@unity3d.com>
parents:
22444
diff
changeset
|
53 baseurl=http://hg.example.com/build/$PLATFORM/ |
22444
49ea49823769
dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents:
22443
diff
changeset
|
54 skip_if_unavailable=True |
49ea49823769
dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents:
22443
diff
changeset
|
55 gpgcheck=0 |
49ea49823769
dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents:
22443
diff
changeset
|
56 enabled=1 |
49ea49823769
dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents:
22443
diff
changeset
|
57 EOF |
49ea49823769
dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents:
22443
diff
changeset
|
58 |
49ea49823769
dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents:
22443
diff
changeset
|
59 echo |
49ea49823769
dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents:
22443
diff
changeset
|
60 echo "Build complete - results can be found in $RPMBUILDDIR" |