contrib/dockerrpm
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Mon, 10 Apr 2017 16:49:10 +0200
changeset 31917 e4d1a7e07761
parent 27788 d713fa934fb9
child 33597 a3ac1ea611ce
permissions -rwxr-xr-x
obsolescence: add test case B-5 for obsolescence markers exchange About 3 years ago, in August 2014, the logic to select what markers to select on push was ported from the evolve extension to Mercurial core. However, for some unclear reasons, the tests for that logic were not ported alongside. I realised it a couple of weeks ago while working on another push related issue. I've made a clean up pass on the tests and they are now ready to integrate the core test suite. This series of changesets do not change any logic. I just adds test for logic that has been around for about 10 versions of Mercurial. They are a patch for each test case. It makes it easier to review and postpone one with documentation issues without rejecting the wholes series. This patch introduce B-5: Push of a children of changeset which successors is pruned Each test case comes it in own test file. It help parallelism and does not introduce a significant overhead from having a single unified giant test file. Here are timing to support this claim. # Multiple test files version: # run-tests.py --local -j 1 test-exchange-*.t 53.40s user 6.82s system 85% cpu 1:10.76 total 52.79s user 6.97s system 85% cpu 1:09.97 total 52.94s user 6.82s system 85% cpu 1:09.69 total # Single test file version: # run-tests.py --local -j 1 test-exchange-obsmarkers.t 52.97s user 6.85s system 85% cpu 1:10.10 total 52.64s user 6.79s system 85% cpu 1:09.63 total 53.70s user 7.00s system 85% cpu 1:11.17 total
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
24968
80c9e99d68e0 dockerlib: start extracting common functions for setting up docker
Augie Fackler <augie@google.com>
parents: 23124
diff changeset
     3
. $(dirname $0)/dockerlib.sh
80c9e99d68e0 dockerlib: start extracting common functions for setting up docker
Augie Fackler <augie@google.com>
parents: 23124
diff changeset
     4
21255
62a2749895e4 build: initial support for in-tree autobuilding recipes
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     5
BUILDDIR=$(dirname $0)
24969
227b9b2a57a3 dockerlib: extract initcontainer() method
Augie Fackler <augie@google.com>
parents: 24968
diff changeset
     6
export ROOTDIR=$(cd $BUILDDIR/..; pwd)
21255
62a2749895e4 build: initial support for in-tree autobuilding recipes
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     7
24968
80c9e99d68e0 dockerlib: start extracting common functions for setting up docker
Augie Fackler <augie@google.com>
parents: 23124
diff changeset
     8
checkdocker
22438
f5abb231b80a dockerrpm: check that docker is running correctly before building
Mads Kiilerich <madski@unity3d.com>
parents: 21642
diff changeset
     9
22439
d2a00ced3cce dockerrpm: better handling of specification of docker name
Mads Kiilerich <madski@unity3d.com>
parents: 22438
diff changeset
    10
PLATFORM="$1"
22443
d8818616c45e docker: add CentOS 5
Mads Kiilerich <madski@unity3d.com>
parents: 22441
diff changeset
    11
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
    12
24969
227b9b2a57a3 dockerlib: extract initcontainer() method
Augie Fackler <augie@google.com>
parents: 24968
diff changeset
    13
initcontainer $PLATFORM
22440
cf7b5c011737 dockerrpm: run docker build process as the current user, not as root
Mads Kiilerich <madski@unity3d.com>
parents: 22439
diff changeset
    14
22441
bb9a06d14857 dockerrpm: prepare source outside docker and just run rpmbuild inside docker
Mads Kiilerich <madski@unity3d.com>
parents: 22440
diff changeset
    15
RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM
22443
d8818616c45e docker: add CentOS 5
Mads Kiilerich <madski@unity3d.com>
parents: 22441
diff changeset
    16
contrib/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
    17
bb9a06d14857 dockerrpm: prepare source outside docker and just run rpmbuild inside docker
Mads Kiilerich <madski@unity3d.com>
parents: 22440
diff changeset
    18
DSHARED=/mnt/shared
bb9a06d14857 dockerrpm: prepare source outside docker and just run rpmbuild inside docker
Mads Kiilerich <madski@unity3d.com>
parents: 22440
diff changeset
    19
$DOCKER run -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \
bb9a06d14857 dockerrpm: prepare source outside docker and just run rpmbuild inside docker
Mads Kiilerich <madski@unity3d.com>
parents: 22440
diff changeset
    20
    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
    21
49ea49823769 dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
    22
$DOCKER run -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \
49ea49823769 dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
    23
    createrepo $DSHARED
49ea49823769 dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
    24
49ea49823769 dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
    25
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
    26
# 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
    27
[mercurial]
23124
4c490626af13 buildrpm: fix use of invalid $PLATFORM in mercurial.repo
Mads Kiilerich <madski@unity3d.com>
parents: 22444
diff changeset
    28
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
    29
# baseurl=file://$RPMBUILDDIR/
23124
4c490626af13 buildrpm: fix use of invalid $PLATFORM in mercurial.repo
Mads Kiilerich <madski@unity3d.com>
parents: 22444
diff changeset
    30
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
    31
skip_if_unavailable=True
49ea49823769 dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
    32
gpgcheck=0
49ea49823769 dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
    33
enabled=1
49ea49823769 dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
    34
EOF
49ea49823769 dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
    35
49ea49823769 dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
    36
echo
49ea49823769 dockerrpm: create a yum/dnf repo from the generated rpms
Mads Kiilerich <madski@unity3d.com>
parents: 22443
diff changeset
    37
echo "Build complete - results can be found in $RPMBUILDDIR"