-
Notifications
You must be signed in to change notification settings - Fork 8
/
pkgdiff-mg
executable file
·97 lines (90 loc) · 2.39 KB
/
pkgdiff-mg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env bash
# diff sources unpacked by two ebuilds (works only for simple ebuilds)
# (c) 2019-2024 Michał Górny <[email protected]>
# SPDX-License-Identifier: GPL-2.0-or-later
set -e -x
mode=default
while [[ ${#} -gt 0 ]]; do
case ${1} in
--all|-a)
mode=
;;
--build-system|-b)
mode=build-system
;;
*)
break
;;
esac
shift
done
get_category() {
local dir=.
[[ ${1} != */* ]] || dir=${1%/*}
dir=$( cd "${dir}" && pwd )
dir="${dir%/*}"
echo "${dir##*/}"
}
cat1=$(get_category "${1}")
cat2=$(get_category "${2}")
fn1=${1##*/}
fn2=${2##*/}
ver1=$(patom -F '%{fullver}' "=${cat1}/${fn1%.ebuild}")
ver2=$(patom -F '%{fullver}' "=${cat2}/${fn2%.ebuild}")
export PORTAGE_TMPDIR="${TMPDIR:-/tmp}"/mgorny-dev-scripts
export USE="${USE} test"
# use noauto to skip pkg_setup
export FEATURES="${FEATURES} noauto"
# tell ebuilds we don't want everything
mkdir -p "${PORTAGE_TMPDIR}"
PKGBUMPING=${ver1} ebuild "${1}" unpack
PKGBUMPING=${ver2} ebuild "${2}" unpack
s1=$(sed -nr 's/^declare -x S="(.*)"/\1/p' "${PORTAGE_TMPDIR}"/portage/${cat1}/${fn1%.ebuild}/temp/environment)
s2=$(sed -nr 's/^declare -x S="(.*)"/\1/p' "${PORTAGE_TMPDIR}"/portage/${cat2}/${fn2%.ebuild}/temp/environment)
[[ -d ${s1} ]]
[[ -d ${s2} ]]
{
case "${mode}" in
build-system)
find "${s1}" "${s2}" -type f \
! \( \
-name 'configure.ac' -o \
-name '*.m4' -o \
-name 'meson.build' -o \
-name 'meson_options.txt' -o \
-name '*.cmake' -o \
-name 'CMakeLists.txt' -o \
-name 'setup.py' -o \
-name 'setup.cfg' -o \
-name 'pyproject.toml' -o \
-name 'Makefile.PL' -o \
-name 'Build.PL' -o \
-name 'dist.ini' -o \
-name 'META.yml' -o \
-name 'META.json' -o \
-name 'NEWS*' -o \
-name 'CHANGES*' -o \
-name 'Gemfile' -o \
-name 'Gemfile.lock' -o \
-name 'META' -o \
-name '*.opam' -o \
-name 'opam' -o \
-name 'dune' -o \
-name 'dune-project' -o \
-name 'LICENSE*' -o \
-name 'COPYING*' -o \
-name 'SConscript' -o \
-name 'SConstruct' -o \
-name 'Cargo.lock' -o \
-name 'Cargo.toml' \
\) -printf "%f\n"
;;
default)
find "${s1}" "${s2}" -type f \
\( \
-name '*.min.*' -o \
-name 'searchindex.js' \
\) -printf "%f\n"
;;
esac
} | diff --color=always --exclude=".git" --strip-trailing-cr -X - -dupNr "${s1}" "${s2}" | ${PAGER:-less}