de7ddf
#!/bin/bash
de7ddf
# This script assures we always deliver the current documentation/configs
de7ddf
# for the c/storage, c/image and c/common vendored in podman, skopeo, buildah
de7ddf
# For questions reach to Jindrich Novy <jnovy@redhat.com>
de7ddf
rm -f /tmp/ver_image /tmp/ver_common /tmp/ver_storage
de7ddf
CENTOS=""
de7ddf
pwd | grep /tmp/centos > /dev/null
de7ddf
if [ $? == 0 ]; then
de7ddf
  CENTOS=1
de7ddf
fi
de7ddf
set -xe
de7ddf
echo $B
de7ddf
for P in podman skopeo buildah; do
de7ddf
  BRN=`pwd | sed 's,^.*/,,'`
de7ddf
  rm -rf $P
de7ddf
  pkg clone $P
de7ddf
  cd $P
de7ddf
  [ ! -z "$CENTOS" ] && pkg switch-branch $B
de7ddf
  if [ $BRN != stream-container-tools-rhel8 ]; then
de7ddf
    pkg prep
de7ddf
  else
de7ddf
    pkg --release rhel-8 prep
de7ddf
  fi
de7ddf
  DIR=`ls -d -- */ | grep -v ^tests | head -n1`
de7ddf
  grep github.com/containers/image $DIR/go.mod | grep -v - | cut -d\  -f2 >> /tmp/ver_image
de7ddf
  grep github.com/containers/common $DIR/go.mod | grep -v - | cut -d\  -f2 >> /tmp/ver_common
de7ddf
  grep github.com/containers/storage $DIR/go.mod | grep -v - | cut -d\  -f2 >> /tmp/ver_storage
de7ddf
  cd -
de7ddf
done
de7ddf
IMAGE_VER=`sort -n /tmp/ver_image | head -n1`
de7ddf
COMMON_VER=`sort -n /tmp/ver_common | head -n1`
de7ddf
STORAGE_VER=`sort -n /tmp/ver_storage | head -n1`
de7ddf
sed -i "s,^%global.*image_branch.*,%global image_branch $IMAGE_VER," containers-common.spec
de7ddf
sed -i "s,^%global.*common_branch.*,%global common_branch $COMMON_VER," containers-common.spec
de7ddf
sed -i "s,^%global.*storage_branch.*,%global storage_branch $STORAGE_VER," containers-common.spec
de7ddf
rm -f /tmp/ver_image /tmp/ver_common /tmp/ver_storage
de7ddf
rm -rf podman skopeo buildah