From f5d5830209004ebc52d085b69914bb28aea969c3 Mon Sep 17 00:00:00 2001 From: Osama Esmail Date: Wed, 22 Jan 2025 13:59:37 -0800 Subject: [PATCH 1/2] added script and got new tarball, but sha doesn't line up --- SPECS/git-lfs/generate_source_tarball.sh | 120 +++++++++++++++++++++++ SPECS/git-lfs/git-lfs.spec | 20 +--- 2 files changed, 121 insertions(+), 19 deletions(-) create mode 100755 SPECS/git-lfs/generate_source_tarball.sh diff --git a/SPECS/git-lfs/generate_source_tarball.sh b/SPECS/git-lfs/generate_source_tarball.sh new file mode 100755 index 00000000000..09bed09eed9 --- /dev/null +++ b/SPECS/git-lfs/generate_source_tarball.sh @@ -0,0 +1,120 @@ +#!/bin/bash +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +# Quit on failure +set -e + +PKG_VERSION="" +SRC_TARBALL="" +VENDOR_VERSION="1" +OUT_FOLDER="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# parameters: +# +# --srcTarball : src tarball file +# this file contains the 'initial' source code of the component +# and should be replaced with the new/modified src code +# --outFolder : folder where to copy the new tarball(s) +# --pkgVersion : package version +# --vendorVersion : vendor version +# +PARAMS="" +while (( "$#" )); do + case "$1" in + --srcTarball) + if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then + SRC_TARBALL=$2 + shift 2 + else + echo "Error: Argument for $1 is missing" >&2 + exit 1 + fi + ;; + --outFolder) + if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then + OUT_FOLDER=$2 + shift 2 + else + echo "Error: Argument for $1 is missing" >&2 + exit 1 + fi + ;; + --pkgVersion) + if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then + PKG_VERSION=$2 + shift 2 + else + echo "Error: Argument for $1 is missing" >&2 + exit 1 + fi + ;; + --vendorVersion) + if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then + VENDOR_VERSION=$2 + shift 2 + else + echo "Error: Argument for $1 is missing" >&2 + exit 1 + fi + ;; + -*|--*=) # unsupported flags + echo "Error: Unsupported flag $1" >&2 + exit 1 + ;; + *) # preserve positional arguments + PARAMS="$PARAMS $1" + shift + ;; + esac +done + +echo "--srcTarball -> $SRC_TARBALL" +echo "--outFolder -> $OUT_FOLDER" +echo "--pkgVersion -> $PKG_VERSION" +echo "--vendorVersion -> $VENDOR_VERSION" + +if [ -z "$PKG_VERSION" ]; then + echo "--pkgVersion parameter cannot be empty" + exit 1 +fi + +echo "-- create temp folder" +tmpdir=$(mktemp -d) +function cleanup { + echo "+++ cleanup -> remove $tmpdir" + rm -rf $tmpdir +} +trap cleanup EXIT + +TARBALL_FOLDER="$tmpdir/tarballFolder" +mkdir -p $TARBALL_FOLDER +cp $SRC_TARBALL $tmpdir + +pushd $tmpdir > /dev/null + +PKG_NAME="git-lfs" +NAME_VER="$PKG_NAME-$PKG_VERSION" +VENDOR_TARBALL="$OUT_FOLDER/$NAME_VER-govendor-v$VENDOR_VERSION.tar.gz" +# Old name is below +# VENDOR_TARBALL="$OUT_FOLDER/$NAME_VER-vendor.tar.gz" + +echo "Unpacking source tarball..." +tar -xf $SRC_TARBALL + +echo "Vendor go modules..." +cd "$NAME_VER" +go mod tidy +go mod vendor + +echo "" +echo "=========================" +echo "Tar vendored tarball" +tar --sort=name \ + --mtime="2021-04-26 00:00Z" \ + --owner=0 --group=0 --numeric-owner \ + --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \ + -czf "$VENDOR_TARBALL" vendor + +popd > /dev/null +echo "$PKG_NAME vendored modules are available at $VENDOR_TARBALL" \ No newline at end of file diff --git a/SPECS/git-lfs/git-lfs.spec b/SPECS/git-lfs/git-lfs.spec index 33db65f571d..d95b8aa02e6 100644 --- a/SPECS/git-lfs/git-lfs.spec +++ b/SPECS/git-lfs/git-lfs.spec @@ -9,25 +9,7 @@ Distribution: Azure Linux License: MIT URL: https://github.com/git-lfs/git-lfs Source0: https://github.com/git-lfs/git-lfs/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz -# Below is a manually created tarball, no download link. -# We're using pre-populated Go modules from this tarball, since network is disabled during build time. -# How to re-build this file: -# 1. wget https://github.com/git-lfs/git-lfs/archive/v%{version}.tar.gz -O git-lfs-%%{version}.tar.gz -# 2. tar -xf git-lfs-%%{version}.tar.gz -# 3. cd git-lfs-%%{version} -# 4. go mod vendor -# 5. tar --sort=name \ -# --mtime="2021-04-26 00:00Z" \ -# --owner=0 --group=0 --numeric-owner \ -# --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \ -# -cf %%{name}-%%{version}-vendor.tar.gz vendor -# -# NOTES: -# - You require GNU tar version 1.28+. -# - The additional options enable generation of a tarball with the same hash every time regardless of the environment. -# See: https://reproducible-builds.org/docs/archives/ -# - For the value of "--mtime" use the date "2021-04-26 00:00Z" to simplify future updates. -Source1: %{name}-%{version}-vendor.tar.gz +Source1: %{name}-%{version}-govendor-v1.tar.gz BuildRequires: golang BuildRequires: which From 4f8b0ad2d67f80cab5e6c0449637da7a6c1a8964 Mon Sep 17 00:00:00 2001 From: Osama Esmail Date: Wed, 29 Jan 2025 13:40:02 -0800 Subject: [PATCH 2/2] updating signatures --- SPECS/git-lfs/git-lfs.signatures.json | 1 + 1 file changed, 1 insertion(+) diff --git a/SPECS/git-lfs/git-lfs.signatures.json b/SPECS/git-lfs/git-lfs.signatures.json index d1aa98a5449..112e0a3ded6 100644 --- a/SPECS/git-lfs/git-lfs.signatures.json +++ b/SPECS/git-lfs/git-lfs.signatures.json @@ -1,5 +1,6 @@ { "Signatures": { + "git-lfs-3.6.1-govendor-v1.tar.gz": "cb27e19fc26ce18bb0b363df10761605ddfe4fdc6f62c0f5fc4f8d072d580cd4", "git-lfs-3.6.1-vendor.tar.gz": "6cb4c1deda8ef0b2014c559e06808b58a4fd04f2b487ad30566e0d683889cd65", "git-lfs-3.6.1.tar.gz": "062603dbef8f221d867e542314e9a6ea1970cae536b4495de2e915529b0fef8e" }