From 0d1cbc9626790e9dcc7862ba8584a618885bf254 Mon Sep 17 00:00:00 2001 From: Will Dollman Date: Fri, 20 Oct 2023 14:23:51 +0100 Subject: [PATCH] Fork p4-fusion package and update in server + gitserver (#57762) Combine #57751 and #57756 to fork p4-fusion into a separate package, and update relevant images. We've forked the tool and are now ready to try some of the fixes out in a more production enviroment, so bundling this temporarily from a specific commit from the fork repo. Next up, I'll open a PR to use the newly generated base image in bazel and add the new --noBaseCommit flag to the perforce syncer. --------- Co-authored-by: Erik Seliger --- wolfi-images/gitserver.yaml | 2 +- wolfi-images/server.yaml | 2 +- wolfi-packages/p4-fusion-sg.yaml | 86 ++++++++++++++++++++++++++++++++ wolfi-packages/p4-fusion.yaml | 10 ++-- 4 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 wolfi-packages/p4-fusion-sg.yaml diff --git a/wolfi-images/gitserver.yaml b/wolfi-images/gitserver.yaml index 6c43f378d64..a13ab109625 100644 --- a/wolfi-images/gitserver.yaml +++ b/wolfi-images/gitserver.yaml @@ -16,7 +16,7 @@ contents: - coursier@sourcegraph - p4cli@sourcegraph - - p4-fusion=1.12-r6@sourcegraph + - p4-fusion-sg@sourcegraph paths: - path: /data/repos diff --git a/wolfi-images/server.yaml b/wolfi-images/server.yaml index bc313edf6be..593f1b9b882 100644 --- a/wolfi-images/server.yaml +++ b/wolfi-images/server.yaml @@ -36,7 +36,7 @@ contents: - ctags@sourcegraph - coursier@sourcegraph - p4cli@sourcegraph - - p4-fusion=1.12-r6@sourcegraph + - p4-fusion-sg@sourcegraph - s3proxy@sourcegraph - grafana@chainguard diff --git a/wolfi-packages/p4-fusion-sg.yaml b/wolfi-packages/p4-fusion-sg.yaml new file mode 100644 index 00000000000..f81870edee6 --- /dev/null +++ b/wolfi-packages/p4-fusion-sg.yaml @@ -0,0 +1,86 @@ +# Melange-based replacement for https://sourcegraph.sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/cmd/gitserver/p4-fusion-install-alpine.sh + +package: + name: p4-fusion-sg + version: 1.13.1 + epoch: 0 + description: "A fast Perforce to Git conversion tool, Sourcegraph fork" + target-architecture: + - x86_64 + copyright: + - paths: + - "*" + attestation: 'Copyright (c) 2022 Salesforce, Inc.' + license: 'BSD 3-Clause License' + dependencies: + runtime: + - libstdc++ + +environment: + contents: + repositories: + - https://packages.wolfi.dev/os + keyring: + - https://packages.wolfi.dev/os/wolfi-signing.rsa.pub + packages: + - build-base + - wget + - perl + - bash + - cmake + - busybox + - ca-certificates-bundle + +pipeline: + # Download p4-fusion + - uses: fetch + with: + uri: https://github.com/sourcegraph/p4-fusion/archive/1927d60872e88244d9421865a1ebcfa89d4d893f.tar.gz + expected-sha256: 16cc228293590c294c08d8bd53d228393ca72f4d998b6f38d78dc108969f5003 + extract: false + - runs: | + mkdir p4-fusion-src + tar -C p4-fusion-src -xzf 1927d60872e88244d9421865a1ebcfa89d4d893f.tar.gz --strip 1 + + # Download OpenSSL + - uses: fetch + with: + uri: https://www.openssl.org/source/openssl-1.0.2t.tar.gz + expected-sha256: 14cb464efe7ac6b54799b34456bd69558a749a4931ecfd9cf9f71d7881cac7bc + extract: false + - runs: | + mkdir openssl-src + tar -C openssl-src -xzf openssl-1.0.2t.tar.gz --strip 1 + + # Download Helix Core C++ API + - uses: fetch + with: + uri: https://www.perforce.com/downloads/perforce/r22.1/bin.linux26x86_64/p4api-glibc2.3-openssl1.0.2.tgz + # Hash occasionally changes, available at https://filehost.perforce.com/perforce/r22.1/bin.linux26x86_64/SHA256SUMS (check version) + expected-sha256: 7a7ca5b1b6c2401282a30c93065cd88f1bb47412246231c640ad3a6b7002c93b + extract: false + - runs: | + mkdir -p p4-fusion-src/vendor/helix-core-api/linux + tar -C p4-fusion-src/vendor/helix-core-api/linux -xzf p4api-glibc2.3-openssl1.0.2.tgz --strip 1 + + # Build OpenSSL + - runs: | + cd openssl-src + ./config + - runs: | + cd openssl-src + make build_libs + - runs: | + cd openssl-src + make install + + # Build p4-fusion + - runs: | + cd p4-fusion-src + ./generate_cache.sh RelWithDebInfo + ./build.sh + + # Copy p4-fusion binary + - runs: | + mkdir -p ${{targets.destdir}}/usr/local/bin/ + cp p4-fusion-src/build/p4-fusion/p4-fusion ${{targets.destdir}}/usr/local/bin/p4-fusion-binary diff --git a/wolfi-packages/p4-fusion.yaml b/wolfi-packages/p4-fusion.yaml index 0c1d3f31e6b..42b3d14f598 100644 --- a/wolfi-packages/p4-fusion.yaml +++ b/wolfi-packages/p4-fusion.yaml @@ -2,8 +2,8 @@ package: name: p4-fusion - version: 1.13.1-sg - epoch: 0 + version: 1.12 + epoch: 7 description: "A fast Perforce to Git conversion tool" target-architecture: - x86_64 @@ -35,12 +35,12 @@ pipeline: # Download p4-fusion - uses: fetch with: - uri: https://github.com/sourcegraph/p4-fusion/archive/1927d60872e88244d9421865a1ebcfa89d4d893f.tar.gz - expected-sha256: 16cc228293590c294c08d8bd53d228393ca72f4d998b6f38d78dc108969f5003 + uri: https://github.com/salesforce/p4-fusion/archive/refs/tags/v${{package.version}}.tar.gz + expected-sha256: f5cbca35880aad2e6fac05c669dab6c13c3389aa62cbc5d5ee2ce73e77bcfe78 extract: false - runs: | mkdir p4-fusion-src - tar -C p4-fusion-src -xzf 1927d60872e88244d9421865a1ebcfa89d4d893f.tar.gz --strip 1 + tar -C p4-fusion-src -xzf v${{package.version}}.tar.gz --strip 1 # Download OpenSSL - uses: fetch