From c429fbdd94ef14eebb7070e79df18f5272ea8d75 Mon Sep 17 00:00:00 2001 From: From: Pat Riehecky Date: Jul 10 2014 15:46:03 +0000 Subject: Added switch to preserve timestamps on creation of SRPMs for ls -ltr --- diff --git a/into_srpm.sh b/into_srpm.sh index 32f02b2..4b8c9ea 100755 --- a/into_srpm.sh +++ b/into_srpm.sh @@ -13,12 +13,13 @@ ##################################################################### usage() { echo '' >&2 - echo "$0 [-hq] [-b branch] [-c shasum]" >&2 + echo "$0 [-htq] [-b branch] [-c shasum]" >&2 echo '' >&2 echo 'You need to run this from inside a sources git repo' >&2 echo '' >&2 echo ' -h: This help message' >&2 echo ' -q: Suppress warnings' >&2 + echo ' -t: Set srpm timestamp to commit date' >&2 echo '' >&2 echo ' -b: specify a branch to examine' >&2 echo " defaults to repo's current branch" >&2 @@ -39,6 +40,7 @@ usage() { ##################################################################### QUIET=0 +KEEPTIMESTAMP=0 COMMITHASH="" BRANCH="" @@ -47,7 +49,7 @@ BRANCH="" # nice and easy. You'll need to read the manpages for more info # utilizing 'while' construct rather than 'for arg' to avoid unnecessary # shifting of program args -args=$(getopt -o hqb:c: -- "$@") +args=$(getopt -o htqb:c: -- "$@") eval set -- "$args" while [[ 0 -eq 0 ]]; do @@ -57,6 +59,11 @@ while [[ 0 -eq 0 ]]; do shift break ;; + -t ) + # suppress warnings + KEEPTIMESTAMP=1 + shift + ;; -q ) # suppress warnings QUIET=1 @@ -144,6 +151,11 @@ else RC=$? fi +if [[ ${KEEPTIMESTAMP} -eq 1 ]]; then + timestamp=$(git log --pretty=%ai -1) + find . -type f -name \*.src.rpm -exec touch -d "${timestamp}" {} \; +fi + if [[ ${RC} -ne 0 ]]; then if [[ $QUIET -eq 1 ]]; then echo "$0 failed to recreate srpm" >&2