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