summaryrefslogtreecommitdiffstats
path: root/pearup
blob: 30a98b9b0f93c76c4d50af83e65adb5e6b5af1e9 (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
#!/bin/sh

vendor="Remi Collet <remi@remirepo.net>"
rpmdate=$(LC_ALL="C" date +"%a %b %d %Y")
rpmdate=${rpmdate/ 0/  }

if [ $# -lt 2 ]; then
    echo "usage $0 old new [ spec ]"
    exit 1
fi
if [ -n "$3" ]; then
  name=$3
else
  name=$(basename $PWD).spec
fi

if ! grep -q pecl_name $name; then
sed -e '/^Release:/s/[0-9].*$/1%{?dist}/' \
    -i *spec
else echo "Release inchangée"
fi
if ! grep -q "^Version:.*$2"  $name; then
sed -e "/^Version:/s/$1/$2/" \
    -e "/upstream_version/s/$1/$2/" \
    -e "s/%changelog/%changelog\n* $rpmdate $vendor - $2-1\n- Update to $2\n/" \
    -e 's/\$RPM_BUILD_ROOT/%{buildroot}/' \
    -i $name
else echo "Version déjà modifiée"
fi

spectool -g -S $name

tar xf *-$1.tgz package.xml && mv package.xml package-$1.xml
comp=$(tar xvf *-$1.tgz '*/composer.json')
if [ -n "$comp" ]; then
  mv $comp composer-$1.json
fi
tar xf *-$2.tgz package.xml && mv package.xml package-$2.xml
comp=$(tar xvf *-$2.tgz '*/composer.json')
if [ -n "$comp" ]; then
  mv $comp composer-$2.json
fi

colordiff -u  package-$1.xml   package-$2.xml
[ -f composer-$1.json -a -f composer-$2.json ] && \
  colordiff -u composer-$1.json composer-$2.json