[dim PATCH 1/7] dim: abstract driver date update to a subcommand

Daniel Vetter daniel at ffwll.ch
Thu Dec 6 08:31:49 UTC 2018


On Wed, Dec 05, 2018 at 05:02:53PM +0200, Jani Nikula wrote:
> Abstract the driver date update to a function of its own. Make it useful
> for other drivers as well in case they ever need it.
> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

> ---
>  dim     | 24 ++++++++++++++++++------
>  dim.rst |  5 +++++
>  2 files changed, 23 insertions(+), 6 deletions(-)
> 
> diff --git a/dim b/dim
> index 3d6548568b56..8187f8894c8f 100755
> --- a/dim
> +++ b/dim
> @@ -1841,6 +1841,23 @@ function tag_branch
>  	$DRY git tag -a $DIM_GPG_KEYID -f $tag
>  }
>  
> +# $1: commit subject prefix
> +# $2: file
> +function dim_update_driver_date
> +{
> +	local prefix file driver_date driver_timestamp
> +
> +	prefix=${1:?$usage}
> +	file=${2:?$usage}
> +
> +	driver_date=$(date +%Y%m%d)
> +	driver_timestamp=$(date +%s)
> +
> +	$DRY sed -i -e "s/^#define DRIVER_DATE.*\"[0-9]*\"$/#define DRIVER_DATE\t\t\"$driver_date\"/; s/^#define DRIVER_TIMESTAMP.*/#define DRIVER_TIMESTAMP\t$driver_timestamp/" "$file"
> +	$DRY git add "$file"
> +	git commit $DRY_RUN -sm "$prefix: Update DRIVER_DATE to $driver_date"
> +}
> +
>  function dim_update_next
>  {
>  	local remote
> @@ -1861,12 +1878,7 @@ function dim_update_next
>  		exit 2
>  	fi
>  
> -	driver_date=$(date +%Y%m%d)
> -	driver_timestamp=$(date +%s)
> -	$DRY sed -i -e "s/^#define DRIVER_DATE.*\"[0-9]*\"$/#define DRIVER_DATE\t\t\"$driver_date\"/; s/^#define DRIVER_TIMESTAMP.*/#define DRIVER_TIMESTAMP\t$driver_timestamp/" \
> -	     drivers/gpu/drm/i915/i915_drv.h
> -	$DRY git add drivers/gpu/drm/i915/i915_drv.h
> -	git commit $DRY_RUN -sm "drm/i915: Update DRIVER_DATE to $driver_date"
> +	dim_update_driver_date "drm/i915" "drivers/gpu/drm/i915/i915_drv.h"
>  
>  	gitk --first-parent drm-intel-next-queued ^$(branch_to_remote drm-next)/drm-next &
>  
> diff --git a/dim.rst b/dim.rst
> index 5a093b03c24a..2a0deedb6ba1 100644
> --- a/dim.rst
> +++ b/dim.rst
> @@ -274,6 +274,11 @@ for-each-workdir *command*
>  Run the given command in all active workdirs including the main linux kernel
>  repository under \$DIM_REPO.
>  
> +update-driver-date *prefix* *file*
> +----------------------------------
> +Update the the DRIVER_DATE and DRIVER_TIMESTAMP macros in *file* to match
> +current date and time, and commit the change using given subject prefix.
> +
>  COMMANDS FOR MAINTAINERS
>  ========================
>  
> -- 
> 2.11.0
> 
> _______________________________________________
> dim-tools mailing list
> dim-tools at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dim-tools

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dim-tools mailing list