1
- #! /bin/sh
1
+ #! /bin/bash
2
2
3
3
# This helper script will fetch the Swift sources, save the
4
4
# tarballs following the appropriate naming convention, and
10
10
11
11
# Create swiftlang-X.Y.Z, unpack the debian tarball within,
12
12
# proceed to adding the appropriate entry to the Debian
13
- # changelog, edit debian /source-version.sh, then run this
13
+ # changelog, edit /source-version.sh, then run this
14
14
# script from the directory containing swiftlang-X.Y.Z.
15
15
# $ mkdir swiftlang-X.Y.Z
16
16
# $ cd swiftlang-X.Y.Z
27
27
# $ cd swiftlang-X.Y.Z
28
28
# $ DEB_BUILD_OPTIONS=parallel=64 debuild
29
29
30
- set -eu
30
+ set -eux
31
31
32
- . $( dirname $0 ) /source-versions.sh
32
+ here=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
33
+
34
+ # load version definitions
35
+ . ${here} /versions.sh
36
+
37
+ staging_dir=$1
38
+ package_dir=$staging_dir /swiftlang-${debversion}
33
39
34
40
get_component ()
35
41
{
36
42
component=$1
37
43
url=" $2 "
38
44
39
- dest=swiftlang_${debversion} .orig-${component}
40
-
45
+ dest=${staging_dir} /swiftlang_${debversion} .orig-${component}
41
46
echo " Downloading ${component} from ${url} "
42
47
43
48
case " ${url} " in
@@ -51,7 +56,10 @@ get_component ()
51
56
52
57
* .tar.gz)
53
58
dest=${dest} .tar.gz
54
- curl -L -o ${dest} " ${url} "
59
+ # temp
60
+ if [ ! -f ${dest} ]; then
61
+ curl -L -o ${dest} " ${url} "
62
+ fi
55
63
;;
56
64
57
65
* .tar.xz)
@@ -69,10 +77,12 @@ get_component ()
69
77
exit 1
70
78
esac
71
79
72
- mkdir swiftlang-${debversion} /${component}
73
- tar -C swiftlang-${debversion} /${component} --strip-components=1 -axf ${dest}
80
+ echo " Extracting ${component} "
81
+ mkdir ${package_dir} /${component}
82
+ tar -C ${package_dir} /${component} --strip-components=1 -axf ${dest}
74
83
}
75
84
85
+ # download
76
86
get_component swift https://github.com/apple/swift/archive/swift-${swift_version} .tar.gz
77
87
get_component swift-corelibs-libdispatch https://github.com/apple/swift-corelibs-libdispatch/archive/swift-${swift_version} .tar.gz
78
88
get_component swift-corelibs-foundation https://github.com/apple/swift-corelibs-foundation/archive/swift-${swift_version} .tar.gz
@@ -109,10 +119,10 @@ get_component swift-lmdb https://github.com/apple/swift-lmdb/archive/swift-${swi
109
119
get_component swift-markdown https://github.com/apple/swift-markdown/archive/swift-${swift_version} .tar.gz
110
120
111
121
# Refresh patches, if any
112
- if [ -s swiftlang- ${debversion } /debian/patches/series ]; then
113
- cd swiftlang- ${debversion }
122
+ if [ -s ${package_dir } /debian/patches/series ]; then
123
+ cd ${package_dir }
114
124
115
- export QUILT_PATCHES=debian/patches
125
+ export QUILT_PATCHES=debian/patches
116
126
export QUILT_REFRESH_ARGS=" -p ab --no-timestamps --no-index"
117
127
118
128
while quilt push; do quilt refresh; done
@@ -121,4 +131,6 @@ if [ -s swiftlang-${debversion}/debian/patches/series ]; then
121
131
cd -
122
132
fi
123
133
124
- dpkg-source --create-empty-orig -b swiftlang-${debversion}
134
+ # create a source package
135
+ cd $staging_dir
136
+ dpkg-source --create-empty-orig -b ${package_dir}
0 commit comments