diff --git a/SPECS/go-md2man/generate_source_tarball.sh b/SPECS/go-md2man/generate_source_tarball.sh new file mode 100755 index 00000000000..39fece07d6e --- /dev/null +++ b/SPECS/go-md2man/generate_source_tarball.sh @@ -0,0 +1,118 @@ +#!/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="go-md2man" +NAME_VER="$PKG_NAME-$PKG_VERSION" +VENDOR_TARBALL="$OUT_FOLDER/$NAME_VER-govendor-v$VENDOR_VERSION.tar.gz" + +echo "Unpacking source tarball..." +tar -xf $SRC_TARBALL + +echo "Vendor go modules..." +cd $NAME_VER +go mod tidy -modfile=go.mod +go mod vendor -modfile=go.mod + +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" go.mod go.sum vendor + +popd > /dev/null +echo "$PKG_NAME vendored modules are available at $VENDOR_TARBALL" diff --git a/SPECS/go-md2man/go-md2man-2.0.2-govendor-v1.tar.gz b/SPECS/go-md2man/go-md2man-2.0.2-govendor-v1.tar.gz new file mode 100644 index 00000000000..4df2bb13b5a Binary files /dev/null and b/SPECS/go-md2man/go-md2man-2.0.2-govendor-v1.tar.gz differ diff --git a/SPECS/go-md2man/go-md2man.signatures.json b/SPECS/go-md2man/go-md2man.signatures.json index 61919718dc5..f0e2c34efef 100644 --- a/SPECS/go-md2man/go-md2man.signatures.json +++ b/SPECS/go-md2man/go-md2man.signatures.json @@ -1,5 +1,6 @@ { "Signatures": { + "go-md2man-2.0.2-govendor-v1.tar.gz": "c461396cf7f8942bc309350d51ddc0eb352ff9a0442a69bab174d60646918d12", "go-md2man-2.0.2.tar.gz": "2f52e37101ea2734b02f2b54a53c74305b95b3a9a27792fdac962b5354aa3e4a" } } diff --git a/SPECS/go-md2man/go-md2man.spec b/SPECS/go-md2man/go-md2man.spec index b3136fcaeec..a635f32808b 100644 --- a/SPECS/go-md2man/go-md2man.spec +++ b/SPECS/go-md2man/go-md2man.spec @@ -8,6 +8,7 @@ Distribution: Azure Linux Group: Tools/Container URL: https://github.com/cpuguy83/go-md2man Source0: https://github.com/cpuguy83/go-md2man/archive/v%{version}.tar.gz#/go-md2man-%{version}.tar.gz +Source1: %{name}-%{version}-govendor-v1.tar.gz BuildRequires: golang BuildRequires: which # required packages on install @@ -24,6 +25,7 @@ Distribution: Azure Linux %prep %setup -q -n %{name}-%{version} -c +tar -xf %{SOURCE1} %build export GOPATH=%{OUR_GOPATH}