From a4a444a22fdb51b838565c9e441e3d7b901daebe Mon Sep 17 00:00:00 2001 From: Alex Hornby Date: Fri, 28 Nov 2025 08:57:17 -0800 Subject: [PATCH 1/3] fix cli OSS cargo build Summary: fix missing anyhow reference in the generated Cargo.toml Differential Revision: D87984172 --- .../bindings/modules/pyedenfsassertedstates/BUCK | 9 +++++++++ .../bindings/modules/pyedenfsassertedstates/Cargo.toml | 1 + 2 files changed, 10 insertions(+) diff --git a/eden/scm/saplingnative/bindings/modules/pyedenfsassertedstates/BUCK b/eden/scm/saplingnative/bindings/modules/pyedenfsassertedstates/BUCK index 7a0679b011ced..75b9ed588a4f8 100644 --- a/eden/scm/saplingnative/bindings/modules/pyedenfsassertedstates/BUCK +++ b/eden/scm/saplingnative/bindings/modules/pyedenfsassertedstates/BUCK @@ -6,6 +6,15 @@ oncall("sapling") rust_python_library( name = "pyedenfsassertedstates", srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "extra_buck_dependencies": { + "dependencies": [ + "fbsource//third-party/rust:anyhow", + ], + }, + }, + }, crate_root = "src/lib.rs", features = ["fb"], deps = [ diff --git a/eden/scm/saplingnative/bindings/modules/pyedenfsassertedstates/Cargo.toml b/eden/scm/saplingnative/bindings/modules/pyedenfsassertedstates/Cargo.toml index ebdc594c72289..2e01eac2f0601 100644 --- a/eden/scm/saplingnative/bindings/modules/pyedenfsassertedstates/Cargo.toml +++ b/eden/scm/saplingnative/bindings/modules/pyedenfsassertedstates/Cargo.toml @@ -6,6 +6,7 @@ version = "0.1.0" edition = "2024" [dependencies] +anyhow = "1.0.98" cpython = { version = "0.7.2", features = ["python3-sys"], default-features = false } edenfs-asserted-states-client = { version = "0.1.0", path = "../../../../../fs/rust/edenfs-asserted-states-client" } sapling-configmodel = { version = "0.1.0", path = "../../../../lib/config/model" } From 87107ccc9d98372cb071078f4dff4ec66d150491 Mon Sep 17 00:00:00 2001 From: Alex Hornby Date: Fri, 28 Nov 2025 09:51:34 -0800 Subject: [PATCH 2/3] update centos 9 python rpm to 3.12 Summary: CentOS Stream 9 default is python 3.9, update the manifest to use the available [redhat 3.12 packages](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/installing_and_using_dynamic_programming_languages/assembly_installing-and-using-python_installing-and-using-dynamic-programming-languages) Sapling needs python 3.10+ as it has modern type declarations and match keyword usage. I would have taken the RPMS to 3.10 to match ubuntu 22.04 but we don't have that available so take it to 3.12 to match upcoming CentOS Stream 10. Test fixes: * test-fbconduit.t updated `eden/scm/sapling/httpclient/__init__.py` as it was using a removed deprecated API. The [new one](https://docs.python.org/3.10/library/ssl.html?highlight=sslcontext%20wrap_socket#ssl.SSLContext.wrap_socket) has been present since python 3.7. * test-debugfilterid.t failing as code under test was returning nothing in a non-fb build. It can builds ok in non-fb, so removed the conditional compilation Differential Revision: D88010541 --- build/fbcode_builder/manifests/python | 5 +++ .../manifests/python-setuptools | 4 +++ .../debugcommands/cmddebugfilterid/BUCK | 9 ++--- .../debugcommands/cmddebugfilterid/src/lib.rs | 35 +++++++------------ eden/scm/sapling/httpclient/__init__.py | 4 +-- eden/scm/tests/run-tests.py | 2 +- eden/scm/tests/test-git-shallow.t | 1 + 7 files changed, 27 insertions(+), 33 deletions(-) diff --git a/build/fbcode_builder/manifests/python b/build/fbcode_builder/manifests/python index 00fed973ca95b..02f8311a0643b 100644 --- a/build/fbcode_builder/manifests/python +++ b/build/fbcode_builder/manifests/python @@ -8,6 +8,11 @@ python@3.8 python3 python3-devel +# Centos Stream 9 default python is 3.9, sapling needs 3.10+ +[rpms.all(distro=centos_stream,distro_vers=9)] +python3.12 +python3.12-devel + # sapling needs dataclasses which arrive in 3.7, and the bionic python is 3.6 [debs.all(distro=ubuntu,distro_vers="18.04")] python3.8-dev diff --git a/build/fbcode_builder/manifests/python-setuptools b/build/fbcode_builder/manifests/python-setuptools index 236cb0b514310..1f6013ddc0bfb 100644 --- a/build/fbcode_builder/manifests/python-setuptools +++ b/build/fbcode_builder/manifests/python-setuptools @@ -11,6 +11,10 @@ builder = python-wheel [rpms] python3-setuptools +# Centos Stream 9 default python is 3.9, sapling needs 3.10+ +[rpms.all(distro=centos_stream,distro_vers=9)] +python3.12-setuptools + [homebrew] python-setuptools diff --git a/eden/scm/lib/commands/debugcommands/cmddebugfilterid/BUCK b/eden/scm/lib/commands/debugcommands/cmddebugfilterid/BUCK index 4e7c92e72241d..6d4d52011da22 100644 --- a/eden/scm/lib/commands/debugcommands/cmddebugfilterid/BUCK +++ b/eden/scm/lib/commands/debugcommands/cmddebugfilterid/BUCK @@ -1,4 +1,3 @@ -load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss") load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library") oncall("sapling") @@ -20,15 +19,11 @@ rust_library( }, }}, crate_root = "src/lib.rs", - features = [ - "fb", - ], deps = [ "//eden/scm/lib/clidispatch:clidispatch", "//eden/scm/lib/commands/cmdutil:cmdutil", - "//eden/scm/lib/repo:repo", - ] + ([] if rust_oss.is_oss_build() else [ "//eden/scm/lib/filters:filters", + "//eden/scm/lib/repo:repo", "//eden/scm/lib/types:types", - ]), + ], ) diff --git a/eden/scm/lib/commands/debugcommands/cmddebugfilterid/src/lib.rs b/eden/scm/lib/commands/debugcommands/cmddebugfilterid/src/lib.rs index 020366617d62e..4d5ed4b3a6ae2 100644 --- a/eden/scm/lib/commands/debugcommands/cmddebugfilterid/src/lib.rs +++ b/eden/scm/lib/commands/debugcommands/cmddebugfilterid/src/lib.rs @@ -7,17 +7,13 @@ #![allow(unexpected_cfgs)] -#[cfg(feature = "fb")] use std::str::FromStr; use clidispatch::ReqCtx; use cmdutil::define_flags; -#[cfg(feature = "fb")] use filters::filter::FilterGenerator; use repo::repo::Repo; -#[cfg(feature = "fb")] use types::HgId; -#[cfg(feature = "fb")] use types::RepoPathBuf; define_flags! { @@ -34,25 +30,18 @@ define_flags! { } pub fn run(ctx: ReqCtx, repo: &Repo) -> cmdutil::Result { - #[cfg(feature = "fb")] - { - let config = repo.config(); - let mut filter_gen = - FilterGenerator::from_dot_dirs(repo.dot_hg_path(), repo.shared_dot_hg_path(), config)?; - let paths = ctx - .opts - .args - .into_iter() - .map(RepoPathBuf::from_string) - .collect::, _>>()?; - let commit_id = HgId::from_str(&ctx.opts.rev)?; - let filter = filter_gen.generate_filter_id(commit_id, &paths)?; - ctx.core.io.write(filter.id()?)? - } - - #[cfg(not(feature = "fb"))] - let _ = (ctx, repo); - + let config = repo.config(); + let mut filter_gen = + FilterGenerator::from_dot_dirs(repo.dot_hg_path(), repo.shared_dot_hg_path(), config)?; + let paths = ctx + .opts + .args + .into_iter() + .map(RepoPathBuf::from_string) + .collect::, _>>()?; + let commit_id = HgId::from_str(&ctx.opts.rev)?; + let filter = filter_gen.generate_filter_id(commit_id, &paths)?; + ctx.core.io.write(filter.id()?)?; Ok(0) } diff --git a/eden/scm/sapling/httpclient/__init__.py b/eden/scm/sapling/httpclient/__init__.py index 7d4ec98aee8a6..6939ef549cd2d 100644 --- a/eden/scm/sapling/httpclient/__init__.py +++ b/eden/scm/sapling/httpclient/__init__.py @@ -461,7 +461,7 @@ def __init__( if ssl_wrap_socket is not None: _wrap_socket = ssl_wrap_socket else: - _wrap_socket = ssl.wrap_socket + _wrap_socket = ssl.SSLContext.wrap_socket call_wrap_socket = None handlesubar = _handlesarg(_wrap_socket, "server_hostname") if handlesubar is True: @@ -470,7 +470,7 @@ def __init__( handlesnobar = _handlesarg(_wrap_socket, "serverhostname") if handlesnobar is True and handlesubar is not True: # supports serverhostname - def call_wrap_socket(sock, server_hostname=None, **ssl_opts): + def call_wrap_socket(sock, server_hostname=None, **ssl_opts): # noqa: F811 return _wrap_socket(sock, serverhostname=server_hostname, **ssl_opts) if handlesubar is False and handlesnobar is False: diff --git a/eden/scm/tests/run-tests.py b/eden/scm/tests/run-tests.py index 8ab6e179ac4b2..073adc04af570 100755 --- a/eden/scm/tests/run-tests.py +++ b/eden/scm/tests/run-tests.py @@ -2913,7 +2913,7 @@ def progressrenderer(): timepassed = now - suitestart lines = [] runningfrac = 0.0 - for name, (test, teststart) in runningtests.items(): + for name, (test, teststart) in list(runningtests.items()): try: saltseen, saltcount, linenum = getattr(test, "progress") runningfrac += saltseen * 1.0 / saltcount diff --git a/eden/scm/tests/test-git-shallow.t b/eden/scm/tests/test-git-shallow.t index df43a9065b44a..83dca9da5f22a 100644 --- a/eden/scm/tests/test-git-shallow.t +++ b/eden/scm/tests/test-git-shallow.t @@ -6,6 +6,7 @@ Test client git repo with lazy blob/tree objects. $ . $TESTDIR/git.sh $ git -c init.defaultBranch=main init -q server-repo $ cd server-repo + $ git config uploadpack.allowFilter true $ SL_IDENTITY=sl drawdag << 'EOS' > B # bookmark main = B > | # B/dir/1=2\n From 476186b9be9a5761a23acb518a26b175508dafa8 Mon Sep 17 00:00:00 2001 From: Alex Hornby Date: Sat, 29 Nov 2025 18:00:59 +0000 Subject: [PATCH 3/3] enable OSS CI now build is fixed Summary: enable CI now that the build and tests are fixed. Enabling for linux only to limit noise for the teams Differential Revision: D88010549 --- .github/workflows/sapling-cli-getdeps_linux.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sapling-cli-getdeps_linux.yml b/.github/workflows/sapling-cli-getdeps_linux.yml index 4665d0be1d979..e36d3fb3632dd 100644 --- a/.github/workflows/sapling-cli-getdeps_linux.yml +++ b/.github/workflows/sapling-cli-getdeps_linux.yml @@ -3,7 +3,12 @@ name: Sapling CLI Getdeps Linux on: - workflow_dispatch + push: + branches: + - main + pull_request: + branches: + - main permissions: contents: read # to fetch code (actions/checkout)