FreeBSD Bugzilla – Attachment 136028 Details for
Bug 181077
[patch] ports-mgmt/pkg_replace support pkgng
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 9.82 KB, created by
Ken DEGUCHI
on 2013-08-06 03:30:00 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Ken DEGUCHI
Created:
2013-08-06 03:30:00 UTC
Size:
9.82 KB
patch
obsolete
>--- sbin/pkg_replace/pkg_replace.sh.orig 2007-01-25 21:55:46.000000000 +0900 >+++ sbin/pkg_replace/pkg_replace.sh 2013-05-31 04:13:29.000000000 +0900 >@@ -125,14 +125,27 @@ > : ${PACKAGEROOT="ftp://ftp.NetBSD.org"} > : ${PKG_SUFX=".tgz"} > #else >+ : ${use_pkgng="`/usr/bin/make -f/usr/share/mk/bsd.port.mk -V WITH_PKGNG`"} >+ if [ "x${use_pkgng}" = "xdevel" ]; then >+ use_pkgng="yes" >+ fi > : ${PORTSDIR="/usr/ports"} >+ if is_yes ${use_pkgng}; then >+ : ${PKGREPOSITORY="/var/cache/pkg/All"} >+ else > : ${PKGREPOSITORY="${PORTSDIR}/packages/All"} >+ fi > #ifdef WITH_OPENBSD > : ${PACKAGEROOT="ftp://ftp.OpenBSD.org"} > : ${PKG_SUFX=".tgz"} > #else >+ if is_yes ${use_pkgng}; then >+ : ${PACKAGEROOT="http://pkgbeta.FreeBSD.org"} >+ : ${PKG_SUFX=".txz"} >+ else > : ${PACKAGEROOT="ftp://ftp.FreeBSD.org"} > : ${PKG_SUFX=".tbz"} >+ fi > #endif > #endif > : ${PKG_BACKUP_DIR=${PKGREPOSITORY}} >@@ -152,10 +165,18 @@ > } > > init_pkgtools() { >+ if is_yes ${use_pkgng}; then >+ PKG_ADD="pkg add" >+ PKG_CREATE="pkg create" >+ PKG_DELETE="pkg delete" >+ PKG_INFO="pkg info" >+ PKG_SET="pkg set" >+ else > PKG_ADD="pkg_add" > PKG_CREATE="pkg_create" > PKG_DELETE="pkg_delete" > PKG_INFO="pkg_info" >+ fi > MAKE="@MAKE@" > } > >@@ -213,7 +234,7 @@ > expand_path 'file' "${p##*=}" > file_exist "${file}" || continue > p=${p%=*} ;; >- *.t[bg]z) >+ *.t[bgx]z) > expand_path 'file' "$p" > get_pkgname_for_binary 'p' "${file}" || continue > p=${p%-*} ;; >@@ -423,6 +444,7 @@ > file_exist "$2" || return 1 > > case $2 in >+ *.txz) _opt=J ;; > *.tbz) _opt=j ;; > *.tgz) _opt=z ;; > *) return 1 ;; >@@ -434,6 +456,7 @@ > #ifdef WITH_OPENBSD > X=`@TAR@ x${_opt}f "$2" -O "+CONTENTS" | > #else >+ is_yes ${use_pkgng} && X=`${PKG_INFO} -F "$2"` || > X=`@TAR@ x${_opt}f "$2" -O --fast-read "+CONTENTS" | > #endif > #endif >@@ -467,6 +490,11 @@ > done < "${PKG_DBDIR}/$2/+BUILD_INFO" > fi > #else >+ if is_yes ${use_pkgng}; then >+ X=`${PKG_INFO} -qo $2` >+ eval $1=\$X >+ return 0 >+ fi > if [ -r "${PKG_DBDIR}/$2/+CONTENTS" ]; then > while read X; do > case $X in >@@ -488,7 +516,11 @@ > } > > set_pkg_vars() { >+ if is_yes ${use_pkgng}; then >+ ${PKG_INFO} -e $1 || return 1 >+ else > [ -d "${PKG_DBDIR}/$1" ] || return 1 >+ fi > > pkg_name=$1 > pkg_pkgdir=${PKG_DBDIR}/$1 >@@ -526,10 +558,27 @@ > > for _arg in ${1+"$@"}; do > _pattern=${_arg#${PKG_DBDIR}/} >+ if is_yes ${use_pkgng}; then >+ for p in `${PKG_INFO} -g "${_pattern}" 2>/dev/null`; do >+ if is_yes ${opt_depends}; then >+ pkg_depends '_deps' "$p" >+ eval ${_var}=\"\$${_var} \${_deps}\" >+ fi >+ >+ eval ${_var}=\"\$${_var} \$p\" > >+ if is_yes ${opt_required_by}; then >+ pkg_required_by '_req_by' "$p" >+ eval ${_var}=\"\$${_var} \${_req_by}\" >+ fi >+ done >+ if [ -z "${pkgs}" ]; then >+ warn "No such installed package: ${_arg}" >+ fi >+ else > case ${_pattern} in >- *\**|*-pl[0-9]*|*-[0-9]*[0-9.][a-z]|*-[0-9]*[0-9]) ;; >- *) _pattern="${_pattern}-[0-9]*[0-9a-z]" ;; >+ *\**|*-[0-9]*|*-[brv.][0-9]*|*-a.[0-9]*|*-pl[0-9]*|*-b.r[0-9]*|*-cr.[a-z]*) ;; >+ *) _pattern="${_pattern}-[0-9]*[0-9a-zA-Z]" ;; > esac > > for p in ${PKG_DBDIR}/${_pattern}/+CONTENTS; do >@@ -552,6 +601,7 @@ > warn "No such installed package: ${_arg}" > fi > done >+ fi > done > > set -f >@@ -568,6 +618,12 @@ > done < "${PKG_DBDIR}/$2/+REQUIRING" > fi > #else >+ if is_yes ${use_pkgng}; then >+ X=`${PKG_INFO} -qd $2` >+ eval $1=\"\${X}\" >+ return 0 >+ fi >+ > if [ -r "${PKG_DBDIR}/$2/+CONTENTS" ]; then > while read X; do > case $X in >@@ -588,6 +644,12 @@ > pkg_required_by() { > local X > >+ if is_yes ${use_pkgng}; then >+ X=`${PKG_INFO} -qr $2` >+ eval $1=\"\$X\" >+ return 0 >+ fi >+ > eval $1= > if [ -r "${PKG_DBDIR}/$2/+REQUIRED_BY" ]; then > while read X; do >@@ -597,7 +659,7 @@ > } > > pkg_sort() { >- local p _var _sorted _unsorted _arg _deps >+ local p _var _sorted _unsorted _arg _deps _deplist > > _var=$1; shift > _sorted= >@@ -612,7 +674,13 @@ > *" ${_arg} "*) continue ;; > esac > >- if [ -s "${PKG_DBDIR}/${_arg}/+REQUIRED_BY" ]; then >+ _deplist= >+ if is_yes ${use_pkgng}; then >+ _deplist=`${PKG_INFO} -qr ${_arg}` >+ else >+ _deplist="${PKG_DBDIR}/${_arg}/+REQUIRED_BY" >+ fi >+ if [ -s "${_deplist}" ]; then > pkg_depends '_deps' "${_arg}" > > for p in ${_deps}; do >@@ -757,9 +825,11 @@ > info "Installing '$1'" > > case $1 in >- *.t[bg]z) >+ *.t[bgx]z) > is_yes ${opt_force} && install_args="-f" >+ if ! is_yes ${use_pkgng}; then > is_yes ${opt_verbose} && install_args="${install_args} -v" >+ fi > > xtry "${2-}" ${PKG_ADD} ${install_args} "$1" || return 1 > ;; >@@ -795,7 +865,11 @@ > > deinstall_args= > is_yes ${opt_force} && deinstall_args="-f" >+ if is_yes ${use_pkgng}; then >+ deinstall_args="${deinstall_args} -y" >+ else > is_yes ${opt_verbose} && deinstall_args="${deinstall_args} -v" >+ fi > > #ifdef WITH_PKGSRC > if [ -e "${PKG_DBDIR}/$1/+PRESERVE" ]; then >@@ -915,7 +989,11 @@ > *) subdir="${OS_MAJOR}-stable" ;; > esac > >+ if is_yes ${use_pkgng}; then >+ uri_path=/freebsd-${OS_MAJOR}-${ARCH}/latest/All/ >+ else > uri_path="/pub/FreeBSD/ports/${ARCH}/packages-${subdir}/All/" >+ fi > #endif > #endif > uri="${PACKAGEROOT}${uri_path}${pkg}" >@@ -987,7 +1065,11 @@ > return 1 > fi > #else >+ if is_yes ${use_pkgng}; then >+ try ${PKG_CREATE} -f ${PKG_SUFX} -o "${2%/*}" "$1" || return 1 >+ else > try ${PKG_CREATE} -b "$1" "$2" || return 1 >+ fi > #endif > #endif > } >@@ -1031,12 +1113,17 @@ > } > > preserve_libs() { >- local file >+ local file pkg_info_opts > > is_yes ${opt_preserve_libs} || return 0 > >+ if is_yes ${use_pkgng}; then >+ pkg_info_opts='-ql' >+ else >+ pkg_info_opts='-qL' >+ fi > preserved_files= >- for file in $(${PKG_INFO} -qL "$1"); do >+ for file in $(${PKG_INFO} ${pkg_info_opts} "$1"); do > case ${file##*/} in > lib*.so.[0-9]*) > if [ -f "${file}" ]; then >@@ -1080,20 +1167,30 @@ > fix_dependencies() { > #ifndef WITH_PKGSRC > #ifndef WITH_OPENBSD >- local p deps newdep opt_depends opt_required_by >+ local p deps newdep opt_depends opt_required_by dep_installed > > opt_depends=NO > opt_required_by=NO > pkg_depends 'deps' "$1" > > for p in ${deps}; do >- if [ ! -d "${PKG_DBDIR}/$p" ]; then >+ dep_installed=no >+ if is_yes ${use_pkgng}; then >+ ${PKG_INFO} -e $p && dep_installed=yes || dep_installed=no >+ else >+ [ -d "${PKG_DBDIR}/$p" ] && dep_installed=yes || dep_installed=no >+ fi >+ if ! is_yes ${dep_installed}; then > pkg_glob 'newdep' "${p%-*}" 2>/dev/null > > if empty ${newdep}; then > warn "'$1' depends on '$p', but it is NOT installed!" > else >+ if is_yes ${use_pkgng}; then >+ ${PKG_SET} -y -o `${PKG_INFO} -qo $1`:`${PKG_INFO} -qo $p` || return 1 >+ else > update_pkgdep "$1" "$p" "${newdep##* }" || return 1 >+ fi > fi > fi > done >@@ -1102,6 +1199,11 @@ > } > > update_dependencies() { >+ if is_yes ${use_pkgng}; then >+ info "Updating the dependencies" >+ ${PKG_SET} -y -o $1:$2 || return 1 >+ info " $1 -> $2" >+ else > local p req_by > > pkg_required_by 'req_by' "$2" >@@ -1114,6 +1216,7 @@ > update_pkgdep "$p" "$1-[^-]*" "$2" || return 1 > done > fi >+ fi > } > > have_pkgdep() { >@@ -1122,7 +1225,7 @@ > if [ -r "${PKG_DBDIR}/$1/+CONTENTS" ]; then > while read X; do > case $X in >- @pkgdep\ $2-[0-9]*|@pkgdep\ $2-pl[0-9]*) >+ @pkgdep\ $2-[0-9]*|@pkgdep\ $2-[brv.][0-9]*|@pkgdep\ $2-a.[0-9]*|@pkgdep\ $2-pl[0-9]*|@pkgdep\ $2-b.r[0-9]*|@pkgdep\ $2-cr.[a-z]*) > return 0 ;; > [!@]*) break ;; > esac >@@ -1134,7 +1237,7 @@ > > update_pkgdep() { > update_file "${PKG_DBDIR}/$1/+CONTENTS" \ >- "s/^@pkgdep $2\$/@pkgdep $3/" || return 1 >+ "/^@pkgdep $2\$/,/^@comment DEPORIGIN:/ { s|^@pkgdep $2\$|@pkgdep $3|; s|^@comment DEPORIGIN:.*\$|@comment DEPORIGIN:${pkg_origin}|; }" || return 1 > } > > delete_pkgdep() { >@@ -1325,7 +1428,7 @@ > > init_install() { > case $1 in >- *.t[bg]z) >+ *.t[bgx]z) > set_pkg_vars_for_binary "$1" || return 1 ;; > /*) set_port_vars "$1" || return 1 ;; > *) set_port_vars "${PORTSDIR}/$1" || return 1 ;; >@@ -1351,7 +1454,7 @@ > done > > case ${replace_with} in >- *.t[bg]z) >+ *.t[bgx]z) > pkg_binary=${replace_with} ;; > ?*) > pkg_portdir=${replace_with} >@@ -1428,6 +1531,12 @@ > do_replace() { > local pkg_log pkg_tmpdir old_package old_required_by preserved_files > >+ if is_yes ${use_pkgng}; then >+ local old_origin new_origin >+ old_origin= >+ new_origin= >+ fi >+ > init_replace "$1" || { status=skipped; return 0; } > > if [ "${cur_pkg_name}" != "${pkg_name}" ]; then >@@ -1482,7 +1591,9 @@ > fi > > pkg_tmpdir="${tmpdir}/${cur_pkg_name}" >+ if ! is_yes ${use_pkgng}; then > old_required_by="${pkg_tmpdir}/+REQUIRED_BY" >+ fi > > if ! find_package 'old_package' "${cur_pkg_name}"; then > old_package="${pkg_tmpdir}/${cur_pkg_name}${PKG_SUFX}" >@@ -1491,7 +1602,11 @@ > if ! { > create_dir "${pkg_tmpdir}" && > backup_package "${cur_pkg_name}" "${old_package}" && >- backup_file "${cur_pkg_pkgdir}/+REQUIRED_BY" "${old_required_by}" && >+ if is_yes ${use_pkgng}; then >+ old_origin=`${PKG_INFO} -qo ${cur_pkg_name}` || return 1 >+ else >+ backup_file "${cur_pkg_pkgdir}/+REQUIRED_BY" "${old_required_by}" >+ fi && > preserve_libs "${cur_pkg_name}" > }; then > log="backup error" >@@ -1503,6 +1618,9 @@ > if install_package "${pkg_binary:-${pkg_portdir}}" "${pkg_log}"; then > status=done > cur_pkg_pkgdir=${PKG_DBDIR}/${pkg_name} >+ if is_yes ${use_pkgng}; then >+ new_origin=`${PKG_INFO} -qo ${pkg_name}` >+ fi > else > log="install error" > restore_package "${old_package}" || { >@@ -1515,8 +1633,10 @@ > log="deinstall error" > fi > >+ if ! is_yes ${use_pkgng}; then > restore_file "${old_required_by}" "${cur_pkg_pkgdir}/+REQUIRED_BY" || > warn "Failed to restore the +REQUIRED_BY file." >+ fi > process_package "${old_package}" || > warn "Failed to keep the old version." > clean_libs || >@@ -1527,7 +1647,11 @@ > case ${status} in > done) > fix_dependencies "${pkg_name}" || return 1 >- update_dependencies "${cur_pkg_name%-*}" "${pkg_name}" || return 1 ;; >+ if is_yes ${use_pkgng}; then >+ update_dependencies "${old_origin}" "${new_origin}" || return 1 >+ else >+ update_dependencies "${cur_pkg_name%-*}" "${pkg_name}" || return 1 >+ fi ;; > *) > return 1 ;; > esac
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 181077
: 136028