Hello. This is an unimportant topic that may or may not be useful and can be skipped :)
Tatsuki Makino wrote on 2023/01/20 17:40: > poudriere: I don't want to rebuild rust with PORTREVISION bump of curl Some of the same kind of stories include :) I don't want to rebuild gcc12 with update of binutils I don't want to rebuild llvm15 with update of python39 And today's will be as follows :) I don't want to rebuild *webkit* with update of sqlite3 As a solution to it... The tools for it were made :) It will have been attached to this email. In this case, it can be used as follows sh the_attachment.sh -d sqlite3-3.41.2,1.pkg qt5-webkit-5.212.0.a4_12.pkg If it is used with multiple files at the same time, I don't know if it is working properly :) sh the_attachment.sh -d sqlite3-3.41.2,1.pkg webkit2-gtk*.pkg I think there are people who can make something better, but for the time being, I will release it as a reference material. :) Regards.
#! /bin/sh #set -x compact_manifest="+COMPACT_MANIFEST" manifest="+MANIFEST" if ! JQ="$(which jq)" ; then echo "textproc/jq must be installed" 1>&2 exit 1 fi usage () { set +x { echo "${0} [-n] [-t tmpdir] -d deppkg pkgfile ..." } 1>&2 exit ${1:-1} } wrkdir="" deppkg="" dryrun="0" sig_exit () { case "${dryrun:-}" in # ( 1) if [ -n "${wrkdir:-}" -a -d "${wrkdir}" ] ; then stat -f "%SN is kept" -- "${wrkdir}" fi ;; # ( *) if [ -n "${wrkdir:-}" -a -d "${wrkdir}" ] ; then rm -r -i -- "${wrkdir}" [ ! -d "${wrkdir}" ] || stat -f "%SN still exists" -- "${wrkdir}" fi ;; esac } builtin trap 'sig_exit' EXIT extract () { local wrkdir local pkgfile pkgfile="${1:-}" shift 1 if [ -z "${pkgfile}" -o ! -f "${pkgfile}" ] ; then usage 1 fi [ -e "${wrkdir}/${compact_manifest}.orig" ] && rm -f -v -- "${wrkdir}/${compact_manifest}.orig" [ -e "${wrkdir}/${manifest}.orig" ] && rm -f -v -- "${wrkdir}/${manifest}.orig" tar -x -v -f "${pkgfile}" -C "${wrkdir}" -- "${compact_manifest}" "${manifest}" install -l as -- "${pkgfile}" "${wrkdir}/src.pkg" } update_deps () { local IFS _i _m wrkdir local deppkg_n deppkg_o deppkg_v deps_json local pkgfile pkg_n_v deppkg pkgfile="${1:-}" shift 1 if [ -z "${pkgfile}" -o ! -f "${pkgfile}" ] ; then usage 1 fi pkg_n_v="$(pkg query -F "${pkgfile}" '%n-%v')" : ${pkg_n_v:=orig} [ ! -e "${wrkdir}/${compact_manifest}.${pkg_n_v}" ] && cp -p -v -- "${wrkdir}/${compact_manifest}" "${wrkdir}/${compact_manifest}.${pkg_n_v}" [ ! -e "${wrkdir}/${manifest}.${pkg_n_v}" ] && cp -p -v -- "${wrkdir}/${manifest}" "${wrkdir}/${manifest}.${pkg_n_v}" echo "${deppkg}" | while IFS=$'\n' read _i do if [ ! -f "${_i}" ] ; then continue 1 fi deppkg_n="$(pkg query -F "${_i}" '%n')" deppkg_o="$(pkg query -F "${_i}" '%o')" deppkg_v="$(pkg query -F "${_i}" '%v')" if [ ${?:--1} -ne 0 ] ; then continue 1 fi for _m in "${wrkdir}/${compact_manifest}" "${wrkdir}/${manifest}" do if ! deps_json="$("${JQ}" -c -j '.deps|keys_unsorted' "${_m}")" ; then continue 1 fi case "${deps_json}" in # ( *\""${deppkg_n}"\"*) "${JQ}" -c -j '.deps|["'"${deppkg_n}"'"]' "${_m}" "${JQ}" -c -j '.deps["'"${deppkg_n}"'"]' "${_m}" echo cat "${_m}" > "${_m}.tmp" #"${JQ}" -c -j '.deps["'"${deppkg_n}"'"].origin|="'"${deppkg_o}"'"' "${_m}.tmp" > "${_m}.tmp.json" #mv -v -- "${_m}.tmp.json" "${_m}.tmp" "${JQ}" -c -j '.deps["'"${deppkg_n}"'"].version|="'"${deppkg_v}"'"' "${_m}.tmp" > "${_m}.tmp.json" mv -v -- "${_m}.tmp.json" "${_m}.tmp" "${JQ}" -c -j '.deps|["'"${deppkg_n}"'"]' "${_m}.tmp" "${JQ}" -c -j '.deps["'"${deppkg_n}"'"]' "${_m}.tmp" echo mv -v -- "${_m}.tmp" "${_m}" ;; # ( *) #echo "${deps_json}" # or new dependency? ;; esac done done } repack () { local wrkdir local pkgfile pkgfile="${1:-}" shift 1 if [ -z "${pkgfile:-}" -o ! \( "${pkgfile}" -ef "${wrkdir}/src.pkg" \) ] ; then { stat -f "%SN%SY" "${pkgfile}" "${wrkdir}"/src.pkg } 1>&2 usage 1 fi touch -t `date -r 0 +%C%y%m%d%H%M.%S` -- "${wrkdir}/${compact_manifest}" "${wrkdir}/${manifest}" chmod a=r,u+w "${wrkdir}/${compact_manifest}" "${wrkdir}/${manifest}" chown 0:0 "${wrkdir}/${compact_manifest}" "${wrkdir}/${manifest}" tar -c -f - --exclude "${compact_manifest}" --exclude "${manifest}" "@${pkgfile}" | tar -c -v -f "${wrkdir}/tmp.pkg" -J -C "${wrkdir}" "${compact_manifest}" "${manifest}" @- chmod `stat -f %Mp%Lp "${pkgfile}"` "${wrkdir}/tmp.pkg" chown `stat -f %u:%g "${pkgfile}"` "${wrkdir}/tmp.pkg" case "${dryrun:-}" in # ( 1) mv -v -- "${wrkdir}/tmp.pkg" "${wrkdir}/$(pkg query -F "${wrkdir}/tmp.pkg" "%n-%v.pkg")" ;; # ( *) mv -v -- "${wrkdir}/tmp.pkg" "${pkgfile}" ;; esac } if ! euid="$(id -u)" || [ 0${euid} -ne 0 ] ; then echo It must be run by root to generate the correct package. fi while [ ${#} -gt 0 ] do OPTIND=1 while getopts 'd:nt:' ch do case "${ch}" in # ( d) deppkg="$(printf "${deppkg:+${deppkg}\n}%s" "${OPTARG}")" ;; # ( n) dryrun="1" ;; # ( t) case "${OPTARG}" in # ( ?*) if [ -d "${OPTARG}" -a -w "${OPTARG}" ] ; then TMPDIR="${OPTARG}" export TMPDIR else usage 1 fi ;; # ( ''|*) unset TMPDIR ;; esac ;; # ( [\?:]|*) ;; esac done unset ch shift $((OPTIND - 1)) if : ; then break 1 fi done if [ -z "${wrkdir:-}" -o ! -d "${wrkdir}" ] ; then if ! wrkdir="$(mktemp -d -t "${0##*/}")" ; then usage 1 fi fi for pkgfile do if [ -z "${pkgfile:-}" -o ! -f "${pkgfile}" ] ; then usage 1 fi extract "${pkgfile}" update_deps "${pkgfile}" repack "${pkgfile}" done