Skip to content

Instantly share code, notes, and snippets.

@kiilerix
Last active March 3, 2023 21:47
Show Gist options
  • Save kiilerix/b32cb9688d2d6e9e752e91e2ca4c30e6 to your computer and use it in GitHub Desktop.
Save kiilerix/b32cb9688d2d6e9e752e91e2ca4c30e6 to your computer and use it in GitHub Desktop.
Fedora RPM spec
Name: sapling
Version: 1
Release: %autorelease
Summary: Scalable, User-Friendly Source Control System
License: GPLv2+
URL: https://sapling-scm.com/
# (ls -ld eden/scm/edenscm && git archive HEAD --prefix sapling/ -o ~/fedora-devel/sapling/sapling.tar.bz2 )
Source0: sapling.tar.bz2
BuildRequires: python3-Cython
BuildRequires: python3-devel
%description
Sapling SCM is a cross-platform, highly scalable, Git-compatible source control
system.
It aims to provide both user-friendly and powerful interfaces for users, as
well as extreme scalability to deal with repositories containing many millions
of files and many millions of commits.
%prep
%autosetup -n sapling/eden/scm
# hide some workspace problems - https://github.com/facebook/sapling/issues/546 :
for d in lib/third-party/rust/fbthrift lib/third-party/rust/fbthrift_socket; do ls -ld $d ; rm -rf $d; done
# blind bumping of dependency versions
sed -i \
-e '/^winapi = /d' \
-e 's/^criterion = "=0.3.1"/criterion = "0.3.1"/g' \
-e 's/^toml = "=0.5.8"/toml = "0.5.8"/g' \
-e 's/^blake2 = "0.9"/blake2 = "0.10"/g' \
-e 's/^fail = "0.4"/fail = "0.5"/g' \
-e '/^fail = /s/ version = "0.4"/ version = "0.5"/g' \
-e 's/^pipe = "0.2"/pipe = "0.4"/g' \
-e 's/^simple_asn1 = "0.4"/simple_asn1 = "0.5"/g' \
-e 's/^crossbeam = "0.7"/crossbeam = "0.8"/g' \
-e 's/^dirs = "2.0"/dirs = "4.0"/g' \
-e '/^dirs = /s/version = "2.0"/version = "4.0"/g' \
-e 's/env_logger = "0.7"/env_logger = "0.9"/g' \
-e 's/uuid = { version = "0.8.1"/uuid = { version = "1.2"/g' \
-e 's/local-encoding = "\*"/local-encoding = "0.2"/g' \
-e 's/^rust-ini = { version = "0.17"/rust-ini = { version = "0.18"/g' \
-e 's/^parking_lot = "0.11.2"/parking_lot = "0.12"/g' \
-e 's/^parking_lot = { version = "0.11.2"/parking_lot = { version = "0.12"/g' \
-e 's/^plist = "0.5"/plist = "1.3"/g' \
$(find -name Cargo.toml)
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires
%build
# use relevant parts from eden/scm/Makefile
SAPLING_OSS_BUILD=true SAPLING_OFFLINE=true HGNAME=sl PYTHON3=python3.11 \
%{python3} setup.py \
build_py -c -d . \
build_clib ${COMPILERFLAG} \
build_ext ${COMPILERFLAG} -i \
build_mo
%cargo_build
%install
SAPLING_OSS_BUILD=true SAPLING_OFFLINE=true HGNAME=sl PYTHON3=python3.11 \
%{python3} setup.py \
install -O1 --root %{buildroot} --prefix %{_prefix} --install-scripts=%{_bindir}
%files
%license add-license-file-here
%doc add-docs-here
%changelog
%autochangelog
# Some blockers:
#
# Some direct git repo dependencies must be handled upstream:
# https://github.com/facebookexperimental/rust-shed.git :
# cloned
# fbinit
# fbthrift_socket
# hostcaps
# hostname
# quickcheck_arbitrary_derive
# tokio-uds-compat
# deltae = { git = "https://github.com/markbt/deltae", rev = "1c6e9c7c9184751bd17795d78896d522e77a2ce4" }
# fb303_core = { version = "0.0.0", git = "https://github.com/facebook/fb303.git", branch = "main" }
# fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
# reqwest = { git = "https://github.com/vmagro/reqwest", rev = "f9490c06756a9d35ab874c44657db790a87af80b" }
# watchman_client = { version = "0.8.0", git = "https://github.com/facebook/watchman.git", branch = "main" }
# Cargo.toml needs relaxing and bumping of versions as above - must be handled upstream.
# Fedora package needs update:
# rust-clap2+default-devel-2.34.0-3.fc37.noarch
# rust-clap3+regex-devel-3.2.21-1.fc37.noarch
# rust-clap+default-devel-4.1.6-1.fc37.noarch
# rust-clap+derive-devel-4.1.6-1.fc37.noarch
# rust-clap+env-devel-4.1.6-1.fc37.noarch
# rust-clap+unicode-devel-4.1.6-1.fc37.noarch
# rust-clap+wrap_help-devel-4.1.6-1.fc37.noarch
# rust-hostname+default-devel-0.3.1-6.fc37.noarch
# rust-insta+default-devel-1.18.2-1.fc37.noarch
# rust-insta+json-devel-1.18.2-1.fc37.noarch
# rust-lru+default-devel-0.9.0-1.fc37.noarch
# rust-phf+default-devel-0.10.1-2.fc37.noarch
# rust-phf+macros-devel-0.10.1-2.fc37.noarch
# rust-terminal_size+default-devel-0.2.5-1.fc37.noarch
# rust-tokio0.2+tracing-devel-0.2.24-5.fc37.noarch
# rust-zstd+default-devel-0.12.3-1.fc37.noarch
# rust-zstd+default-devel-0.12.3-1.fc37.noarch
# rust-zstd-safe+default-devel-6.0.4-1.fc37.noarch
# rust-zstd+zstdmt-devel-0.12.3-1.fc37.noarch
# Needs Fedora packaging:
# crate(abomonation_derive/default)
# crate(auto_impl/default)
# crate(cloned/default)
# crate(enum_dispatch/default)
# crate(faster-hex/default)
# crate(fbthrift_socket/default)
# crate(flate2/tokio)
# crate(hostcaps/default)
# crate(lz4-sys/default)
# crate(quickcheck_arbitrary_derive/default)
# crate(reqwest-eventsource/default)
# crate(reqwest/rustls-tls)
# crate(reqwest/rustls-tls-native-roots)
# crate(reqwest/trust-dns-optional)
# crate(termwiz/default)
# crate(termwiz/widgets)
# crate(tokio-uds-compat/default)
# crate(tracing-serde/default)
# crate(tracing-subscriber/ansi)
# crate(tracing-subscriber/default)
# crate(tracing-subscriber/env-filter)
# crate(tracing-subscriber/fmt)
# crate(tracing-subscriber/json)
# crate(tracing-subscriber/local-time)
# crate(tracing-subscriber/parking_lot)
# crate(tracing-subscriber/registry)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment