commit d7586ba5cf3d844d6e4e0967257282419f35f519e03b969d502b781357f5dcf2 Author: Dominique Leuenberger Date: Mon Nov 23 14:37:38 2020 +0000 Accepting request 849527 from devel:tools:building Submit with corrections based on review OBS-URL: https://build.opensuse.org/request/show/849527 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/sccache?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_service b/_service new file mode 100644 index 0000000..22508b1 --- /dev/null +++ b/_service @@ -0,0 +1,24 @@ + + + https://github.com/mozilla/sccache.git + @PARENT_TAG@~git@TAG_OFFSET@.%h + git + 6628e1f70db3d583cb5e79210603ad878de3d315 + + * + v(\d+\.\d+\.\d+) + \1 + enable + wbrown@suse.de + + + + *.tar + xz + + + sccache + xz + + + diff --git a/builder.conf b/builder.conf new file mode 100644 index 0000000..fafc13c --- /dev/null +++ b/builder.conf @@ -0,0 +1,28 @@ +# This is where client toolchains will be stored. +# You should not need to change this as it is configured to work with systemd. +cache_dir = "/var/cache/sccache-builder/toolchains" +# The maximum size of the toolchain cache, in bytes. +# If unspecified the default is 10GB. +# toolchain_cache_size = 10737418240 +# A public IP address and port that clients will use to connect to this builder. +public_addr = "127.0.0.1:10501" +# public_addr = "[::1]:10501" + +# The URL used to connect to the scheduler (should use https, given an ideal +# setup of a HTTPS server in front of the scheduler) +scheduler_url = "https://127.0.0.1:10600" + +[builder] +type = "overlay" +# The directory under which a sandboxed filesystem will be created for builds. +# You should not need to change this as it is configured to work with systemd. +build_dir = "/var/cache/sccache-builder/tmp" +# The path to the bubblewrap version 0.3.0+ `bwrap` binary. +# You should not need to change this as it is configured for a default SUSE install. +bwrap_path = "/usr/bin/bwrap" + +[scheduler_auth] +type = "jwt_token" +# This will be generated by the `generate-jwt-hs256-server-token` command or +# provided by an administrator of the sccache cluster. See /etc/sccache/scheduler.conf +token = "token goes here" diff --git a/cargo_config b/cargo_config new file mode 100644 index 0000000..4780a64 --- /dev/null +++ b/cargo_config @@ -0,0 +1,10 @@ +[source.crates-io] +replace-with = "vendored-sources" + +[source."https://github.com/tiny-http/tiny-http.git"] +git = "https://github.com/tiny-http/tiny-http.git" +rev = "619680de" +replace-with = "vendored-sources" + +[source.vendored-sources] +directory = "vendor" diff --git a/client.example b/client.example new file mode 100644 index 0000000..f3918ea --- /dev/null +++ b/client.example @@ -0,0 +1,22 @@ +# This file should be copied to ~/.config/sccache/config for your client. +# You can debug client issues by starting the server with: +# SCCACHE_NO_DAEMON=1 RUST_LOG=info /home/william/.cargo/bin/sccache --dist-status + +[dist] +# The URL used to connect to the scheduler (should use https, given an ideal +# setup of a HTTPS server in front of the scheduler) +scheduler_url = "http://x.x.x.x:10600" +# scheduler_url = "http://[::abcd]:10600" +# Used for mapping local toolchains to remote cross-compile toolchains. Empty in +# this example where the client and build server are both Linux. +toolchains = [] +# Size of the local toolchain cache, in bytes (5GB here, 10GB if unspecified). +# toolchain_cache_size = 5368709120 + +# The location of the toolchain cache. +cache_dir = "/tmp/toolchains" + +[dist.auth] +# This should match the `client_auth` section of the scheduler config. +type = "token" +token = "token here" diff --git a/sccache-0.2.13~git474.6628e1f.tar.xz b/sccache-0.2.13~git474.6628e1f.tar.xz new file mode 100644 index 0000000..0e7641e --- /dev/null +++ b/sccache-0.2.13~git474.6628e1f.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d4ac878405b592f77bc975424bc1c2041453c64e8ec443b5395b3ae2a956e089 +size 205680 diff --git a/sccache-dist-builder.service b/sccache-dist-builder.service new file mode 100644 index 0000000..dc94ea1 --- /dev/null +++ b/sccache-dist-builder.service @@ -0,0 +1,17 @@ +[Unit] +Description=sccache-dist builder +After=chronyd.service ntpd.service network-online.target + +[Service] +User=0 +Type=simple +CacheDirectory=sccache-builder +Environment="RUST_LOG=sccache=info" +Environment="SCCACHE_NO_DAEMON=1" +ExecStart=sccache-dist server --config /etc/sccache/builder.conf + +[Install] +WantedBy=multi-user.target + + + diff --git a/sccache-dist-scheduler.service b/sccache-dist-scheduler.service new file mode 100644 index 0000000..e0ce8d1 --- /dev/null +++ b/sccache-dist-scheduler.service @@ -0,0 +1,16 @@ +[Unit] +Description=sccache-dist server +After=chronyd.service ntpd.service network-online.target + +[Service] +DynamicUser=yes +Type=simple +Environment="RUST_LOG=sccache=info" +Environment="SCCACHE_NO_DAEMON=1" +ExecStart=sccache-dist scheduler --config /etc/sccache/scheduler.conf + +[Install] +WantedBy=multi-user.target + + + diff --git a/sccache.changes b/sccache.changes new file mode 100644 index 0000000..4dd6235 --- /dev/null +++ b/sccache.changes @@ -0,0 +1,47 @@ +------------------------------------------------------------------- +Fri Nov 20 00:29:39 UTC 2020 - William Brown + +- Fix service file commit definition +- Correct spec file example install + +------------------------------------------------------------------- +Thu Nov 19 02:34:37 UTC 2020 - wbrown@suse.de + +- Update to version 0.2.13~git474.6628e1f: + * New entry in ServerStartup enum to indicate AddrInUse Error (#840) + * Revert "Bump to tiny-http 0.7.0 (#830)" because it caused a regression, #846. + * Include -fsanitizer-blacklist in common_args + * Consume sanitizer blacklist as extra hash in msvc (#842) + * In case we fail to read the compressed content from the cache, treat the failure as a forced + recache. This prevents us from failing build jobs unconditionally if cache entries are corrupt + (or in case of other sporadic failures), in which case we should continue on with + force-recompiling and recaching. (#836) + * Bump to tiny-http 0.7.0 (#830) + * Modify logging to use SCCACHE_LOG. (#822) + * Implement `g++` and `clang++` behavior when used on a `.c` input file. Fixes #803 (#818) + * clang: Allow chrome plugin arguments (#817) + * Add known caveats section to readme (#815) + +------------------------------------------------------------------- +Wed Nov 18 21:50:56 UTC 2020 - William Brown + +- Configure features to generate sccache-dist for distributed builds. +- Add systemd unit files for builder and scheduler and example configs. + +------------------------------------------------------------------- +Wed Nov 18 05:17:42 UTC 2020 - William Brown + +- Add --features=all to allow all cache backends to be used. + +------------------------------------------------------------------- +Tue Nov 17 04:56:20 UTC 2020 - William Brown + +- Add support for obs cargo vendor to make packaging easier. + * osc service ra - now can update the source files. +- Improvements to spec file. +- Fix invalid license string. + +------------------------------------------------------------------- +Fri May 22 13:44:53 UTC 2020 - Sumit Jamgade + +- Initial Package diff --git a/sccache.spec b/sccache.spec new file mode 100644 index 0000000..9f5038b --- /dev/null +++ b/sccache.spec @@ -0,0 +1,103 @@ +# +# spec file for package sccache +# +# Copyright (c) 2020 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + +%global rustflags -Clink-arg=-Wl,-z,relro,-z,now -C debuginfo=2 +%define configdir %{_sysconfdir}/%{name} + +Name: sccache +Version: 0.2.13~git474.6628e1f +Release: 0 +Summary: A compiler caching tool for Rust, C and C++ with optional cloud storage +License: Apache-2.0 +Group: Development/Languages/Rust +Url: https://github.com/mozilla/%{name} +Source0: %{name}-%{version}.tar.xz +Source1: vendor.tar.xz +Source2: cargo_config +Source10: sccache-dist-builder.service +Source11: sccache-dist-scheduler.service +Source12: builder.conf +Source13: scheduler.conf +Source14: client.example +BuildRequires: rust-packaging +BuildRequires: pkgconfig(openssl) +Requires: bubblewrap +ExcludeArch: s390 s390x ppc ppc64 ppc64le %ix86 + +%description +Sccache is a ccache-like tool. It is used as a compiler wrapper and +avoids compilation when possible, storing a cache in a remote storage +using the Amazon Simple Cloud Storage Service (S3) API, Redis or +the Google Cloud Storage (GCS) API. + +%prep +%setup -q +%setup -qa1 +mkdir .cargo +cp %{SOURCE2} .cargo/config +# Remove exec bits to prevent an issue in fedora shebang checking +find vendor -type f -name \*.rs -exec chmod -x '{}' \; + +%build +export RUSTFLAGS="%{rustflags}" +cargo build --offline --release --features=all,dist-server,dist-client + +%install +install -D -d -m 0755 %{buildroot}%{_bindir} +install -D -d -m 0755 %{buildroot}%{_unitdir} +install -D -d -m 0755 %{buildroot}%{configdir} + +install -m 0755 %{_builddir}/%{name}-%{version}/target/release/sccache %{buildroot}%{_bindir}/sccache +install -m 0755 %{_builddir}/%{name}-%{version}/target/release/sccache-dist %{buildroot}%{_bindir}/sccache-dist + +install -m 0644 %{SOURCE10} %{buildroot}%{_unitdir}/sccache-dist-builder.service +install -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}/sccache-dist-scheduler.service +install -m 0644 %{SOURCE12} %{buildroot}%{configdir}/builder.conf +install -m 0644 %{SOURCE13} %{buildroot}%{configdir}/scheduler.conf +install -m 0644 %{SOURCE14} %{buildroot}%{configdir}/client.example + +%pre +%service_add_pre sccache-dist-builder.service +%service_add_pre sccache-dist-scheduler.service + +%post +%service_add_post sccache-dist-builder.service +%service_add_post sccache-dist-scheduler.service + +%preun +%service_del_preun sccache-dist-builder.service +%service_del_preun sccache-dist-scheduler.service + +%postun +%service_del_postun sccache-dist-builder.service +%service_del_postun sccache-dist-scheduler.service + +%files +%license LICENSE +%doc README.md +%{_bindir}/sccache +%{_bindir}/sccache-dist + +%{_unitdir}/sccache-dist-builder.service +%{_unitdir}/sccache-dist-scheduler.service + +%dir %{configdir} +%config(noreplace) %{configdir}/scheduler.conf +%config(noreplace) %{configdir}/builder.conf +%config(noreplace) %{configdir}/client.example + +%changelog diff --git a/scheduler.conf b/scheduler.conf new file mode 100644 index 0000000..3c83a98 --- /dev/null +++ b/scheduler.conf @@ -0,0 +1,23 @@ +# The socket address the scheduler will listen on. It's strongly recommended +# to listen on localhost and put a HTTPS server in front of it. +public_addr = "127.0.0.1:10600" +# public_addr = "[::1]:10600" + +[client_auth] +# This is how a client will authenticate to the scheduler. +# # sccache-dist auth generate-shared-token --help +type = "token" +token = "token here" +# +# type = "jwt_hs256" +# secret_key = "" + +[server_auth] +# sccache-dist auth --help +# To generate the secret_key: +# # sccache-dist auth generate-jwt-hs256-key +# To generate a key for a builder, use the command: +# # sccache-dist auth generate-jwt-hs256-server-token --config /etc/sccache/scheduler.conf --secret-key "..." --server "builderip:builderport" +type = "jwt_hs256" +secret_key = "my secret key" + diff --git a/vendor.tar.xz b/vendor.tar.xz new file mode 100644 index 0000000..af857ee --- /dev/null +++ b/vendor.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79d1a8bbba2d85ed6c39fa5e8081750786d87c5dcd7f082872142998d7df1161 +size 19988356