Restructure solution layout by module
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				Docs CI / lint-and-preview (push) Has been cancelled
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	Docs CI / lint-and-preview (push) Has been cancelled
				
			This commit is contained in:
		| @@ -1,71 +1,71 @@ | ||||
| #!/usr/bin/env bash | ||||
|  | ||||
| # Sync preview NuGet packages into the local offline feed. | ||||
| # Reads package metadata from ops/devops/nuget-preview-packages.csv | ||||
| # and ensures ./local-nuget holds the expected artefacts (with SHA-256 verification). | ||||
| # Optional 4th CSV column can override the download base (e.g. dotnet-public flat container). | ||||
|  | ||||
| set -euo pipefail | ||||
|  | ||||
| repo_root="$(git -C "${BASH_SOURCE%/*}/.." rev-parse --show-toplevel 2>/dev/null || pwd)" | ||||
| manifest="${repo_root}/ops/devops/nuget-preview-packages.csv" | ||||
| dest="${repo_root}/local-nuget" | ||||
| nuget_v2_base="${NUGET_V2_BASE:-https://www.nuget.org/api/v2/package}" | ||||
|  | ||||
| if [[ ! -f "$manifest" ]]; then | ||||
|   echo "Manifest not found: $manifest" >&2 | ||||
|   exit 1 | ||||
| fi | ||||
|  | ||||
| mkdir -p "$dest" | ||||
|  | ||||
| fetch_package() { | ||||
|   local package="$1" | ||||
|   local version="$2" | ||||
|   local expected_sha="$3" | ||||
|   local source_base="$4" | ||||
|   local target="$dest/${package}.${version}.nupkg" | ||||
|   local url | ||||
|  | ||||
|   if [[ -n "$source_base" ]]; then | ||||
|     local package_lower | ||||
|     package_lower="${package,,}" | ||||
|     url="${source_base%/}/${package_lower}/${version}/${package_lower}.${version}.nupkg" | ||||
|   else | ||||
|     url="${nuget_v2_base%/}/${package}/${version}" | ||||
|   fi | ||||
|  | ||||
|   echo "[sync-nuget] Fetching ${package} ${version}" | ||||
|   local tmp | ||||
|   tmp="$(mktemp)" | ||||
|   trap 'rm -f "$tmp"' RETURN | ||||
|   curl -fsSL --retry 3 --retry-delay 1 "$url" -o "$tmp" | ||||
|   local actual_sha | ||||
|   actual_sha="$(sha256sum "$tmp" | awk '{print $1}')" | ||||
|   if [[ "$actual_sha" != "$expected_sha" ]]; then | ||||
|     echo "Checksum mismatch for ${package} ${version}" >&2 | ||||
|     echo "  expected: $expected_sha" >&2 | ||||
|     echo "  actual:   $actual_sha" >&2 | ||||
|     exit 1 | ||||
|   fi | ||||
|   mv "$tmp" "$target" | ||||
|   trap - RETURN | ||||
| } | ||||
|  | ||||
| while IFS=',' read -r package version sha source_base; do | ||||
|   [[ -z "$package" || "$package" == \#* ]] && continue | ||||
|  | ||||
|   local_path="$dest/${package}.${version}.nupkg" | ||||
|   if [[ -f "$local_path" ]]; then | ||||
|     current_sha="$(sha256sum "$local_path" | awk '{print $1}')" | ||||
|     if [[ "$current_sha" == "$sha" ]]; then | ||||
|       echo "[sync-nuget] OK ${package} ${version}" | ||||
|       continue | ||||
|     fi | ||||
|     echo "[sync-nuget] SHA mismatch for ${package} ${version}, refreshing" | ||||
|   else | ||||
|     echo "[sync-nuget] Missing ${package} ${version}" | ||||
|   fi | ||||
|  | ||||
|   fetch_package "$package" "$version" "$sha" "${source_base:-}" | ||||
| done < "$manifest" | ||||
| #!/usr/bin/env bash | ||||
|  | ||||
| # Sync preview NuGet packages into the local offline feed. | ||||
| # Reads package metadata from ops/devops/nuget-preview-packages.csv | ||||
| # and ensures ./local-nuget holds the expected artefacts (with SHA-256 verification). | ||||
| # Optional 4th CSV column can override the download base (e.g. dotnet-public flat container). | ||||
|  | ||||
| set -euo pipefail | ||||
|  | ||||
| repo_root="$(git -C "${BASH_SOURCE%/*}/.." rev-parse --show-toplevel 2>/dev/null || pwd)" | ||||
| manifest="${repo_root}/ops/devops/nuget-preview-packages.csv" | ||||
| dest="${repo_root}/local-nuget" | ||||
| nuget_v2_base="${NUGET_V2_BASE:-https://www.nuget.org/api/v2/package}" | ||||
|  | ||||
| if [[ ! -f "$manifest" ]]; then | ||||
|   echo "Manifest not found: $manifest" >&2 | ||||
|   exit 1 | ||||
| fi | ||||
|  | ||||
| mkdir -p "$dest" | ||||
|  | ||||
| fetch_package() { | ||||
|   local package="$1" | ||||
|   local version="$2" | ||||
|   local expected_sha="$3" | ||||
|   local source_base="$4" | ||||
|   local target="$dest/${package}.${version}.nupkg" | ||||
|   local url | ||||
|  | ||||
|   if [[ -n "$source_base" ]]; then | ||||
|     local package_lower | ||||
|     package_lower="${package,,}" | ||||
|     url="${source_base%/}/${package_lower}/${version}/${package_lower}.${version}.nupkg" | ||||
|   else | ||||
|     url="${nuget_v2_base%/}/${package}/${version}" | ||||
|   fi | ||||
|  | ||||
|   echo "[sync-nuget] Fetching ${package} ${version}" | ||||
|   local tmp | ||||
|   tmp="$(mktemp)" | ||||
|   trap 'rm -f "$tmp"' RETURN | ||||
|   curl -fsSL --retry 3 --retry-delay 1 "$url" -o "$tmp" | ||||
|   local actual_sha | ||||
|   actual_sha="$(sha256sum "$tmp" | awk '{print $1}')" | ||||
|   if [[ "$actual_sha" != "$expected_sha" ]]; then | ||||
|     echo "Checksum mismatch for ${package} ${version}" >&2 | ||||
|     echo "  expected: $expected_sha" >&2 | ||||
|     echo "  actual:   $actual_sha" >&2 | ||||
|     exit 1 | ||||
|   fi | ||||
|   mv "$tmp" "$target" | ||||
|   trap - RETURN | ||||
| } | ||||
|  | ||||
| while IFS=',' read -r package version sha source_base; do | ||||
|   [[ -z "$package" || "$package" == \#* ]] && continue | ||||
|  | ||||
|   local_path="$dest/${package}.${version}.nupkg" | ||||
|   if [[ -f "$local_path" ]]; then | ||||
|     current_sha="$(sha256sum "$local_path" | awk '{print $1}')" | ||||
|     if [[ "$current_sha" == "$sha" ]]; then | ||||
|       echo "[sync-nuget] OK ${package} ${version}" | ||||
|       continue | ||||
|     fi | ||||
|     echo "[sync-nuget] SHA mismatch for ${package} ${version}, refreshing" | ||||
|   else | ||||
|     echo "[sync-nuget] Missing ${package} ${version}" | ||||
|   fi | ||||
|  | ||||
|   fetch_package "$package" "$version" "$sha" "${source_base:-}" | ||||
| done < "$manifest" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user