mirror of
				https://gitlab.archlinux.org/archlinux/devtools.git
				synced 2025-11-04 01:34:42 +01:00 
			
		
		
		
	Compare commits
	
		
			15 Commits
		
	
	
		
			refurbish-
			...
			20221012
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					248cdf7ff2 | ||
| 
						 | 
					04a821dddf | ||
| 
						 | 
					d82bc69716 | ||
| 
						 | 
					5d02c6df7f | ||
| 
						 | 
					20f89df443 | ||
| 
						 | 
					fcaf3ecec0 | ||
| 
						 | 
					280ef10d37 | ||
| 
						 | 
					f8d2ad9a7d | ||
| 
						 | 
					2e4060445a | ||
| 
						 | 
					1e23bbc164 | ||
| 
						 | 
					53be0527e2 | ||
| 
						 | 
					f4e8047d65 | ||
| 
						 | 
					70a3041ff8 | ||
| 
						 | 
					ba070f1ca9 | ||
| 
						 | 
					b9dadc5576 | 
							
								
								
									
										7
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
V=20220621
 | 
			
		||||
V=20221012
 | 
			
		||||
BUILDTOOLVER ?= $(V)
 | 
			
		||||
 | 
			
		||||
PREFIX = /usr/local
 | 
			
		||||
@@ -6,6 +6,7 @@ MANDIR = $(PREFIX)/share/man
 | 
			
		||||
BUILDDIR = build
 | 
			
		||||
 | 
			
		||||
