Skip to content

Commit 6f21c38

Browse files
committed
Merge remote-tracking branch 'origin/main' into replace-swift-lang-with-swiftlang
2 parents 942d7a7 + ff05603 commit 6f21c38

File tree

13 files changed

+159
-6
lines changed

13 files changed

+159
-6
lines changed

README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,104 @@ swift-installer-scripts
2525
└ ...
2626
~~~
2727

28+
## Linux Packages (RPM/Deb)
29+
30+
Currently Swift on Linux is distributed via tarball and Docker, and
31+
we would like to start supporting RPM and Debs officially on swift.org.
32+
The goal is to provide a seamless install process for Swift on Linux by
33+
utilizing the platform’s native package manager (RPM/Deb).
34+
35+
36+
* Step 1. Develop native packages / installers for the distributions
37+
* Step 2. Offer the native packages / installers through swift.org
38+
* Support all officially supported Linux platforms
39+
* Code signed by swift.org certificate
40+
* Repository hosted on swift.org
41+
* Step 3. Offer the native packages / installer through official repositories
42+
for the various platforms
43+
* Work with official repositories to accept package specs
44+
* Deprecate swift.org packages / installer repository
45+
* Step 4. Deprecate swift.org Linux tarballs
46+
47+
### Package Info
48+
* Package name: swiftlang
49+
* License: Apache 2.0
50+
* Maintainer: [email protected]
51+
* URL: https://swift.org
52+
* Description:
53+
```
54+
Swift is a general-purpose programming language built using
55+
a modern approach to safety, performance, and software design
56+
patterns.
57+
58+
The goal of the Swift project is to create the best available
59+
language for uses ranging from systems programming, to mobile
60+
and desktop apps, scaling up to cloud services. Most
61+
importantly, Swift is designed to make writing and maintaining
62+
correct programs easier for the developer.
63+
```
64+
65+
### RPM Naming Convention:
66+
67+
Package naming convention: `swiftlang-<VERSION>-<RELEASE>.<DIST>.<ARCH>.rpm`
68+
Pakcage structure: `/repo/<OS>/releases/<OS_VERSION>/<ARCH>/`
69+
Repository configuration: `/repo/<OS>/releases/<OS_VERSION>/swiftlang.repo`
70+
71+
72+
#### Example
73+
74+
* **Package structure:**
75+
```
76+
/repo/centos/releases/8/x86_64/swiftlang-5.5.0-1.el8.x86_64.rpm
77+
/repo/centos/releases/8/aarch64/swiftlang-5.5.0-1.el8.aarch64.rpm
78+
```
79+
80+
* **Package URL:**
81+
https://download.swift.org/repo/centos/releases/8/aarch64/swiftlang-5.5.0-1.el8.aarch64.rpm
82+
83+
* **Repository configuration file URL:**
84+
https://download.swift.org/repo/centos/releases/8/swiftlang.repo
85+
86+
## Tasks
87+
88+
### RPM Package Manager (RPM)*
89+
90+
- [ ] [SR-15325](https://bugs.swift.org/browse/SR-15325) Create RPM spec file
91+
- [ ] [SR-15326](https://bugs.swift.org/browse/SR-15326) Setup CI job to build the rpm package
92+
- [ ] [SR-15327](https://bugs.swift.org/browse/SR-15327) Code sign rpm package with swift.org certificate
93+
- [ ] [SR-15328](https://bugs.swift.org/browse/SR-15328) Host the rpm package on swift.org
94+
- [ ] [SR-15329](https://bugs.swift.org/browse/SR-15329) Host the rpm repository on swift.org
95+
- [ ] [SR-15330](https://bugs.swift.org/browse/SR-15330) Verify the rpm package and repository
96+
- [ ] [SR-15331](https://bugs.swift.org/browse/SR-15331) Update swift.org download / install page
97+
- [ ] [SR-15332](https://bugs.swift.org/browse/SR-15332) Work with official repositories to accept package specs
98+
99+
*For each platform, we will start with CentOS 8.
100+
101+
### Debian Package (Deb)*
102+
103+
- [ ] [SR-15334](https://bugs.swift.org/browse/SR-15334) Create Debs control file
104+
- [ ] [SR-15335](https://bugs.swift.org/browse/SR-15335) Setup CI to build the deb package
105+
- [ ] [SR-15336](https://bugs.swift.org/browse/SR-15336) Code sign package with swift.org certificate
106+
- [ ] [SR-15337](https://bugs.swift.org/browse/SR-15337) Host the deb package on swift.org
107+
- [ ] [SR-15338](https://bugs.swift.org/browse/SR-15338) Host the deb repository on swift.org
108+
- [ ] [SR-15339](https://bugs.swift.org/browse/SR-15339) Verify the deb package and repository
109+
- [ ] [SR-15340](https://bugs.swift.org/browse/SR-15340) Update swift.org download / install page
110+
- [ ] [SR-15341](https://bugs.swift.org/browse/SR-15341) Work with official repositories to accept package control files
111+
112+
*For each platform, we will start with Ubuntu 20.04
113+
114+
## Open Questions
115+
116+
* Where should swiftlang be installed on the system?
117+
* Option 1: Diverge the install location between platform to best fit the platform requirements.
118+
* symlink the toolchain into /usr/ to avoid conflicting with llvm.org binaries.
119+
* Option 2: Install in /usr and rename llvm-project binaries (example: swift-lldb/lldb-swift ...)
120+
* [GitHub discussion](https://github.com/apple/swift-installer-scripts/pull/37#discussion_r726707320)
121+
* Should we support multiple swiftlang versions on the system?
122+
* Multiple packages:
123+
* swiftlang
124+
* swiftlang-runtime
125+
28126
## Contributing
29127

30128
Before contributing, please read [CONTRIBUTING.md](CONTRIBUTING.md).

platforms/Linux/amazonlinux/2/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LABEL PURPOSE="This image is configured to build Swift for the version of Amazon
1212
RUN yum -y update
1313

1414
# RPM and yum development tools
15-
RUN yum install -y rpmdevtools yum-utils
15+
RUN yum install -y rpmdevtools yum-utils createrepo
1616

1717
# Configure epel
1818
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

platforms/Linux/amazonlinux/2/docker-compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ services:
3838
<<: *common
3939
command: /bin/bash -cl "./build_rpm.sh"
4040

41+
createrepo:
42+
<<: *common
43+
command: /bin/bash -cl "../shared/createrepo_rpm.sh"
44+
4145
shell:
4246
<<: *common
4347
entrypoint: /bin/bash -l

platforms/Linux/amazonlinux/2/swiftlang.spec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Source16: https://github.com/apple/swift-syntax/archive/swift-%{swift_vers
2929
Source17: https://github.com/jpsim/Yams/archive/%{yams_version}.zip#/yams.tar.gz
3030
Source18: https://github.com/apple/swift-crypto/archive/refs/tags/%{swift_crypto_version}.tar.gz#/swift-crypto.tar.gz
3131
Source19: https://github.com/ninja-build/ninja/archive/refs/tags/v%{ninja_version}.tar.gz#/ninja.tar.gz
32+
Source20: https://github.com/KitWare/CMake/archive/refs/tags/v%{cmake_version}.tar.gz#/cmake.tar.gz
3233

3334
Patch0: patches/swift-api-checker.patch
3435
Patch1: patches/hwasan_symbolize.patch
@@ -91,7 +92,7 @@ importantly, Swift is designed to make writing and maintaining
9192
correct programs easier for the developer.
9293

9394
%prep
94-
%setup -q -c -n %{swift_source_location} -a 0 -a 1 -a 2 -a 3 -a 4 -a 5 -a 6 -a 7 -a 8 -a 9 -a 10 -a 11 -a 12 -a 13 -a 14 -a 15 -a 16 -a 17 -a 18 -a 19
95+
%setup -q -c -n %{swift_source_location} -a 0 -a 1 -a 2 -a 3 -a 4 -a 5 -a 6 -a 7 -a 8 -a 9 -a 10 -a 11 -a 12 -a 13 -a 14 -a 15 -a 16 -a 17 -a 18 -a 19 -a 20
9596
# The Swift build script requires directories to be named
9697
# in a specific way so renaming the source directories is
9798
# necessary
@@ -113,6 +114,7 @@ mv swift-argument-parser-%{swift_argument_parser_version} swift-argument-parser
113114
mv swift-driver-swift-%{swift_version} swift-driver
114115
mv swift-crypto-%{swift_crypto_version} swift-crypto
115116
mv ninja-%{ninja_version} ninja
117+
mv CMake-%{cmake_version} cmake
116118

117119
# ICU
118120
mv icu-release-%{icu_version} icu

platforms/Linux/centos/7/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LABEL PURPOSE="This image is configured to build Swift for the version of CentOS
1212
RUN yum -y update
1313

1414
# RPM and yum development tools
15-
RUN yum install -y rpmdevtools yum-utils
15+
RUN yum install -y rpmdevtools yum-utils createrepo
1616

1717
# Configure epel
1818
RUN yum install -y epel-release centos-release-scl

platforms/Linux/centos/7/build_rpm.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pushd $HOME/rpmbuild/SPECS
3434
yum-builddep -y ./swiftlang.spec
3535
# Workaround to support clang-3.5 or a later version
3636
echo -e ". /opt/rh/sclo-git25/enable\n. /opt/rh/llvm-toolset-7/enable\n. /opt/rh/devtoolset-8/enable\n" >> $HOME/.bashrc
37+
source $HOME/.bashrc
3738
sed -i -e 's/\*__block/\*__libc_block/g' /usr/include/unistd.h
3839
# get the sources for Swift as defined in the spec file
3940
spectool -g -R ./swiftlang.spec

platforms/Linux/centos/7/docker-compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ services:
4141
<<: *common
4242
command: /bin/bash -cl "./build_rpm.sh"
4343

44+
createrepo:
45+
<<: *common
46+
command: /bin/bash -cl "../shared/createrepo_rpm.sh"
47+
4448
shell:
4549
<<: *common
4650
entrypoint: /bin/bash -l

platforms/Linux/centos/7/swiftlang.spec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Source16: https://github.com/apple/swift-syntax/archive/swift-%{swift_vers
2929
Source17: https://github.com/jpsim/Yams/archive/%{yams_version}.zip#/yams.tar.gz
3030
Source18: https://github.com/apple/swift-crypto/archive/refs/tags/%{swift_crypto_version}.tar.gz#/swift-crypto.tar.gz
3131
Source19: https://github.com/ninja-build/ninja/archive/refs/tags/v%{ninja_version}.tar.gz#/ninja.tar.gz
32+
Source20: https://github.com/KitWare/CMake/archive/refs/tags/v%{cmake_version}.tar.gz#/cmake.tar.gz
3233

3334
Patch0: patches/swift-api-checker.patch
3435
Patch1: patches/hwasan_symbolize.patch
@@ -92,7 +93,7 @@ importantly, Swift is designed to make writing and maintaining
9293
correct programs easier for the developer.
9394

9495
%prep
95-
%setup -q -c -n %{swift_source_location} -a 0 -a 1 -a 2 -a 3 -a 4 -a 5 -a 6 -a 7 -a 8 -a 9 -a 10 -a 11 -a 12 -a 13 -a 14 -a 15 -a 16 -a 17 -a 18 -a 19
96+
%setup -q -c -n %{swift_source_location} -a 0 -a 1 -a 2 -a 3 -a 4 -a 5 -a 6 -a 7 -a 8 -a 9 -a 10 -a 11 -a 12 -a 13 -a 14 -a 15 -a 16 -a 17 -a 18 -a 19 -a 20
9697
# The Swift build script requires directories to be named
9798
# in a specific way so renaming the source directories is
9899
# necessary
@@ -114,6 +115,7 @@ mv swift-argument-parser-%{swift_argument_parser_version} swift-argument-parser
114115
mv swift-driver-swift-%{swift_version} swift-driver
115116
mv swift-crypto-%{swift_crypto_version} swift-crypto
116117
mv ninja-%{ninja_version} ninja
118+
mv CMake-%{cmake_version} cmake
117119

118120
# ICU
119121
mv icu-release-%{icu_version} icu

platforms/Linux/centos/8/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LABEL PURPOSE="This image is configured to build Swift for the version of CentOS
1212
RUN yum -y update
1313

1414
# RPM and yum development tools
15-
RUN yum install -y rpmdevtools yum-utils
15+
RUN yum install -y rpmdevtools yum-utils createrepo
1616

1717
# Configure epel and powertools
1818
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

platforms/Linux/centos/8/docker-compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ services:
4141
<<: *common
4242
command: /bin/bash -cl "./build_rpm.sh"
4343

44+
createrepo:
45+
<<: *common
46+
command: /bin/bash -cl "../shared/createrepo_rpm.sh"
47+
4448
shell:
4549
<<: *common
4650
entrypoint: /bin/bash -l

platforms/Linux/centos/8/swiftlang.spec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Source16: https://github.com/apple/swift-syntax/archive/swift-%{swift_vers
2929
Source17: https://github.com/jpsim/Yams/archive/%{yams_version}.zip#/yams.tar.gz
3030
Source18: https://github.com/apple/swift-crypto/archive/refs/tags/%{swift_crypto_version}.tar.gz#/swift-crypto.tar.gz
3131
Source19: https://github.com/ninja-build/ninja/archive/refs/tags/v%{ninja_version}.tar.gz#/ninja.tar.gz
32+
Source20: https://github.com/KitWare/CMake/archive/refs/tags/v%{cmake_version}.tar.gz#/cmake.tar.gz
3233

3334
Patch0: patches/swift-api-checker.patch
3435
Patch1: patches/hwasan_symbolize.patch
@@ -91,7 +92,7 @@ importantly, Swift is designed to make writing and maintaining
9192
correct programs easier for the developer.
9293

9394
%prep
94-
%setup -q -c -n %{swift_source_location} -a 0 -a 1 -a 2 -a 3 -a 4 -a 5 -a 6 -a 7 -a 8 -a 9 -a 10 -a 11 -a 12 -a 13 -a 14 -a 15 -a 16 -a 17 -a 18 -a 19
95+
%setup -q -c -n %{swift_source_location} -a 0 -a 1 -a 2 -a 3 -a 4 -a 5 -a 6 -a 7 -a 8 -a 9 -a 10 -a 11 -a 12 -a 13 -a 14 -a 15 -a 16 -a 17 -a 18 -a 19 -a 20
9596
# The Swift build script requires directories to be named
9697
# in a specific way so renaming the source directories is
9798
# necessary
@@ -113,6 +114,7 @@ mv swift-argument-parser-%{swift_argument_parser_version} swift-argument-parser
113114
mv swift-driver-swift-%{swift_version} swift-driver
114115
mv swift-crypto-%{swift_crypto_version} swift-crypto
115116
mv ninja-%{ninja_version} ninja
117+
mv CMake-%{cmake_version} cmake
116118

117119
# ICU
118120
mv icu-release-%{icu_version} icu
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This source file is part of the Swift.org open source project
2+
#
3+
# Copyright (c) 2021 Apple Inc. and the Swift project authors
4+
# Licensed under Apache License v2.0 with Runtime Library Exception
5+
#
6+
# See http://swift.org/LICENSE.txt for license information
7+
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors
8+
9+
#!/usr/bin/env bash
10+
11+
set -eux
12+
13+
output_dir=/output
14+
if [[ ! -d "$output_dir" ]]; then
15+
echo "$output_dir does not exist, so no place to copy the artifacts!"
16+
exit 1
17+
fi
18+
19+
# always make sure we're up to date
20+
yum update -y
21+
22+
# prepare direcoties
23+
mkdir -p "$HOME/createrepo"
24+
25+
# Copy rpm file
26+
cp "$output_dir"/*.rpm "$HOME/createrepo/"
27+
28+
# Create the repodata
29+
createrepo "$HOME/createrepo/" 2>&1 | tee "$HOME/createrepo-output.txt"
30+
31+
32+
# Include the createrepo log which can be used to determine what went
33+
# wrong if there are no artifacts
34+
cp "$HOME/createrepo-output.txt" "$output_dir"
35+
cp -r "$HOME/createrepo/repodata" "$output_dir/repodata"

platforms/Linux/shared/RPM/metadata.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
%global swift_argument_parser_version 0.4.3
1515
%global swift_crypto_version 1.1.5
1616
%global ninja_version 1.10.2
17+
%global cmake_version 3.19.6
1718

1819
# locations
1920

0 commit comments

Comments
 (0)