diff --git a/please.sh b/please.sh index 8b742a49be..ac9a53e8a3 100755 --- a/please.sh +++ b/please.sh @@ -4532,7 +4532,7 @@ create_sdk_artifact () { # [--out=] [--git-sdk=] [--bitnes case "$1" in minimal|git-sdk-minimal) mode=minimal-sdk;; full) mode=full-sdk;; - minimal-sdk|makepkg-git|build-installers|pacman|full-sdk) mode=$1;; + minimal-sdk|makepkg-git|build-installers|pacman|pacman-full|full-sdk) mode=$1;; *) die "Unhandled artifact: '%s'\n" "$1";; esac @@ -4688,7 +4688,7 @@ create_sdk_artifact () { # [--out=] [--git-sdk=] [--bitnes mkdir -p "$output_path/.sparse" && cp "$sparse_checkout_file" "$output_path/.sparse/build-installers" ;; - pacman) + pacman|pacman-full) # In partial clones, preemptively fetch /var/lib/pacman/local/* if test true = "$(git -C "$git_sdk_path" config remote.origin.promisor)" then @@ -4698,6 +4698,21 @@ create_sdk_artifact () { # [--out=] [--git-sdk=] [--bitnes test $? = 1 # we expect the trees to differ fi && + sparse_checkout_exclude= && + pkgs_exclude= + if test pacman-full != "$mode" + then + # skip documentation + sparse_checkout_exclude='/usr/share/\(doc\|gtc-doc\|info\|man\)/' + # skip headers, terminfo and locales + sparse_checkout_exclude="$sparse_checkout_exclude\|/\(include\|terminfo\|locale\)/" + # skip C++/Fortran libraries (unused) + sparse_checkout_exclude="$sparse_checkout_exclude\|/msys-\(gmpxx\|gnutlsxx\|ncurses++\|stdc++\|gfortran\)[^/]*$" + # skip Cygwin's core dumper (unused) + sparse_checkout_exclude="$sparse_checkout_exclude\|^/usr/bin/dumper\.exe$" + pkgs_exclude='info tcl libasprintf' + fi && + pkg_map=" $(git -C "$git_sdk_path" ls-tree HEAD:var/lib/pacman/local | sed -n 's/^.* \([0-9a-f]*\)\t\(.*\)/\2:\1/p' | # remove the package version @@ -4730,6 +4745,7 @@ create_sdk_artifact () { # [--out=] [--git-sdk=] [--bitnes do arg="${args_remaining%% *}" args_remaining="${args_remaining#$arg }" + case " $pkgs_exclude " in *" $arg "*) continue;; esac test sh != "$arg" || arg=bash case " $deps_tree" in *" $arg "*) continue;; esac # already handled deps_tree="$deps_tree$arg " @@ -4742,17 +4758,19 @@ create_sdk_artifact () { # [--out=] [--git-sdk=] [--bitnes echo "${deps_tree% }" } && pkgs_sparse_checkout () { - printf '# Sparse checkout file for %s\n\n%s\n%s\n%s\n' \ - '# Pacman database' \ + printf '# Sparse checkout file for %s\n\n%s\n%s\n%s\n%s\n' "$*" \ + '# Pacman local state' \ + '/etc/pacman.d/gnupg/' \ '/var/lib/pacman/local/ALPM_DB_VERSION' \ - '/var/lib/pacman/sync/' "$*" && + '/var/lib/pacman/sync/' && echo "Generating dependency tree for $*" >&2 && for pkg in $(pkgs_deps "$@") do printf '\n# %s\n/var/lib/pacman/local/%s-[0-9]*/\n' "$pkg" "$pkg" echo "Generating file list for $pkg" >&2 files="$(pkg_files $pkg)" && - echo "$files" | sed 's/^/\//' || + echo "$files" | sed 's/^/\//' | + grep -v "${sparse_checkout_exclude:-.^}" || die "Could not enumerate files for $pkg" done } &&