Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions base/comps/azurelinux-repos/azurelinux-repos.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Summary: Azure Linux package repositories
Name: azurelinux-repos
Version: 4.0
Release: 4%{?dist}
Release: 5%{?dist}
License: MIT
URL: https://aka.ms/azurelinux

Expand Down Expand Up @@ -114,10 +114,11 @@ for repo in $RPM_BUILD_ROOT/etc/yum.repos.d/azurelinux.repo; do
done

# Update BASE_REPO_URI in azurelinux.repo; compute based on dist tag.
# Extract the last dot-delimited segment from %%dist (e.g. "20260303" from ".azl4~bootstrap.20260303").
# If the segment doesn't contain an 8-digit date, fall back to a hard-coded URI.
date_segment=$(echo '%{dist}' | awk -F. '{print $NF}')
if echo "$date_segment" | grep -qE '[0-9]{8}'; then
# Extract an 8-digit date stamp from %%dist.
# Handles both dotted forms (e.g. ".azl4~bootstrap.20260303") and tilde-only forms (e.g. ".azl4~20260412").
# If no 8-digit date is found, fall back to a hard-coded URI.
date_segment=$(echo '%{dist}' | grep -oE '[0-9]{8}')
Comment on lines +117 to +120
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grep -oE will output all 8-digit matches, potentially producing multiple lines in date_segment (e.g., newline-separated). That would make base_repo_uri malformed and could lead to unexpected behavior when %{dist} ever contains more than one 8-digit sequence. Prefer constraining to a single match (e.g., first match via grep -m1 -oE ... or piping to head -n1) and/or stripping newlines before using it in the URL.

Suggested change
# Extract an 8-digit date stamp from %%dist.
# Handles both dotted forms (e.g. ".azl4~bootstrap.20260303") and tilde-only forms (e.g. ".azl4~20260412").
# If no 8-digit date is found, fall back to a hard-coded URI.
date_segment=$(echo '%{dist}' | grep -oE '[0-9]{8}')
# Extract the first 8-digit date stamp from %%dist.
# Handles both dotted forms (e.g. ".azl4~bootstrap.20260303") and tilde-only forms (e.g. ".azl4~20260412").
# If no 8-digit date is found, fall back to a hard-coded URI.
date_segment=$(echo '%{dist}' | grep -oE '[0-9]{8}' | head -n1)

Copilot uses AI. Check for mistakes.
if [ -n "$date_segment" ]; then
base_repo_uri="https://stcontroltowerdevjwisitg.blob.core.windows.net/daily-repo-dev/${date_segment}"
else
base_repo_uri='https://packages.microsoft.com/azurelinux/$releasever/prod/base'
Expand Down Expand Up @@ -258,6 +259,9 @@ rm -f "$TMPRING"


%changelog
* Mon Apr 13 2026 Reuben Olinsky <reubeno@microsoft.com> - 4.0-5
- Fix dist tag date extraction to handle tilde-only forms (e.g. ".azl4~20260412").

* Wed Mar 25 2026 Sam Meluch <sammeluch@microsoft.com> - 4.0-4
- Update .repo files for daily repo publishing to dev blob storage.

Expand Down
Loading