mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-13 01:46:19 +02:00
Compare commits
12 Commits
v1.1.0
...
version-ed
Author | SHA1 | Date | |
---|---|---|---|
![]() |
93928f7409 | ||
![]() |
39eaeaa4b2 | ||
![]() |
c79a993148 | ||
![]() |
6d0ac6b9a8 | ||
![]() |
66a4357f3e | ||
![]() |
db2f82bf19 | ||
![]() |
e0a84aefc3 | ||
![]() |
98bd7e3760 | ||
![]() |
3e79cb8f4a | ||
![]() |
1cf402eae9 | ||
![]() |
0469d3c902 | ||
![]() |
f6b1b1ba45 |
2
Makefile
2
Makefile
@@ -1,6 +1,6 @@
|
||||
SHELL=/bin/bash
|
||||
|
||||
V=1.1.0
|
||||
V=1.1.1
|
||||
BUILDTOOLVER ?= $(V)
|
||||
|
||||
PREFIX = /usr/local
|
||||
|
@@ -69,6 +69,7 @@ Component: pkgctl db remove
|
||||
- bash
|
||||
- binutils
|
||||
- coreutils
|
||||
- curl
|
||||
- diffutils
|
||||
- fakeroot
|
||||
- findutils
|
||||
@@ -90,6 +91,7 @@ Component: pkgctl db remove
|
||||
|
||||
- bat (pretty printing)
|
||||
- nvchecker (version checking)
|
||||
- pacman-contrib (--update-checksums options for pkgctl build)
|
||||
|
||||
### Development Dependencies
|
||||
|
||||
|
@@ -41,7 +41,7 @@ CHOST="x86_64-pc-linux-gnu"
|
||||
#-- Compiler and Linker Flags
|
||||
#CPPFLAGS=""
|
||||
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
|
||||
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
|
||||
-Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \
|
||||
-fstack-clash-protection -fcf-protection"
|
||||
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
|
||||
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now \
|
||||
|
@@ -41,7 +41,7 @@ CHOST="x86_64-pc-linux-gnu"
|
||||
#-- Compiler and Linker Flags
|
||||
#CPPFLAGS=""
|
||||
CFLAGS="-march=x86-64-v3 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
|
||||
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
|
||||
-Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \
|
||||
-fstack-clash-protection -fcf-protection"
|
||||
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
|
||||
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now \
|
||||
|
@@ -154,6 +154,7 @@ pkgctl_build() {
|
||||
(( $# <= 1 )) && die "missing argument for %s" "$1"
|
||||
pkgctl_build_check_option_group_repo '--repo' "${REPO}" "${TESTING}" "${STAGING}"
|
||||
REPO="${2}"
|
||||
RELEASE_OPTIONS+=("--repo" "${REPO}")
|
||||
shift 2
|
||||
;;
|
||||
--arch)
|
||||
@@ -204,11 +205,13 @@ pkgctl_build() {
|
||||
-s|--staging)
|
||||
pkgctl_build_check_option_group_repo '--staging' "${REPO}" "${TESTING}" "${STAGING}"
|
||||
STAGING=1
|
||||
RELEASE_OPTIONS+=("--staging")
|
||||
shift
|
||||
;;
|
||||
-t|--testing)
|
||||
pkgctl_build_check_option_group_repo '--testing' "${REPO}" "${TESTING}" "${STAGING}"
|
||||
TESTING=1
|
||||
RELEASE_OPTIONS+=("--testing")
|
||||
shift
|
||||
;;
|
||||
-c|--clean)
|
||||
@@ -495,7 +498,7 @@ pkgctl_build() {
|
||||
|
||||
# release the build
|
||||
if (( RELEASE )); then
|
||||
pkgctl_release --repo "${pkgrepo}" "${RELEASE_OPTIONS[@]}"
|
||||
pkgctl_release "${RELEASE_OPTIONS[@]}"
|
||||
fi
|
||||
|
||||
# reset common PKGBUILD variables
|
||||
|
@@ -31,12 +31,21 @@ export PACKAGING_REPO_RELEASE_HOST=repos.archlinux.org
|
||||
export PKGBASE_MAINTAINER_URL=https://archlinux.org/packages/pkgbase-maintainer
|
||||
export AUR_URL_SSH=aur@aur.archlinux.org
|
||||
|
||||
# ensure TERM is set with a fallback to dumb
|
||||
export TERM=${TERM:-dumb}
|
||||
|
||||
# check if messages are to be printed using color
|
||||
if [[ -t 2 && "$TERM" != dumb ]] || [[ ${DEVTOOLS_COLOR} == always ]]; then
|
||||
colorize
|
||||
PURPLE="$(tput setaf 5)"
|
||||
DARK_GREEN="$(tput setaf 2)"
|
||||
UNDERLINE="$(tput smul)"
|
||||
if tput setaf 0 &>/dev/null; then
|
||||
PURPLE="$(tput setaf 5)"
|
||||
DARK_GREEN="$(tput setaf 2)"
|
||||
UNDERLINE="$(tput smul)"
|
||||
else
|
||||
PURPLE="\e[35m"
|
||||
DARK_GREEN="\e[32m"
|
||||
UNDERLINE="\e[4m"
|
||||
fi
|
||||
else
|
||||
# shellcheck disable=2034
|
||||
declare -gr ALL_OFF='' BOLD='' BLUE='' GREEN='' RED='' YELLOW='' PURPLE='' DARK_GREEN='' UNDERLINE=''
|
||||
@@ -108,7 +117,9 @@ cleanup() {
|
||||
if [[ -n ${WORKDIR:-} ]] && $_setup_workdir; then
|
||||
rm -rf "$WORKDIR"
|
||||
fi
|
||||
tput cnorm >&2
|
||||
if tput setaf 0 &>/dev/null; then
|
||||
tput cnorm >&2
|
||||
fi
|
||||
exit "${1:-0}"
|
||||
}
|
||||
|
||||
|
@@ -28,7 +28,9 @@ makepkg_source_package() {
|
||||
export LIBMAKEPKG_SRCINFO_SH=1
|
||||
write_srcinfo() { print_srcinfo; }
|
||||
|
||||
set +e -- -F --source
|
||||
# explicitly instruct makepkg to not sign the source package, even when
|
||||
# the BUILDENV array in makepkg.conf contains 'sign'
|
||||
set +e -- -F --source --nosign
|
||||
# shellcheck source=/usr/bin/makepkg
|
||||
source "$(command -v makepkg)"
|
||||
)
|
||||
|
@@ -49,6 +49,14 @@ pkgctl_version() {
|
||||
pkgctl_version_check "$@"
|
||||
exit $?
|
||||
;;
|
||||
edit)
|
||||
_DEVTOOLS_COMMAND+=" $1"
|
||||
shift
|
||||
# shellcheck source=src/lib/version/edit.sh
|
||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/version/edit.sh
|
||||
pkgctl_version_edit "$@"
|
||||
exit $?
|
||||
;;
|
||||
upgrade)
|
||||
_DEVTOOLS_COMMAND+=" $1"
|
||||
shift
|
||||
|
101
src/lib/version/edit.sh
Normal file
101
src/lib/version/edit.sh
Normal file
@@ -0,0 +1,101 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
[[ -z ${DEVTOOLS_INCLUDE_VERSION_CHECK_SH:-} ]] || return 0
|
||||
DEVTOOLS_INCLUDE_VERSION_CHECK_SH=1
|
||||
|
||||
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
|
||||
# shellcheck source=src/lib/common.sh
|
||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
||||
# shellcheck source=src/lib/util/term.sh
|
||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/term.sh
|
||||
|
||||
source /usr/share/makepkg/util/message.sh
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
|
||||
pkgctl_version_edit_usage() {
|
||||
local -r COMMAND=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
|
||||
cat <<- _EOF_
|
||||
Usage: ${COMMAND} [OPTIONS] [PKGBASE]...
|
||||
|
||||
Compares the versions of packages in the local packaging repository against
|
||||
their latest upstream versions.
|
||||
|
||||
Upon execution, it generates a grouped list that provides detailed insights
|
||||
into each package's status. For each package, it displays the current local
|
||||
version alongside the latest version available upstream.
|
||||
|
||||
Outputs a summary of up-to-date packages, out-of-date packages, and any
|
||||
check failures.
|
||||
|
||||
OPTIONS
|
||||
-h, --help Show this help text
|
||||
|
||||
EXAMPLES
|
||||
$ ${COMMAND} neovim vim
|
||||
_EOF_
|
||||
}
|
||||
|
||||
pkgctl_version_edit() {
|
||||
local pkgbases=()
|
||||
|
||||
local path pkgbase
|
||||
|
||||
while (( $# )); do
|
||||
case $1 in
|
||||
-h|--help)
|
||||
pkgctl_version_edit_usage
|
||||
exit 0
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
die "invalid argument: %s" "$1"
|
||||
;;
|
||||
*)
|
||||
pkgbases=("$@")
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Check if used without pkgbases in a packaging directory
|
||||
if (( ${#pkgbases[@]} == 0 )); then
|
||||
if [[ -f PKGBUILD ]]; then
|
||||
pkgbases=(".")
|
||||
else
|
||||
pkgctl_version_check_usage
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if EDITOR or xdg-open are present
|
||||
if [[ -z ${EDITOR} ]] && ! command -v xdg-open &>/dev/null; then
|
||||
die "The version edit command requires either \$EDITOR or 'xdg-open'"
|
||||
fi
|
||||
|
||||
for path in "${pkgbases[@]}"; do
|
||||
pushd "${path}" >/dev/null
|
||||
|
||||
if [[ ! -f "PKGBUILD" ]]; then
|
||||
die "No PKGBUILD found for ${path}"
|
||||
fi
|
||||
|
||||
if [[ ! -f .nvchecker.toml ]]; then
|
||||
touch .nvchecker.toml
|
||||
fi
|
||||
|
||||
if [[ -n ${EDITOR} ]]; then
|
||||
"${EDITOR}" .nvchecker.toml
|
||||
else
|
||||
xdg-open .nvchecker.toml
|
||||
fi
|
||||
|
||||
popd >/dev/null
|
||||
done
|
||||
}
|
@@ -23,6 +23,7 @@ fi
|
||||
repo=extra
|
||||
arch=x86_64
|
||||
server=build.archlinux.org
|
||||
rsyncopts=(-e ssh -c -h -L --progress --partial -y)
|
||||
|
||||
usage() {
|
||||
cat <<- _EOF_
|
||||
@@ -99,6 +100,7 @@ mapfile -t files < <(
|
||||
# shellcheck disable=SC2145
|
||||
cat "$SRCPKGDEST"/*"$SRCEXT" |
|
||||
ssh $server '
|
||||
export TERM="'"${TERM}"'"
|
||||
temp="${XDG_CACHE_HOME:-$HOME/.cache}/offload-build" &&
|
||||
mkdir -p "$temp" &&
|
||||
temp=$(mktemp -d -p "$temp") &&
|
||||
@@ -114,14 +116,16 @@ mapfile -t files < <(
|
||||
if [[ -f /usr/share/devtools/makepkg.conf.d/'"${repo}"'-'"${arch}"'.conf ]]; then
|
||||
makepkg_config="/usr/share/devtools/makepkg.conf.d/'"${repo}"'-'"${arch}"'.conf"
|
||||
fi &&
|
||||
makepkg --config <(cat "${makepkg_user_config}" "${makepkg_config}" 2>/dev/null) --packagelist &&
|
||||
while read -r file; do
|
||||
[[ -f "${file}" ]] && printf "%s\n" "${file}" ||:
|
||||
done < <(makepkg --config <(cat "${makepkg_user_config}" "${makepkg_config}" 2>/dev/null) --packagelist) &&
|
||||
printf "%s\n" "${temp}/PKGBUILD"
|
||||
')
|
||||
|
||||
|
||||
if (( ${#files[@]} )); then
|
||||
printf '%s\n' '' '-> copying files...'
|
||||
scp "${files[@]/#/$server:}" "${TEMPDIR}/"
|
||||
rsync "${rsyncopts[@]}" "${files[@]/#/$server:}" "${TEMPDIR}/" || die
|
||||
mv "${TEMPDIR}"/*.pkg.tar* "${PKGDEST:-${PWD}}/"
|
||||
mv "${TEMPDIR}/PKGBUILD" "${PWD}/"
|
||||
else
|
||||
|
Reference in New Issue
Block a user