github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/.copr/prepare.sh (about)

     1  #!/bin/sh -euf
     2  set -euxo pipefail
     3  OS_TEST=${OS_TEST:=0}
     4  
     5  if [ ! -e /usr/bin/git ]; then
     6      dnf -y install git-core
     7  fi
     8  
     9  if [ -f $(git rev-parse --git-dir)/shallow ]; then
    10      git fetch --unshallow
    11  fi
    12  
    13  COMMIT=$(git rev-parse HEAD)
    14  COMMIT_SHORT=$(git rev-parse --short=8 HEAD)
    15  COMMIT_NUM=$(git rev-list HEAD --count)
    16  COMMIT_DATE=$(date +%s)
    17  BR="#BuildRequires: golang-bin"
    18  NEWBR="BuildRequires: golang-bin"
    19  
    20  
    21  sed "s,#COMMIT#,${COMMIT},;
    22       s,#SHORTCOMMIT#,${COMMIT_SHORT},;
    23       s,#COMMITNUM#,${COMMIT_NUM},;
    24       s,#COMMITDATE#,${COMMIT_DATE}," \
    25           contrib/spec/podman.spec.in > contrib/spec/podman.spec
    26  
    27  if [ ${OS_TEST} -eq 0 ]; then
    28      sed -i "s/${BR}/${NEWBR}/g" contrib/spec/podman.spec
    29  fi
    30  
    31  mkdir -p build/
    32  git archive --prefix "libpod-${COMMIT_SHORT}/" --format "tar.gz" HEAD -o "build/libpod-${COMMIT_SHORT}.tar.gz"
    33  if [ ! -d conmon ]; then
    34      git clone -n --quiet https://github.com/containers/conmon
    35  fi
    36  pushd conmon
    37  git checkout --detach d532caebc788fafdd2a305b68cd1983b4039bea4
    38  git archive --prefix "conmon/" --format "tar.gz" HEAD -o "../build/conmon.tar.gz"
    39  popd