contrib/dockerdeb
author Durham Goode <durham@fb.com>
Wed, 12 Aug 2015 19:44:21 -0700
changeset 26024 84c00f03e06c
parent 24973 4c4d0012db4f
child 26108 05306b9359d3
permissions -rwxr-xr-x
dirstate: add --minimal flag to debugrebuilddirstate On repositories with hundreds of thousands of files, hg debugrebuilddirstate causes every dirstate entry to be marked lookup, and the next hg status can take many minutes. This adds a --minimal flag that allows us to only rebuild the parts of the dirstate that are inconsistent. This follows two rules: 1) If a file is in the dirstate but not in the parent manifest, and it is not marked 'add', it is busted and we should drop it. 2) If a file is not in the dirstate at all, but it is in the parent manifest, it should be added to the dirstate and we need to mark it as lookup. This allows us to fix repositories where the dirstate doesn't match the manifest much more quickly. Tested by artificially adding bad dirstate entries (via code) for both cases above.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24973
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
     1
#!/bin/bash -eu
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
     2
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
     3
. $(dirname $0)/dockerlib.sh
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
     4
. $(dirname $0)/packagelib.sh
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
     5
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
     6
BUILDDIR=$(dirname $0)
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
     7
export ROOTDIR=$(cd $BUILDDIR/..; pwd)
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
     8
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
     9
checkdocker
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    10
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    11
PLATFORM="debian-$1"
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    12
shift # extra params are passed to build process
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    13
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    14
initcontainer $PLATFORM
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    15
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    16
DEBBUILDDIR=$ROOTDIR/packages/$PLATFORM
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    17
contrib/builddeb --debbuilddir $DEBBUILDDIR/staged --prepare
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    18
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    19
DSHARED=/mnt/shared/
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    20
if [ $(uname) = "Darwin" ] ; then
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    21
    $DOCKER run -u $DBUILDUSER --rm -v $DEBBUILDDIR:$DSHARED -v $PWD:/mnt/hg $CONTAINER \
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    22
            sh -c "cd /mnt/hg && make clean && make local"
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    23
fi
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    24
$DOCKER run -u $DBUILDUSER --rm -v $DEBBUILDDIR:$DSHARED -v $PWD:/mnt/hg $CONTAINER \
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    25
  sh -c "cd /mnt/hg && make PREFIX=$DSHARED/staged/usr install"
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    26
$DOCKER run -u $DBUILDUSER --rm -v $DEBBUILDDIR:$DSHARED $CONTAINER \
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    27
  dpkg-deb --build $DSHARED/staged
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    28
if [ $(uname) = "Darwin" ] ; then
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    29
    $DOCKER run -u $DBUILDUSER --rm -v $DEBBUILDDIR:$DSHARED -v $PWD:/mnt/hg $CONTAINER \
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    30
            sh -c "cd /mnt/hg && make clean"
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    31
fi
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    32
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    33
gethgversion
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    34
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    35
rm -r $DEBBUILDDIR/staged
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    36
mv $DEBBUILDDIR/staged.deb $DEBBUILDDIR/mercurial-$version-$release.deb
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    37
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    38
echo
4c4d0012db4f dockerdeb: rules to build a debian package using docker
Augie Fackler <augie@google.com>
parents:
diff changeset
    39
echo "Build complete - results can be found in $DEBBUILDDIR"