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