|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +# This helper script will fetch the Swift sources, save the |
| 4 | +# tarballs following the appropriate naming convention, and |
| 5 | +# build a Debian source package. |
| 6 | + |
| 7 | +# You will need the devscripts and quilt packages installed |
| 8 | +# to run this script and build the packages following these |
| 9 | +# instructions. |
| 10 | + |
| 11 | +# Create swiftlang-X.Y.Z, unpack the debian tarball within, |
| 12 | +# proceed to adding the appropriate entry to the Debian |
| 13 | +# changelog, edit debian/source-version.sh, then run this |
| 14 | +# script from the directory containing swiftlang-X.Y.Z. |
| 15 | +# $ mkdir swiftlang-X.Y.Z |
| 16 | +# $ cd swiftlang-X.Y.Z |
| 17 | +# $ tar xvaf ../swiftlang_A.B.C-D.debian.tar.xz |
| 18 | +# $ dch -v X.Y.Z-1 |
| 19 | +# $ cd .. |
| 20 | +# $ swiftlang-X.Y.Z/debian/getsource.sh |
| 21 | +# |
| 22 | +# This will download all the necessary sources, unpack them |
| 23 | +# as required, refresh any Debian patches, then create the |
| 24 | +# Debian source package. |
| 25 | + |
| 26 | +# If all is well, proceed with building the packages. |
| 27 | +# $ cd swiftlang-X.Y.Z |
| 28 | +# $ DEB_BUILD_OPTIONS=parallel=64 debuild |
| 29 | + |
| 30 | +set -eu |
| 31 | + |
| 32 | +. $(dirname $0)/source-versions.sh |
| 33 | + |
| 34 | +get_component () |
| 35 | +{ |
| 36 | + component=$1 |
| 37 | + url="$2" |
| 38 | + |
| 39 | + dest=swiftlang_${debversion}.orig-${component} |
| 40 | + |
| 41 | + echo "Downloading ${component} from ${url}" |
| 42 | + |
| 43 | + case "${url}" in |
| 44 | + *.zip) |
| 45 | + tmpdest=${component}.zip |
| 46 | + dest=${dest}.tar.gz |
| 47 | + |
| 48 | + curl -L -o ${tmpdest} "${url}" |
| 49 | + mk-origtargz --package swiftlang -v ${debversion} -c ${component} --rename --compression gzip ${tmpdest} |
| 50 | + ;; |
| 51 | + |
| 52 | + *.tar.gz) |
| 53 | + dest=${dest}.tar.gz |
| 54 | + curl -L -o ${dest} "${url}" |
| 55 | + ;; |
| 56 | + |
| 57 | + *.tar.xz) |
| 58 | + dest=${dest}.tar.xz |
| 59 | + curl -L -o ${dest} "${url}" |
| 60 | + ;; |
| 61 | + |
| 62 | + *.tar.bz2) |
| 63 | + dest=${dest}.tar.bz2 |
| 64 | + curl -L -o ${dest} "${url}" |
| 65 | + ;; |
| 66 | + |
| 67 | + *) |
| 68 | + echo "Source archive not in a suitable format for Debian sources: ${url}" >&2 |
| 69 | + exit 1 |
| 70 | + esac |
| 71 | + |
| 72 | + mkdir swiftlang-${debversion}/${component} |
| 73 | + tar -C swiftlang-${debversion}/${component} --strip-components=1 -axf ${dest} |
| 74 | +} |
| 75 | + |
| 76 | +get_component swift https://github.com/apple/swift/archive/swift-${swift_version}.tar.gz |
| 77 | +get_component swift-corelibs-libdispatch https://github.com/apple/swift-corelibs-libdispatch/archive/swift-${swift_version}.tar.gz |
| 78 | +get_component swift-corelibs-foundation https://github.com/apple/swift-corelibs-foundation/archive/swift-${swift_version}.tar.gz |
| 79 | +get_component swift-integration-tests https://github.com/apple/swift-integration-tests/archive/swift-${swift_version}.tar.gz |
| 80 | +get_component swift-corelibs-xctest https://github.com/apple/swift-corelibs-xctest/archive/swift-${swift_version}.tar.gz |
| 81 | +get_component swiftpm https://github.com/apple/swift-package-manager/archive/swift-${swift_version}.tar.gz |
| 82 | +get_component llbuild https://github.com/apple/swift-llbuild/archive/swift-${swift_version}.tar.gz |
| 83 | +get_component cmark https://github.com/apple/swift-cmark/archive/swift-${swift_version}.tar.gz |
| 84 | +get_component swift-xcode-playground-support https://github.com/apple/swift-xcode-playground-support/archive/swift-${swift_version}.tar.gz |
| 85 | +get_component sourcekit-lsp https://github.com/apple/sourcekit-lsp/archive/swift-${swift_version}.tar.gz |
| 86 | +get_component indexstore-db https://github.com/apple/indexstore-db/archive/swift-${swift_version}.tar.gz |
| 87 | +get_component llvm-project https://github.com/apple/llvm-project/archive/swift-${swift_version}.tar.gz |
| 88 | +get_component swift-tools-support-core https://github.com/apple/swift-tools-support-core/archive/swift-${swift_version}.tar.gz |
| 89 | +get_component swift-argument-parser https://github.com/apple/swift-argument-parser/archive/${swift_argument_parser_version}.tar.gz |
| 90 | +get_component swift-driver https://github.com/apple/swift-driver/archive/swift-${swift_version}.tar.gz |
| 91 | +get_component icu https://github.com/unicode-org/icu/archive/release-${icu_version}.tar.gz |
| 92 | +get_component swift-crypto https://github.com/apple/swift-crypto/archive/refs/tags/${swift_crypto_version}.tar.gz |
| 93 | +get_component ninja https://github.com/ninja-build/ninja/archive/refs/tags/v${ninja_version}.tar.gz |
| 94 | +get_component cmake https://github.com/KitWare/CMake/archive/refs/tags/v${cmake_version}.tar.gz |
| 95 | +get_component swift-syntax https://github.com/apple/swift-syntax/archive/swift-${swift_version}.tar.gz |
| 96 | +get_component yams https://github.com/jpsim/Yams/archive/${yams_version}.tar.gz |
| 97 | +get_component swift-atomics https://github.com/apple/swift-atomics/archive/${swift_atomics_version}.tar.gz |
| 98 | +get_component swift-cmark-gfm https://github.com/apple/swift-cmark/archive/swift-${swift_version}-gfm.tar.gz |
| 99 | +get_component swift-docc https://github.com/apple/swift-docc/archive/swift-${swift_version}.tar.gz |
| 100 | +get_component swift-docc-render-artifact https://github.com/apple/swift-docc-render-artifact/archive/swift-${swift_version}.tar.gz |
| 101 | +get_component swift-docc-symbolkit https://github.com/apple/swift-docc-symbolkit/archive/swift-${swift_version}.tar.gz |
| 102 | +get_component swift-collections https://github.com/apple/swift-collections/archive/${swift_collections_version}.tar.gz |
| 103 | +get_component swift-numerics https://github.com/apple/swift-numerics/archive/${swift_numerics_version}.tar.gz |
| 104 | +get_component swift-system https://github.com/apple/swift-system/archive/${swift_system_version}.tar.gz |
| 105 | +get_component swift-nio https://github.com/apple/swift-nio/archive/${swift_nio_version}.tar.gz |
| 106 | +get_component swift-nio-ssl https://github.com/apple/swift-nio-ssl/archive/${swift_nio_ssl_version}.tar.gz |
| 107 | +get_component swift-format https://github.com/apple/swift-format/archive/swift-${swift_version}.tar.gz |
| 108 | +get_component swift-lmdb https://github.com/apple/swift-lmdb/archive/swift-${swift_version}.tar.gz |
| 109 | +get_component swift-markdown https://github.com/apple/swift-markdown/archive/swift-${swift_version}.tar.gz |
| 110 | + |
| 111 | +# Refresh patches, if any |
| 112 | +if [ -s swiftlang-${debversion}/debian/patches/series ]; then |
| 113 | + cd swiftlang-${debversion} |
| 114 | + |
| 115 | + export QUILT_PATCHES=debian/patches |
| 116 | + export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index" |
| 117 | + |
| 118 | + while quilt push; do quilt refresh; done |
| 119 | + quilt pop -a |
| 120 | + |
| 121 | + cd - |
| 122 | +fi |
| 123 | + |
| 124 | +dpkg-source --create-empty-orig -b swiftlang-${debversion} |
0 commit comments