contrib/dockerrpm
author Sean Farley <sean.michael.farley@gmail.com>
Mon, 21 Apr 2014 20:23:47 -0500
changeset 21469 65cdc6bab91e
parent 21255 62a2749895e4
child 21561 f1bcc33a5c52
permissions -rwxr-xr-x
localrepo: move the order of local variables This movement is a small step in getting rid of the 'if ... else' logic for testing the current working directory with its parent. Previously, the deleted, unknown, and ignored variables were set in a combination of before an 'if ... else' block and within the block. This moves the variables to be set outside the loop in one common place.

#!/bin/bash

BUILDDIR=$(dirname $0)
ROOTDIR=$(cd $BUILDDIR/..; pwd)

if which docker >> /dev/null ; then
  DOCKER=docker
elif which docker.io >> /dev/null ; then
  DOCKER=docker.io
fi

$DOCKER build --tag "hg-dockerrpm-$1" - < $BUILDDIR/docker/$1
$DOCKER run --rm -v $ROOTDIR:/hg "hg-dockerrpm-$1" bash -c \
    "cp -a hg hg-build; cd hg-build; make clean local $1; cp build/$1/* /hg/build/$1/"