Makefile.azure depends on the non-portable date option -v so only
include it if asked.
Reported by: def
Sponsored by: DARPA, AFRL
Differential D49527
release/vm: only include Makefile.azure if used brooks on Wed, Mar 26, 6:58 PM. Authored by Tags None Referenced Files
Details
Diff Detail
Event Timeline
Comment Actions Would replacing: START_DATE!= $(printf "%s-%s-%0.2d\n" "$(date -u +%Y)" "$(date -u +%m)" $(( $(date -u +%d) - 1 ))) EXPIRY_DATE!= $(printf "%s-%0.2d-%s\n" "$(date -u +%Y)" $(( $(date -u +%m) + 1 )) "$(date -u +%d)") in Makefile.azure avoid this? It is horrible, but portable. Comment Actions Yeah and whilst date -d 'today + 1 month' is supported by GNU date, it's slightly different when dealing with invalid dates, it'll add on the number of days in the current month rather than clamping to the end of the next month (e.g. -v+1m on 31st January is 28th February, but -d today + 1 month is 3rd March). Though perhaps +1m is a bit odd to be using here, maybe we do in fact want, say, +28d or +30d, as having VM images built in February expire sooner than those built in March could be surprising and confusing. Comment Actions Nice insight, as usual, thank you! So maybe (attempt #2): GNU_DATE!= date --help 2>/dev/null | grep GNU || true .if ${GNU_DATE} START_DATE!= date -d '-1 days' -I -u EXPIRY_DATE!= date -d '+30 days' -I -u .else START_DATE!= date -v-1d -I -u EXPIRY_DATE!= date -v+30d -I -u .endif Is not POSIX, but a little more portable? Comment Actions That is another option, although we'll have to change the value from epoch (raw date) to Y-m-d'T'H:M'Z' per the API (https://learn.microsoft.com/en-us/cli/azure/storage/blob?view=azure-cli-latest). Comment Actions I think that part uses ${START_DATE} and ${EXPIRY_DATE} can be removed and switch to newer publishing method. Let me modify Makefile.azure BTW, I still like only including file when it get used only. I would like to have this for all other files. There are many != usage which causes unnecessary forks. |