blob: 126ba31179299619721e295b0bfe33f108b3f6e9 [file] [log] [blame]
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
revbump_ebuild() {
# Revbump an ebuild file by updating the version number in its name.
# Find an *.ebuild with a revision number, not 9999, should be only one.
EBUILD=$(find . -name "*-r*.ebuild")
# Remove the extension
# Get the numeric suffix after the 'r'.
# If $F == ./coreboot-private-files-hatch-0.0.1-r30
# then we want '30'.
# We need to reverse the string because cut only supports cutting specific
# fields from the start a string (you can't say N-1, N-2 in general) and
# we need the last field.
REVISION=$(echo "${F}" | rev | cut -d- -f 1 | cut -dr -f 1 | rev)
# Increment
# Replace e.g. 'r30' with 'r31' in the file name
# Rename
git mv "${EBUILD}" "${NEWEBUILD}"