File: makedist

package info (click to toggle)
luarocks 2.4.2+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 1,056 kB
  • ctags: 607
  • sloc: sh: 523; makefile: 181; ansic: 5
file content (102 lines) | stat: -rwxr-xr-x 2,227 bytes parent folder | download | duplicates (2)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/sh

if ! [ "$1" ]
then
   echo "usage: $0 <version>"
   exit 1
fi

if ! [ -d ".git" ]
then
   echo "Should be run inside a git repo dir."
   exit 1
fi

make clean || exit 1

grep -q "\"$1\"" rockspec || {
   echo
   echo "version in rockspec is incorrect. Please fix it."
   exit 1
}

grep -q "program_version = \"$1\"" src/luarocks/cfg.lua || {
   echo
   echo "program_version in src/luarocks/cfg.lua is incorrect. Please fix it."
   exit 1
}

grep -q "version: $1\\." appveyor.yml || {
   echo
   echo "version in appveyor.yml is incorrect. Please fix it."
   exit 1
}

grep -q "LUAROCKS_VER: $1" appveyor.yml || {
   echo
   echo "LUAROCKS_VER in appveyor.yml is incorrect. Please fix it."
   exit 1
}

# e.g. if $1 is "2.3.0", $program_series is "2.3"
program_series=${1%.*}

grep -q "program_series = \"$program_series\"" src/luarocks/cfg.lua || {
   echo
   echo "program_series in src/luarocks/cfg.lua is incorrect. Please fix it."
   exit 1
}

grep -q "vars.VERSION = \"$program_series\"" install.bat || {
   echo
   echo "vars.VERSION in install.bat is incorrect. Please fix it."
   exit 1
}

out="luarocks-$1"
rm -rf "$out"
mkdir "$out"
rm -f "missing_ref"
git ls-files | while read i
do
   if [ -f "$i" ]
   then
      dir=`dirname $i`
      mkdir -p "$out/$dir"
      cp "$i" "$out/$dir"
      if echo "$i" | grep -v "/bin/" | grep -q "^src/"
      then
         grep -qw `basename "$i"` Makefile.setup.inc || {
            echo "Missing ref in Makefile.setup.inc: $i"
            touch "missing_ref"
            exit 1
         }
      fi
   fi
done
if [ -e "missing_ref" ]
then
   rm -f "missing_ref"
   exit 1
fi

rm -rf "release-unix" "release-windows" "$out.tar.gz" "$out-win32.zip"

mkdir "release-unix"
cp -a "$out" "release-unix"
mkdir "release-windows"
mv "$out" "release-windows/$out-win32"

cd "release-unix/$out"
rm -rf makedist install.bat COPYING_lua COPYING_7z COPYING_win win32 lfw .travis.yml .gitignore appveyor* .appveyor
cd ..
tar czvpf ../"$out.tar.gz" "$out"
cd ..
rm -rf "release-unix"

cd "release-windows/$out-win32"
rm -rf makedist Makefile* configure lfw .travis.yml .gitignore test appveyor* .appveyor
cd ..
zip -r ../"$out-win32.zip" "$out-win32"
cd ..
rm -rf "release-windows"