summaryrefslogtreecommitdiffstats
path: root/makesrc.sh
blob: 2382aded61d122436dfd5f042cf340f67e6de5af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash

function archive() {
  SHORT=${COMMIT:0:7}

  if [ -f $NAME-$VERSION-$SHORT.tgz ]
  then
    echo Skip $NAME
  else
    echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION ($COMMIT)\n"
    echo "Cloning..."
    rm -rf $PROJECT-$COMMIT
    git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT

    echo "Getting commit..."
    pushd $PROJECT-$COMMIT
      if git checkout $COMMIT; then
        cp composer.json ../${1:-composer.json}
      else
        exit 1
      fi
    popd

    echo "Archiving..."
    tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT

    echo "Cleaning..."
    rm -rf $PROJECT-$COMMIT
  fi
}

NAME=$(basename $PWD)
SPEC=$NAME.spec
OWNER=$(sed   -n '/^%global gh_owner/{s/.* //;p}'   $SPEC)
PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $SPEC)
VERSION=$(sed -n '/^Version:/{s/.* //;p}'           $SPEC)
COMMIT=$(sed  -n '/^%global gh_commit/{s/.* //;p}'  $SPEC)
archive

for i in test apc apcu blackhole dba ext-mongodb filesystem memcache memcached memory mongodb redis session wincache xcache zend-server
do
  j=${i/-/_}
  NAME=php-laminas-cache-storage-adapter-$i
  COMMIT=$(sed  -n "/^%global gh_${j}_commit/{s/.* //;p}"  $SPEC)
  VERSION=$(sed  -n "/^%global gh_${j}_version/{s/.* //;p}"  $SPEC)
  PROJECT=laminas-cache-storage-adapter-$i
  archive composer-$i.json
done

echo "Done."