mirror of
https://github.com/falk-werner/webfuse-provider
synced 2026-03-02 04:09:18 +00:00
Merge commit 'b19a54d2f9d8a3e83366c638aace4cf3b5daa96e' as 'build/dobuild'
This commit is contained in:
40
build/dobuild/bin/get_source_date_epoch
Executable file
40
build/dobuild/bin/get_source_date_epoch
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# This file is part of dobuild.
|
||||
# Copyright (c) 2019 Contributors as noted in the AUTHORS file.
|
||||
#
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
exec 0<&-
|
||||
|
||||
set -e
|
||||
|
||||
export LANG=C
|
||||
export LC_ALL=C
|
||||
|
||||
TOPDIR="$1"
|
||||
|
||||
[ -z "$TOPDIR" ] || cd "$TOPDIR"
|
||||
|
||||
try_git() {
|
||||
[ -d .git ] || return 1
|
||||
git show -s --format=format:%ct HEAD
|
||||
}
|
||||
|
||||
try_svn() {
|
||||
[ -d .svn ] || return 1
|
||||
LAST_CHANGED_DATE="$(svn info | sed -n -e 's/^Last Changed Date: //p')"
|
||||
[ -n "$LAST_CHANGED_DATE" ] || return 2
|
||||
SOURCE_DATE_EPOCH="$(date -d "$LAST_CHANGED_DATE" +%s)"
|
||||
}
|
||||
|
||||
try_mtime() {
|
||||
stat -c '%Y' "$PWD"
|
||||
}
|
||||
|
||||
SOURCE_DATE_EPOCH="$(try_git || try_svn || try_mtime)"
|
||||
echo "$SOURCE_DATE_EPOCH"
|
||||
Reference in New Issue
Block a user