BINPROGS = $(addprefix $(BUILDDIR)/,$(patsubst src/%,bin/%,$(patsubst %.in,%,$(wildcard src/*.in))))
 | 
			
		||||
LIBUTILS = $(wildcard lib/*)
 | 
			
		||||
MAKEPKG_CONFIGS=$(wildcard config/makepkg/*)
 | 
			
		||||
PACMAN_CONFIGS=$(wildcard config/pacman/*)
 | 
			
		||||
SETARCH_ALIASES = $(wildcard config/setarch-aliases.d/*)
 | 
			
		||||
@@ -71,13 +72,13 @@ edit = sed -e "s|@pkgdatadir[@]|$(PREFIX)/share/devtools|g"
 | 
			
		||||
GEN_MSG = @echo "GEN $(patsubst $(BUILDDIR)/%,%,$@)"
 | 
			
		||||
 | 
			
		||||
define buildInScript
 | 
			
		||||
$(1)/%: $(2)%.in
 | 
			
		||||
$(1)/%: $(2)%.in $(LIBUTILS)
 | 
			
		||||
	$$(GEN_MSG)
 | 
			
		||||
	@mkdir -p $$(dir $$@)
 | 
			
		||||
	@$(RM) "$$@"
 | 
			
		||||
	@{ echo -n 'm4_changequote([[[,]]])'; cat $$<; } | m4 -P --define=m4_devtools_version=$$(BUILDTOOLVER) | $(edit) >$$@
 | 
			
		||||
	@chmod $(3) "$$@"
 | 
			
		||||
	@bash -O extglob -n "$$@"
 | 
			
		||||
	@bash -n "$$@"
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call buildInScript,build/bin,src/,555))
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,7 @@ m4_include(lib/valid-tags.sh)
 | 
			
		||||
m4_include(lib/valid-repos.sh)
 | 
			
		||||
 | 
			
		||||
_binary_arch=${_arch[*]:0:-1}
 | 
			
		||||
_colors=(never always auto)
 | 
			
		||||
 | 
			
		||||
_archbuild_args=(
 | 
			
		||||
	'-c[Recreate the chroot before building]'
 | 
			
		||||
@@ -47,6 +48,11 @@ _diffpkg_args=(
 | 
			
		||||
	'(-p --pkginfo)'{-p,--pkginfo}'[.PKGINFO diff mode]'
 | 
			
		||||
	'(-b --buildinfo)'{-b,--buildinfo}'[.BUILDINFO diff mode]'
 | 
			
		||||
	'(-m --makepkg-config)'{-m,--makepkg-config}'[Location of a makepkg config file]:makepkg_config:_files -g "*.conf(.)"'
 | 
			
		||||
	'(-u -U --unified)'{-u,-U,--unified}'[Output 3 lines of unified context]'
 | 
			
		||||
	'(-y --side-by-side)'{-y,--side-by-side}'[Output in two columns]'
 | 
			
		||||
	'--color=[Color output]:when:($_colors[*])'
 | 
			
		||||
	'(-W --width=)'{-W,--width=}'[Output at most NUM print columns]:num:(auto columns)'
 | 
			
		||||
	'(-P --pool=)'{-P,--pool=}'[pool directory]:dir:_files -/'
 | 
			
		||||
	'(-v --verbose)'{-v,--verbose}'[Provide more detailed/unfiltered output]'
 | 
			
		||||
	'(-h --help)'{-h,--help}'[Display usage]'
 | 
			
		||||
	'*:packages:_devtools_completions_all_packages'
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ When given one package, use it to diff against the locally built one.
 | 
			
		||||
When given two packages, diff both packages against each other.
 | 
			
		||||
 | 
			
		||||
In either case, a package name will be converted to a filename from the
 | 
			
		||||
cache, and diffpkg will proceed as though this filename was initially
 | 
			
		||||
cache or pool, and diffpkg will proceed as though this filename was initially
 | 
			
		||||
specified.
 | 
			
		||||
 | 
			
		||||
Options
 | 
			
		||||
@@ -30,12 +30,32 @@ Options
 | 
			
		||||
*-M, --makepkg-config*::
 | 
			
		||||
	Set an alternate makepkg configuration file
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
*-P, --pool*='DIR'::
 | 
			
		||||
	Search diff target in pool dir (default `'/srv/ftp/pool'`)
 | 
			
		||||
 | 
			
		||||
*-v, --verbose*::
 | 
			
		||||
	Provide more detailed/unfiltered output
 | 
			
		||||
 | 
			
		||||
*-h, --help*::
 | 
			
		||||
	Show a help text
 | 
			
		||||
 | 
			
		||||
Output Options
 | 
			
		||||
--------------
 | 
			
		||||
 | 
			
		||||
*--color*[='WHEN']::
 | 
			
		||||
	Color output; 'WHEN' is `'never'`, `'always'`, or `'auto'`; Plain *--color* means *--color='auto'*
 | 
			
		||||
 | 
			
		||||
*-u, -U, --unified*::
 | 
			
		||||
	Output 3 lines of unified context
 | 
			
		||||
 | 
			
		||||
*-y, --side-by-side*::
 | 
			
		||||
	Output in two columns
 | 
			
		||||
 | 
			
		||||
*-W, --width*[='NUM']::
 | 
			
		||||
	Output at most 'NUM' (default `'auto'`) print columns; 'NUM' can be `'auto'`, `'columns'` or a number.
 | 
			
		||||
	`'auto'` will be resolved to the maximum line length of both files, guaranteeing the diff to be uncut.
 | 
			
		||||
 | 
			
		||||
Modes
 | 
			
		||||
-----
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -19,8 +19,6 @@ export LANG=C
 | 
			
		||||
export BUILDTOOL=devtools
 | 
			
		||||
export BUILDTOOLVER=m4_devtools_version
 | 
			
		||||
 | 
			
		||||
shopt -s extglob
 | 
			
		||||
 | 
			
		||||
# check if messages are to be printed using color
 | 
			
		||||
if [[ -t 2 && "$TERM" != dumb ]]; then
 | 
			
		||||
	colorize
 | 
			
		||||
@@ -142,12 +140,16 @@ pkgver_equal() {
 | 
			
		||||
find_cached_package() {
 | 
			
		||||
	local searchdirs=("$PWD" "$PKGDEST") results=()
 | 
			
		||||
	local targetname=$1 targetver=$2 targetarch=$3
 | 
			
		||||
	local dir pkg pkgbasename name ver rel arch r results
 | 
			
		||||
	local dir pkg packages pkgbasename name ver rel arch r results
 | 
			
		||||
 | 
			
		||||
	for dir in "${searchdirs[@]}"; do
 | 
			
		||||
		[[ -d $dir ]] || continue
 | 
			
		||||
 | 
			
		||||
		for pkg in "$dir"/*.pkg.tar?(.!(sig|*.*)); do
 | 
			
		||||
		shopt -s extglob nullglob
 | 
			
		||||
		mapfile -t packages < <(printf "%s\n" "$dir"/"${targetname}"-"${targetver}"-*"${targetarch}".pkg.tar?(.!(sig|*.*)))
 | 
			
		||||
		shopt -u extglob nullglob
 | 
			
		||||
 | 
			
		||||
		for pkg in "${packages[@]}"; do
 | 
			
		||||
			[[ -f $pkg ]] || continue
 | 
			
		||||
 | 
			
		||||
			# avoid adding duplicates of the same inode
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,6 @@
 | 
			
		||||
#
 | 
			
		||||
# SPDX-License-Identifier: GPL-3.0-or-later
 | 
			
		||||
 | 
			
		||||
shopt -s extglob
 | 
			
		||||
 | 
			
		||||
m4_include(lib/common.sh)
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
@@ -52,7 +50,7 @@ while (( $# )); do
 | 
			
		||||
			shift
 | 
			
		||||
			break
 | 
			
		||||
			;;
 | 
			
		||||
		-*,--*)
 | 
			
		||||
		-*|--*)
 | 
			
		||||
			die "invalid argument: %s" "$1"
 | 
			
		||||
			;;
 | 
			
		||||
		*)
 | 
			
		||||
 
 | 
			
		||||
@@ -22,8 +22,16 @@ elif [[ -r "$HOME/.makepkg.conf" ]]; then
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
cmd=${0##*/}
 | 
			
		||||
rsyncopts=(-e ssh -p '--chmod=ug=rw,o=r' -c -h -L --progress --partial -y)
 | 
			
		||||
archreleaseopts=()
 | 
			
		||||
 | 
			
		||||
if [[ ! -f PKGBUILD ]]; then
 | 
			
		||||
	die 'No PKGBUILD file'
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
source=()
 | 
			
		||||
# shellcheck source=contrib/makepkg/PKGBUILD.proto
 | 
			
		||||
. ./PKGBUILD
 | 
			
		||||
pkgbase=${pkgbase:-$pkgname}
 | 
			
		||||
 | 
			
		||||
case "$cmd" in
 | 
			
		||||
	commitpkg)
 | 
			
		||||
		if (( $# == 0 )); then
 | 
			
		||||
@@ -39,26 +47,7 @@ case "$cmd" in
 | 
			
		||||
		die 'Usage: commitpkg <reponame> [-f] [-s server] [-l limit] [-a arch] [commit message]'
 | 
			
		||||
		;;
 | 
			
		||||
esac
 | 
			
		||||
while getopts ':l:a:s:f' flag; do
 | 
			
		||||
	case $flag in
 | 
			
		||||
		f) archreleaseopts+=('-f') ;;
 | 
			
		||||
		s) server=$OPTARG ;;
 | 
			
		||||
		l) rsyncopts+=("--bwlimit=$OPTARG") ;;
 | 
			
		||||
		a) commit_arch=$OPTARG ;;
 | 
			
		||||
		:) die "Option requires an argument -- '%s'" "$OPTARG" ;;
 | 
			
		||||
		\?) die "Invalid option -- '%s'" "$OPTARG" ;;
 | 
			
		||||
	esac
 | 
			
		||||
