ci: Update shared scripts and dot files to 0ed15ed
This commit is contained in:
committed by
Guido Günther
parent
73d5a02bfc
commit
fe17c6d5ee
Executable
+102
@@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2024 The Phosh developers
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Author: Guido Günther <agx@sigxcpu.org>
|
||||
#
|
||||
# Check if NEWS, changelog, meson and metainfo are in sync
|
||||
|
||||
set -e
|
||||
|
||||
COLOR=
|
||||
if [ -n "${TERM}" ] && [ "${TERM}" != "dumb" ]; then
|
||||
COLOR=1
|
||||
fi
|
||||
|
||||
function log
|
||||
{
|
||||
local level="${1}"
|
||||
local fd=2
|
||||
local use_color
|
||||
|
||||
shift
|
||||
if [ -n "${COLOR}" ]; then
|
||||
[ "${level}" == warn ] || [ "${level}" == error ] || fd=1
|
||||
! [ -t "${fd}" ] || use_color=1
|
||||
|
||||
if [ -n "${use_color}" ]; then
|
||||
case "${level}" in
|
||||
warn)
|
||||
tput setaf 1
|
||||
;;
|
||||
error)
|
||||
tput bold; tput setaf 1
|
||||
;;
|
||||
info)
|
||||
tput setaf 2
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$@"
|
||||
|
||||
[ -z "${use_color}" ] || tput sgr0
|
||||
}
|
||||
|
||||
|
||||
if [ -f debian/changelog ]; then
|
||||
log info "Fetching version from d/changelog"
|
||||
VERSION=$(dpkg-parsechangelog -SVersion)
|
||||
elif [ -f meson.build ]; then
|
||||
log info "Fetching version from meson build file"
|
||||
VERSION=$(sed -n "s/.*version\s*:\s*'\([0-9].*\)'.*/\1/p" meson.build)
|
||||
else
|
||||
log error "E: Don't know how to get version information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "I: Checking for '${VERSION}'"
|
||||
|
||||
# News
|
||||
if ! head -1 NEWS | grep -E -qs "\s+${VERSION}\s*$"; then
|
||||
log error "E: Version ${VERSION} not in NEWS file"
|
||||
if [[ "${VERSION}" =~ (~|-)dev ]]; then
|
||||
log info "I: Unreleased development version, no need to check NEWS"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
log info "I: Found matching news entry"
|
||||
fi
|
||||
|
||||
# meson.build
|
||||
MESON_VERSION="${VERSION/\~/.}"
|
||||
if [ -f meson.build ]; then
|
||||
if ! grep -qs "version\s*:\s*'$MESON_VERSION'" meson.build; then
|
||||
log error "E: Version ${MESON_VERSION} not in meson.build file"
|
||||
exit 1
|
||||
else
|
||||
log info "I: Found matching meson version entry"
|
||||
fi
|
||||
else
|
||||
log info "I: no meson project"
|
||||
fi
|
||||
|
||||
# appstream info
|
||||
METAINFO=$(ls data/*metainfo.xml.in* 2>/dev/null || true)
|
||||
if [ -z "${METAINFO}" ]; then
|
||||
log warn "W: No metainfo"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! grep -qs "$MESON_VERSION\"" "${METAINFO}"; then
|
||||
log error "E: Version ${MESON_VERSION} not in metainfo ${METAINFO}"
|
||||
if [[ "${VERSION}" =~ (~|-)(alpha|beta|dev|rc) ]]; then
|
||||
log info "I: Not a stable release, no metainfo is fine"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
log info "I: Found matching metainfo entry"
|
||||
fi
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2025 The Phosh developers
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# Author: Guido Günther <agx@sigxcpu.org>
|
||||
|
||||
ret=0
|
||||
|
||||
TMPDIR=$(mktemp -d)
|
||||
|
||||
# We check files individually so we can print the diff:
|
||||
while IFS= read -r -d '' file; do
|
||||
if ! meson format -e --check-only "$file"; then
|
||||
echo
|
||||
echo "Meson file '${file}' needs reformat:"
|
||||
meson format -e "$file" > "${TMPDIR}/meson.build"
|
||||
diff -u "$file" "${TMPDIR}/meson.build"
|
||||
rm -f "${TMPDIR}/meson.build"
|
||||
ret=1
|
||||
fi
|
||||
done < <(find . -name '*.build' -print0)
|
||||
|
||||
if [ -n "$TMPDIR" ]; then
|
||||
rmdir "${TMPDIR}"
|
||||
fi
|
||||
|
||||
if [ $ret -ne 0 ]; then
|
||||
cat <<EOF
|
||||
|
||||
To reformat all files run:
|
||||
|
||||
meson format -e --recursive --inplace
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
exit $ret
|
||||
+5
-1
@@ -1,11 +1,15 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2024 The Phosh developers
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Author: Guido Günther <agx@sigxcpu.org>
|
||||
|
||||
cd po/ || exit 1
|
||||
# barf on untranslated C files. Seems intltool
|
||||
# can't be told to exit with non-zero exit status
|
||||
# in this case
|
||||
|
||||
if intltool-update -m 2>&1 | grep -E -qs '/.*\.(c|ui)'; then
|
||||
if intltool-update -m 2>&1 | grep -E -qs '/.*\.(c|ui|in)'; then
|
||||
intltool-update -m
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -110,6 +110,8 @@ sp_cmt_cpp_start = add
|
||||
#
|
||||
# Add or remove space between #else or #endif and a trailing comment.
|
||||
sp_endif_cmt = add
|
||||
# Offset value that controls the indentation of the body of a multiline #define
|
||||
pp_multiline_define_body_indent = 2
|
||||
|
||||
# Newlines at the start and end of the file.
|
||||
nl_start_of_file = remove
|
||||
@@ -143,3 +145,4 @@ sp_before_sparen = add
|
||||
# Add spaces around assignments and arithmethic operators
|
||||
sp_assign = add
|
||||
sp_arith = add
|
||||
|
||||
|
||||
Reference in New Issue
Block a user