Skip to content

Commit 59ccecf

Browse files
vlademVlad Volodkin
and
Vlad Volodkin
authored
Build and validate SLES package (#1278)
Build a separate package for SUSE Linux Enterprise Server (SLES), where `libfuse.so.2` is delivered by `libfuse2` rpm package (as compared to `fuse-libs` for AL2). ### Does this change impact existing behavior? No. ### Does this change need a changelog entry? Does it require a version change? May be? Added. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the [Developer Certificate of Origin (DCO)](https://developercertificate.org/). --------- Signed-off-by: Vlad Volodkin <[email protected]> Co-authored-by: Vlad Volodkin <[email protected]>
1 parent 48ca4df commit 59ccecf

File tree

6 files changed

+124
-22
lines changed

6 files changed

+124
-22
lines changed

doc/INSTALL.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Mountpoint for Amazon S3 is only available for Linux operating systems.
1010

1111
The instructions for downloading and installing Mountpoint for Amazon S3 depend on which Linux operating system you are using.
1212

13-
### RPM-based distributions (Amazon Linux, Fedora, CentOS, RHEL)
13+
### RPM-based distributions (Amazon Linux, Fedora, CentOS, RHEL; excluding SUSE)
1414

1515
To download and install Mountpoint for Amazon S3 on RPM-based distributions, including Amazon Linux, follow these steps:
1616

@@ -77,6 +77,37 @@ To download and install Mountpoint for Amazon S3 on DEB-based distributions, fol
7777
mount-s3 1.0.0
7878
```
7979
80+
### On SUSE Linux Enterprise Server (SLES)
81+
82+
To download and install Mountpoint for Amazon S3 on SLES, follow these steps:
83+
84+
1. Download the Mountpoint for Amazon S3 package using the appropriate command for your architecture:
85+
* x86_64:
86+
```
87+
wget https://s3.amazonaws.com/mountpoint-s3-release/latest/x86_64/mount-s3.suse.rpm
88+
```
89+
* ARM64 (Graviton):
90+
```
91+
wget https://s3.amazonaws.com/mountpoint-s3-release/latest/arm64/mount-s3.suse.rpm
92+
```
93+
2. Optionally, you can verify authenticity and integrity of the downloaded file. Identify the appropriate signature link depending on your architecture:
94+
* x86_64 architecture: `https://s3.amazonaws.com/mountpoint-s3-release/latest/x86_64/mount-s3.suse.rpm.asc`
95+
* ARM64 (Graviton) architecture: `https://s3.amazonaws.com/mountpoint-s3-release/latest/arm64/mount-s3.suse.rpm.asc`
96+
97+
Then see [Verifying the signature of the Mountpoint for Amazon S3 package](#optional-verifying-the-signature-of-the-mountpoint-for-amazon-s3-package) below.
98+
3. Install the package by entering the following command:
99+
```
100+
sudo zypper refresh && sudo zypper --no-gpg-checks install -y ./mount-s3.suse.rpm
101+
```
102+
4. Verify that Mountpoint for Amazon S3 is successfully installed by entering the following command:
103+
```
104+
mount-s3 --version
105+
```
106+
You should see output similar to the following:
107+
```
108+
mount-s3 1.0.0
109+
```
110+
80111
### Other Linux distributions
81112
82113
To download and install Mountpoint for Amazon S3 on other Linux distributions, follow these steps:

mountpoint-s3/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
### Other changes
99

1010
* Add support for appending to objects originally uploaded with a CRC64-NVME checksum. ([#1235](https://github.com/awslabs/mountpoint-s3/pull/1235))
11+
* Add a package for SUSE Linux Enterprise Server (SLES). ([#1278](https://github.com/awslabs/mountpoint-s3/pull/1278))
1112

1213
### Breaking changes
1314

package/mount-s3-suse.spec

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Name: mount-s3
2+
Version: %{MOUNTPOINT_VERSION}
3+
Release: 1
4+
Summary: Mountpoint for Amazon S3
5+
6+
License: Apache-2.0
7+
URL: https://github.com/awslabs/mountpoint-s3
8+
Source0: mount-s3.tar.gz
9+
10+
Requires: ca-certificates
11+
Requires: fuse
12+
Requires: libfuse2
13+
14+
%description
15+
Mountpoint for Amazon S3 is a simple, high-throughput file client for
16+
mounting an Amazon S3 bucket as a local file system. With Mountpoint for Amazon
17+
S3, your applications can access objects stored in Amazon S3 through file
18+
operations like open and read. Mountpoint for Amazon S3 automatically
19+
translates these operations into S3 object API calls, giving your applications
20+
access to the elastic storage and throughput of Amazon S3 through a file
21+
interface.
22+
23+
%prep
24+
%setup -c %{name}-%{version}
25+
26+
%install
27+
rm -rf %{buildroot}/*
28+
cp -r %{_builddir}/%{name}-%{version}/* %{buildroot}/
29+
mkdir -p %{buildroot}/%{_bindir}
30+
ln -f -s /opt/aws/mountpoint-s3/bin/mount-s3 %{buildroot}/%{_bindir}/mount-s3
31+
32+
%files
33+
%dir /opt/aws/mountpoint-s3
34+
%dir /opt/aws/mountpoint-s3/bin
35+
/opt/aws/mountpoint-s3/bin/mount-s3
36+
%doc /opt/aws/mountpoint-s3/NOTICE
37+
%license /opt/aws/mountpoint-s3/LICENSE
38+
/opt/aws/mountpoint-s3/THIRD_PARTY_LICENSES
39+
/opt/aws/mountpoint-s3/VERSION
40+
%{_bindir}/mount-s3

package/package.py

+17-6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ class BuildMetadata:
4242
def artifact_name(self, extension: str):
4343
return f"mount-s3-{self.version_string}-{self.arch_name}.{extension}"
4444

45+
def spec_file_name(self, distr: Optional[str]=None):
46+
if distr:
47+
return f"mount-s3-{distr}.spec"
48+
return "mount-s3.spec"
49+
4550

4651
OPT_PATH = "opt/aws/mountpoint-s3"
4752

@@ -200,15 +205,18 @@ def build_package_dir(metadata: BuildMetadata, binary_path: str, attribution_pat
200205
return package_dir
201206

202207

203-
def build_rpm(metadata: BuildMetadata, package_dir: str) -> str:
208+
def build_rpm(metadata: BuildMetadata, package_dir: str, distr: Optional[str]=None) -> str:
204209
"""Build an RPM package from the contents of the package directory. Return the path to the
205210
final RPM package."""
206211

207-
rpm_topdir = os.path.join(metadata.buildroot, "rpm-topdir")
208-
log(f"Building RPM in topdir {rpm_topdir}")
212+
rpm_buildroot = os.path.join(metadata.buildroot, "rpm-{}".format(distr or "default"))
213+
os.mkdir(rpm_buildroot)
214+
215+
rpm_topdir = os.path.join(rpm_buildroot, "rpm-topdir")
216+
log("Building RPM in topdir {} for {} Linux distribution".format(rpm_topdir, distr or "default"))
209217

210218
# Assemble the contents of the RPM, rooted at /
211-
rpm_package_dir = os.path.join(metadata.buildroot, "rpm-package")
219+
rpm_package_dir = os.path.join(rpm_buildroot, "rpm-package")
212220
rpm_opt_dir = os.path.join(rpm_package_dir, OPT_PATH)
213221
shutil.copytree(package_dir, rpm_opt_dir)
214222

@@ -219,7 +227,7 @@ def build_rpm(metadata: BuildMetadata, package_dir: str) -> str:
219227
run(["tar", "czvf", source_tar_path, "-C", rpm_package_dir, "opt"])
220228

221229
# Build the RPM
222-
spec_file = os.path.join(metadata.cargoroot, "package/mount-s3.spec")
230+
spec_file = os.path.join(metadata.cargoroot, f"package/{metadata.spec_file_name(distr)}")
223231
cmd = [
224232
"rpmbuild",
225233
"-bb",
@@ -236,7 +244,7 @@ def build_rpm(metadata: BuildMetadata, package_dir: str) -> str:
236244
rpms = os.listdir(arch_dir)
237245
assert len(rpms) == 1
238246
rpm_path = os.path.join(arch_dir, rpms[0])
239-
final_rpm_path = os.path.join(metadata.output_dir, metadata.artifact_name("rpm"))
247+
final_rpm_path = os.path.join(metadata.output_dir, metadata.artifact_name("{}.rpm".format(distr) if distr else "rpm"))
240248
shutil.copy2(rpm_path, final_rpm_path)
241249

242250
log(f"Built RPM: {final_rpm_path}")
@@ -316,6 +324,8 @@ def build(args: argparse.Namespace) -> str:
316324
artifacts = []
317325
if not args.no_rpm:
318326
artifacts.append(build_rpm(metadata, package_dir))
327+
if not args.no_suse_rpm:
328+
artifacts.append(build_rpm(metadata, package_dir, "suse"))
319329
if not args.no_deb:
320330
artifacts.append(build_deb(metadata, package_dir))
321331
artifacts.append(build_package_archive(metadata, package_dir))
@@ -331,6 +341,7 @@ def build(args: argparse.Namespace) -> str:
331341
p.add_argument("--root-dir", help="override the path to the Cargo workspace")
332342
p.add_argument("--expected-version", help="expected version number for the Mountpoint binary")
333343
p.add_argument("--no-rpm", action="store_true", help="do not build an RPM")
344+
p.add_argument("--no-suse-rpm", action="store_true", help="do not build an RPM for SUSE")
334345
p.add_argument("--no-deb", action="store_true", help="do not build a DEB")
335346
p.add_argument("--official", action="store_true", help="build as an official release")
336347

package/validate/validate-rpm-suse.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! /bin/sh
2+
set -e
3+
4+
cat /etc/os-release
5+
6+
zypper refresh && zypper install -y wget
7+
cd /tmp
8+
9+
wget https://s3.amazonaws.com/mountpoint-s3-release/$VERSION/$ARCH/mount-s3-$VERSION-$ARCH.suse.rpm
10+
wget https://s3.amazonaws.com/mountpoint-s3-release/$VERSION/$ARCH/mount-s3-$VERSION-$ARCH.suse.rpm.asc
11+
12+
wget https://s3.amazonaws.com/mountpoint-s3-release/public_keys/KEYS
13+
gpg --import KEYS
14+
gpg --verify mount-s3-$VERSION-$ARCH.suse.rpm.asc mount-s3-$VERSION-$ARCH.suse.rpm
15+
16+
zypper --no-gpg-checks install -y mount-s3-$VERSION-$ARCH.suse.rpm
17+
18+
. $(dirname "$0")/test-mount-s3.sh

package/validate/validate.py

+16-15
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ def validate(args: argparse.Namespace) -> str:
1515

1616
package=f"{args.artifact}-{args.os}"
1717
if package == "deb-ubuntu":
18-
image = "ubuntu/ubuntu:20.04"
18+
image = "public.ecr.aws/ubuntu/ubuntu:20.04"
1919
elif package == "rpm-al2" or package == "gzip-al2":
20-
image = "amazonlinux/amazonlinux:2"
20+
image = "public.ecr.aws/amazonlinux/amazonlinux:2"
21+
elif package == "rpm-suse":
22+
image = "registry.suse.com/bci/bci-base:15.6"
2123
else:
22-
raise Exception(f"unsupported OS {args.os} for {args.artifact}. Supported combinations are: deb-ubuntu, rpm-al2, gzip-al2")
24+
raise Exception(f"unsupported OS {args.os} for {args.artifact}. Supported combinations are: deb-ubuntu, rpm-al2, gzip-al2, rpm-suse")
2325

2426
print("Validating Mountpoint Release Package")
2527
print(f"\tVersion: {args.version}")
@@ -29,30 +31,29 @@ def validate(args: argparse.Namespace) -> str:
2931
print(f"\tBucket: {args.bucket}")
3032
print("\n")
3133

32-
full_image = f"public.ecr.aws/{image}"
3334
validate_script = f"validate-{package}.sh"
3435
scripts_dir = os.path.dirname(os.path.realpath(__file__))
3536

36-
subprocess.run(["docker", "pull", full_image])
37-
subprocess.run(["docker",
37+
subprocess.run(["docker", "pull", image])
38+
subprocess.run(["docker",
3839
"run",
39-
"--rm",
40-
"--cap-add=SYS_ADMIN",
41-
"--device=/dev/fuse",
42-
f"-v={scripts_dir}:/scripts",
43-
f"--env=ARCH={args.arch}",
44-
f"--env=VERSION={args.version}",
40+
"--rm",
41+
"--cap-add=SYS_ADMIN",
42+
"--device=/dev/fuse",
43+
f"-v={scripts_dir}:/scripts",
44+
f"--env=ARCH={args.arch}",
45+
f"--env=VERSION={args.version}",
4546
f"--env=BUCKET={args.bucket}",
46-
full_image,
47-
"/bin/bash",
47+
image,
48+
"/bin/bash",
4849
f"/scripts/{validate_script}"])
4950

5051
if __name__ == "__main__":
5152
p = argparse.ArgumentParser()
5253
p.add_argument("--version", help="the version number for the Mountpoint release", required=True)
5354
p.add_argument("--arch", help="the architecture to validate", required=True, choices=["x86_64", "arm64"])
5455
p.add_argument("--artifact", help="the artifact to validate", required=True, choices=["deb", "rpm", "gzip"])
55-
p.add_argument("--os", help="the OS to validate on", required=True, choices=["ubuntu", "al2"])
56+
p.add_argument("--os", help="the OS to validate on", required=True, choices=["ubuntu", "al2", "suse"])
5657
p.add_argument("--bucket", help="the public bucket to mount", required=True)
5758

5859
args = p.parse_args()

0 commit comments

Comments
 (0)