done
 | 
			
		||||
shift $(( OPTIND - 1 ))
 | 
			
		||||
 | 
			
		||||
if [[ ! -f PKGBUILD ]]; then
 | 
			
		||||
	die 'No PKGBUILD file'
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
source=()
 | 
			
		||||
# shellcheck source=contrib/makepkg/PKGBUILD.proto
 | 
			
		||||
. ./PKGBUILD
 | 
			
		||||
pkgbase=${pkgbase:-$pkgname}
 | 
			
		||||
 | 
			
		||||
if (( ${#validpgpkeys[@]} != 0 )); then
 | 
			
		||||
	if [[ -d keys ]]; then
 | 
			
		||||
@@ -99,6 +88,20 @@ if (( ${#needsversioning[*]} )); then
 | 
			
		||||
	(( ${#unversioned[*]} )) && die "%s is not under version control" "${unversioned[@]}"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
rsyncopts=(-e ssh -p '--chmod=ug=rw,o=r' -c -h -L --progress --partial -y)
 | 
			
		||||
archreleaseopts=()
 | 
			
		||||
while getopts ':l:a:s:f' flag; do
 | 
			
		||||
	case $flag in
 | 
			
		||||
		f) archreleaseopts+=('-f') ;;
 | 
			
		||||
		s) server=$OPTARG ;;
 | 
			
		||||
		l) rsyncopts+=("--bwlimit=$OPTARG") ;;
 | 
			
		||||
		a) commit_arch=$OPTARG ;;
 | 
			
		||||
		:) die "Option requires an argument -- '%s'" "$OPTARG" ;;
 | 
			
		||||
		\?) die "Invalid option -- '%s'" "$OPTARG" ;;
 | 
			
		||||
	esac
 | 
			
		||||
done
 | 
			
		||||
shift $(( OPTIND - 1 ))
 | 
			
		||||
 | 
			
		||||
# check packages for validity
 | 
			
		||||
for _arch in "${arch[@]}"; do
 | 
			
		||||
	if [[ -n $commit_arch && ${_arch} != "$commit_arch" ]]; then
 | 
			
		||||
 
 | 
			
		||||
@@ -57,9 +57,14 @@ for _arch in "${arch[@]}"; do
 | 
			
		||||
	fi
 | 
			
		||||
	for _pkgname in "${pkgname[@]}"; do
 | 
			
		||||
		fullver=$(get_full_version "$_pkgname")
 | 
			
		||||
		pkgpath="/srv/ftp/$source_repo/os/$repo_arch/$_pkgname-$fullver-${_arch}.pkg.tar.*"
 | 
			
		||||
		pkgpath="/srv/ftp/${source_repo}/os/${repo_arch}/${_pkgname}-${fullver}-${_arch}.pkg.tar.*"
 | 
			
		||||
		debugpath="/srv/ftp/${source_repo}-debug/os/${repo_arch}/${_pkgname}-debug-${fullver}-${_arch}.pkg.tar.*"
 | 
			
		||||
		# Fail if $pkgpath doesn't match but keep $debugpath optional
 | 
			
		||||
		# shellcheck disable=2029
 | 
			
		||||
		ssh "$server" "cp $pkgpath staging/$target_repo" || die
 | 
			
		||||
		ssh "${server}" "bash -c '
 | 
			
		||||
			install ${pkgpath} -Dt staging/${target_repo} &&
 | 
			
		||||
			(install ${debugpath} -Dt staging/${target_repo} 2>/dev/null || true)
 | 
			
		||||
		'" || die
 | 
			
		||||
	done
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										139
									
								
								src/diffpkg.in
									
									
									
									
									
								
							
							
						
						
									
										139
									
								
								src/diffpkg.in
									
									
									
									
									
								
							@@ -2,8 +2,6 @@
 | 
			
		||||
#
 | 
			
		||||
# SPDX-License-Identifier: GPL-3.0-or-later
 | 
			
		||||
 | 
			
		||||
shopt -s extglob
 | 
			
		||||
 | 
			
		||||
m4_include(lib/common.sh)
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
@@ -24,9 +22,18 @@ usage() {
 | 
			
		||||
 | 
			
		||||
		OPTIONS
 | 
			
		||||
		    -M, --makepkg-config Set an alternate makepkg configuration file
 | 
			
		||||
		    -P, --pool=DIR       Search diff target in pool dir (default '/srv/ftp/pool')
 | 
			
		||||
		    -v, --verbose        Provide more detailed/unfiltered output
 | 
			
		||||
		    -h, --help           Show this help text
 | 
			
		||||
 | 
			
		||||
		OUTPUT OPTIONS
 | 
			
		||||
		    --color[=WHEN]       Color output; WHEN is 'never', 'always', or 'auto';
 | 
			
		||||
		                         Plain --color means --color='auto'
 | 
			
		||||
		    -u, -U, --unified    Output 3 lines of unified context
 | 
			
		||||
		    -y, --side-by-side   Output in two columns
 | 
			
		||||
		    -W, --width=NUM      Output at most NUM (default 'auto') print columns
 | 
			
		||||
		                         NUM can be 'auto', 'columns' or a number
 | 
			
		||||
 | 
			
		||||
		MODES
 | 
			
		||||
		    -l, --list           Activate content list diff mode (default)
 | 
			
		||||
		    -d, --diffoscope     Activate diffoscope diff mode
 | 
			
		||||
@@ -36,12 +43,19 @@ _EOF_
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MAKEPKG_CONF=/etc/makepkg.conf
 | 
			
		||||
POOLDIR=/srv/ftp/pool
 | 
			
		||||
 | 
			
		||||
VERBOSE=0
 | 
			
		||||
TARLIST=0
 | 
			
		||||
DIFFOSCOPE=0
 | 
			
		||||
PKGINFO=0
 | 
			
		||||
BUILDINFO=0
 | 
			
		||||
 | 
			
		||||
DIFFMODE=--side-by-side
 | 
			
		||||
DIFFCOLOR=--color=auto
 | 
			
		||||
DIFFWIDTH=--width=auto
 | 
			
		||||
DIFFOPTIONS=(--expand-tabs)
 | 
			
		||||
 | 
			
		||||
# option checking
 | 
			
		||||
while (( $# )); do
 | 
			
		||||
	case $1 in
 | 
			
		||||
@@ -50,6 +64,7 @@ while (( $# )); do
 | 
			
		||||
			exit 0
 | 
			
		||||
			;;
 | 
			
		||||
		-M|--makepkg-config)
 | 
			
		||||
			(( $# <= 1 )) && die "missing argument for %s" "$1"
 | 
			
		||||
			MAKEPKG_CONF="$2"
 | 
			
		||||
			shift 2
 | 
			
		||||
			;;
 | 
			
		||||
@@ -73,11 +88,50 @@ while (( $# )); do
 | 
			
		||||
			VERBOSE=1
 | 
			
		||||
			shift
 | 
			
		||||
			;;
 | 
			
		||||
		-u|-U|--unified)
 | 
			
		||||
			DIFFMODE=--unified
 | 
			
		||||
			shift
 | 
			
		||||
			;;
 | 
			
		||||
		-y|--side-by-side)
 | 
			
		||||
			DIFFMODE=--side-by-side
 | 
			
		||||
			shift
 | 
			
		||||
			;;
 | 
			
		||||
		--color|--color=*)
 | 
			
		||||
			if [[ $2 == never || $2 == always || $2 == auto ]]; then
 | 
			
		||||
				DIFFCOLOR="--color=$2"
 | 
			
		||||
				shift 2
 | 
			
		||||
				continue
 | 
			
		||||
			fi
 | 
			
		||||
			if [[ $1 == --color ]]; then
 | 
			
		||||
				DIFFCOLOR="--color=auto"
 | 
			
		||||
			else
 | 
			
		||||
				DIFFCOLOR="$1"
 | 
			
		||||
			fi
 | 
			
		||||
			shift
 | 
			
		||||
			;;
 | 
			
		||||
		-W|--width)
 | 
			
		||||
			(( $# <= 1 )) && die "missing argument for %s" "$1"
 | 
			
		||||
			DIFFWIDTH="--width=$2"
 | 
			
		||||
			shift 2
 | 
			
		||||
			;;
 | 
			
		||||
		--width=*)
 | 
			
		||||
			DIFFWIDTH="$1"
 | 
			
		||||
			shift
 | 
			
		||||
			;;
 | 
			
		||||
		-P|--pool)
 | 
			
		||||
			(( $# <= 1 )) && die "missing argument for %s" "$1"
 | 
			
		||||
			POOLDIR="$2"
 | 
			
		||||
			shift 2
 | 
			
		||||
			;;
 | 
			
		||||
		--pool=*)
 | 
			
		||||
			POOLDIR="${1#*=}"
 | 
			
		||||
			shift
 | 
			
		||||
			;;
 | 
			
		||||
		--)
 | 
			
		||||
			shift
 | 
			
		||||
			break
 | 
			
		||||
			;;
 | 
			
		||||
		-*,--*)
 | 
			
		||||
		-*|--*)
 | 
			
		||||
			die "invalid argument: %s" "$1"
 | 
			
		||||
			;;
 | 
			
		||||
		*)
 | 
			
		||||
@@ -86,6 +140,22 @@ while (( $# )); do
 | 
			
		||||
	esac
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
# Set options based on flags or magic values
 | 
			
		||||
if (( VERBOSE )); then
 | 
			
		||||
	if [[ $DIFFMODE == --unified ]]; then
 | 
			
		||||
		DIFFMODE="--unified=99999"
 | 
			
		||||
	fi
 | 
			
		||||
else
 | 
			
		||||
	DIFFOPTIONS+=(--suppress-common-lines)
 | 
			
		||||
fi
 | 
			
		||||
if [[ $DIFFWIDTH == --width=columns ]]; then
 | 
			
		||||
	DIFFWIDTH="--width=${COLUMNS:-130}"
 | 
			
		||||
fi
 | 
			
		||||
if [[ $DIFFWIDTH != --width=auto ]]; then
 | 
			
		||||
	DIFFOPTIONS+=("${DIFFWIDTH}")
 | 
			
		||||
fi
 | 
			
		||||
DIFFOPTIONS+=("${DIFFMODE}" "${DIFFCOLOR}")
 | 
			
		||||
 | 
			
		||||
if ! (( DIFFOSCOPE || TARLIST || PKGINFO || BUILDINFO )); then
 | 
			
		||||
	TARLIST=1
 | 
			
		||||
fi
 | 
			
		||||
@@ -120,6 +190,19 @@ tar_list() {
 | 
			
		||||
	fi | sort
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
file_line_length() {
 | 
			
		||||
	path="$1"
 | 
			
		||||
	wc -L "${path}" | tail -n1 | sed -E 's/^ +//g' | cut -d' ' -f1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
file_diff_columns() {
 | 
			
		||||
	file1="$1"
 | 
			
		||||
	file2="$2"
 | 
			
		||||
	file1_length=$(file_line_length "$file1")
 | 
			
		||||
	file2_length=$(file_line_length "$file2")
 | 
			
		||||
	echo $(( file1_length + file2_length + 3 ))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
diff_pkgs() {
 | 
			
		||||
	local oldpkg newpkg
 | 
			
		||||
	oldpkg=$(readlink -m "$1")
 | 
			
		||||
@@ -128,29 +211,40 @@ diff_pkgs() {
 | 
			
		||||
	[[ -f $oldpkg ]] || die "No such file: %s" "${oldpkg}"
 | 
			
		||||
	[[ -f $newpkg ]] || die "No such file: %s" "${newpkg}"
 | 
			
		||||
 | 
			
		||||
	if (( TARLIST )); then
 | 
			
		||||
		tar_list "$oldpkg" > "$TMPDIR/filelist-old"
 | 
			
		||||
		tar_list "$newpkg" > "$TMPDIR/filelist"
 | 
			
		||||
	DIFFOPTIONS+=(--label "${oldpkg}" --label "${newpkg}")
 | 
			
		||||
 | 
			
		||||
		sdiff -s "$TMPDIR/filelist-old" "$TMPDIR/filelist"
 | 
			
		||||
	if (( TARLIST )); then
 | 
			
		||||
		tar_list "$oldpkg" > "$TMPDIR/old"
 | 
			
		||||
		tar_list "$newpkg" > "$TMPDIR/new"
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if (( PKGINFO )); then
 | 
			
		||||
		bsdtar xOqf "$oldpkg" .PKGINFO > "$TMPDIR/pkginfo-old"
 | 
			
		||||
		bsdtar xOqf "$newpkg" .PKGINFO > "$TMPDIR/pkginfo"
 | 
			
		||||
 | 
			
		||||
		sdiff -s "$TMPDIR/pkginfo-old" "$TMPDIR/pkginfo"
 | 
			
		||||
		bsdtar xOqf "$oldpkg" .PKGINFO > "$TMPDIR/old"
 | 
			
		||||
		bsdtar xOqf "$newpkg" .PKGINFO > "$TMPDIR/new"
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if (( BUILDINFO )); then
 | 
			
		||||
		bsdtar xOqf "$oldpkg" .BUILDINFO > "$TMPDIR/buildinfo-old"
 | 
			
		||||
		bsdtar xOqf "$newpkg" .BUILDINFO > "$TMPDIR/buildinfo"
 | 
			
		||||
		bsdtar xOqf "$oldpkg" .BUILDINFO > "$TMPDIR/old"
 | 
			
		||||
		bsdtar xOqf "$newpkg" .BUILDINFO > "$TMPDIR/new"
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
		sdiff -s "$TMPDIR/buildinfo-old" "$TMPDIR/buildinfo"
 | 
			
		||||
	if (( TARLIST || PKGINFO || BUILDINFO )); then
 | 
			
		||||
		# Resolve dynamic auto width one we know the content to diff
 | 
			
		||||
		if [[ $DIFFWIDTH == --width=auto ]]; then
 | 
			
		||||
			AUTOLENGTH=$(file_diff_columns "$TMPDIR/old" "$TMPDIR/new")
 | 
			
		||||
			DIFFOPTIONS+=("--width=${AUTOLENGTH}")
 | 
			
		||||
		fi
 | 
			
		||||
 | 
			
		||||
		# Print a header for side-by-side view as it lacks labels
 | 
			
		||||
		if [[ $DIFFMODE == --side-by-side ]]; then
 | 
			
		||||
			printf -- "--- %s\n+++ %s\n" "${oldpkg}" "${newpkg}"
 | 
			
		||||
		fi
 | 
			
		||||
 | 
			
		||||
		diff "${DIFFOPTIONS[@]}" "$TMPDIR/old" "$TMPDIR/new"
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if (( DIFFOSCOPE )); then
 | 
			
		||||
		diffoscope "$oldpkg" "$newpkg"
 | 
			
		||||
		diffoscope "${DIFFCOLOR/--color/--text-color}" "$oldpkg" "$newpkg"
 | 
			
		||||
	fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -169,8 +263,19 @@ fetch_pkg() {
 | 
			
		||||
			pkg=$1 ;;
 | 
			
		||||
	esac
 | 
			
		||||
 | 
			
		||||
	[[ -n $pkgurl ]] || pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$pkg") ||
 | 
			
		||||
		die "Couldn't download previous package for %s." "$pkg"
 | 
			
		||||
	if [[ -z ${pkgurl} ]]; then
 | 
			
		||||
		# Try to find latest package in pool dir
 | 
			
		||||
		if [[ -d ${POOLDIR} ]]; then
 | 
			
		||||
			shopt -s extglob nullglob
 | 
			
		||||
			pkgurl=$(printf "%s\n" "${POOLDIR}"/*/"${_pkgname}"-!(*-*)-!(*-*)-!(*-*).pkg.tar!(*.sig)|sort -Vr|head -1)
 | 
			
		||||
			shopt -u extglob nullglob
 | 
			
		||||
		fi
 | 
			
		||||
		# Search via pacman database if no pool file exists
 | 
			
		||||
		if [[ ! -f ${pkgurl} ]]; then
 | 
			
		||||
			pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$pkg") ||
 | 
			
		||||
				die "Couldn't download previous package for %s." "$pkg"
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	pkg=${pkgurl##*/}
 | 
			
		||||
	pkgdest=$(mktemp -t -d "${pkg}-XXXXXX")/${pkg}
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,6 @@
 | 
			
		||||
m4_include(lib/common.sh)
 | 
			
		||||
 | 
			
		||||
set -e
 | 
			
		||||
shopt -s extglob
 | 
			
		||||
 | 
			
		||||
IGNORE_INTERNAL=0
 | 
			
		||||
 | 
			
		||||
@@ -43,7 +42,9 @@ fi
 | 
			
		||||
 | 
			
		||||
process_sofile() {
 | 
			
		||||
	# extract the library name: libfoo.so
 | 
			
		||||
	shopt -s extglob nullglob
 | 
			
		||||
	soname="${sofile%.so?(+(.+([0-9])))}".so
 | 
			
		||||
	shopt -u extglob nullglob
 | 
			
		||||
	# extract the major version: 1
 | 
			
		||||
	soversion="${sofile##*\.so\.}"
 | 
			
		||||
	if [[ "$soversion" = "$sofile" ]] && ((IGNORE_INTERNAL)); then
 | 
			
		||||
 
 | 
			
		||||
@@ -311,13 +311,14 @@ fi
 | 
			
		||||
# Pass all arguments after -- right to makepkg
 | 
			
		||||
makepkg_args+=("${@:$OPTIND}")
 | 
			
		||||
 | 
			
		||||
# See if -R or -e was passed to makepkg
 | 
			
		||||
# See if -R, -e or -A was passed to makepkg
 | 
			
		||||
for arg in "${@:$OPTIND}"; do
 | 
			
		||||
	case ${arg%%=*} in
 | 
			
		||||
		--skip*|--holdver) verifysource_args+=("$arg") ;;
 | 
			
		||||
		--skip*|--holdver|--ignorearch) verifysource_args+=("$arg") ;;
 | 
			
		||||
		--repackage|--noextract) keepbuilddir=1 ;;
 | 
			
		||||
		--*) ;;
 | 
			
		||||
		-*R*|-*e*) keepbuilddir=1 ;;
 | 
			
		||||
		-*A*) verifysource_args+=(-A) ;;&
 | 
			
		||||
		-*R*|-*e*) keepbuilddir=1 ;;&
 | 
			
		||||
	esac
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user