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