aboutsummaryrefslogtreecommitdiff
path: root/ports-mgmt/pkg_replace
diff options
context:
space:
mode:
authorAlex Kozlov <ak@FreeBSD.org>2013-09-26 18:00:18 +0000
committerAlex Kozlov <ak@FreeBSD.org>2013-09-26 18:00:18 +0000
commit17127fff9678c724517e10c99ca95624186e78b5 (patch)
tree5e5a9331b795dc8092af5cac7bde803cc6a2897a /ports-mgmt/pkg_replace
parentadac9f0c9a3f8101db4180f801a660cadc9cbc5c (diff)
downloadports-17127fff9678c724517e10c99ca95624186e78b5.tar.gz
ports-17127fff9678c724517e10c99ca95624186e78b5.zip
- Support STAGEDIR [1]
- Move pkgng patch outside of ports tree [1] - Fix pattern matching in pkg_glob function [2] - Minor Makefile cleanup PR: ports/182388 [1] PR: ports/182371 (based on) [2] Submitted by: Ken DEGUCHI <kdeguchi@sz.tokoha-u.ac.jp> (maintainer) [1], Iouri Ivliev <ii@any.com.ru> [2]
Notes
Notes: svn path=/head/; revision=328399
Diffstat (limited to 'ports-mgmt/pkg_replace')
-rw-r--r--ports-mgmt/pkg_replace/Makefile31
-rw-r--r--ports-mgmt/pkg_replace/distinfo2
-rw-r--r--ports-mgmt/pkg_replace/files/patch-pkg_replace_pkgng423
-rw-r--r--ports-mgmt/pkg_replace/pkg-plist6
4 files changed, 17 insertions, 445 deletions
diff --git a/ports-mgmt/pkg_replace/Makefile b/ports-mgmt/pkg_replace/Makefile
index bcf7b4a036ff..4712e841b8e5 100644
--- a/ports-mgmt/pkg_replace/Makefile
+++ b/ports-mgmt/pkg_replace/Makefile
@@ -3,45 +3,36 @@
PORTNAME= pkg_replace
PORTVERSION= 0.8.0
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= ports-mgmt
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_JP}
-MASTER_SITE_SUBDIR=portutil/22116
+MASTER_SITE_SUBDIR= portutil/22116
+
+PATCH_SITES= http://member.tokoha-u.ac.jp/~kdeguchi/download/
+PATCHFILES= ${PKGNAME}.patch
MAINTAINER= kdeguchi@sz.tokoha-u.ac.jp
COMMENT= Utility for upgrading installed packages
-USE_BZIP2= YES
+USE_BZIP2= yes
MAKE_ARGS= PREFIX="${PREFIX}" \
PORTSDIR="${PORTSDIR}" PKG_DBDIR="${PKG_DBDIR}"
-MAN1= pkg_replace.1
-MANCOMPRESSED= maybe
-
-OPTIONS_DEFINE= ZSH
+OPTIONS_DEFINE= ZSH
.if empty(WITH_PKGNG)
OPTIONS_DEFINE+= PKGDB_FIX
-PKGDB_FIX_DESC= Fixing tool of installed package dependencies
+PKGDB_FIX_DESC= Fixing tool of installed package dependencies
.else
PLIST_SUB+= PKGDB_FIX="@comment "
.endif
OPTIONS_SUB= yes
-NO_STAGE= yes
-.include <bsd.port.options.mk>
-
-.if ${PORT_OPTIONS:MPKGDB_FIX}
-MAN1+= pkgdb_fix.1
-.endif
-
post-patch:
-.if ${PORT_OPTIONS:MPKGDB_FIX}
@${REINPLACE_CMD} -e 's/pkg_replace/pkg_replace pkgdb_fix/;' ${WRKSRC}/sbin/Makefile
-.endif
-.if !${PORT_OPTIONS:MZSH}
- @${REINPLACE_CMD} -e 's/^ sbin \\$$/ sbin/;s/^ share$$//;' ${WRKSRC}/Makefile
-.endif
+
+pre-install:
+ @${MKDIR} ${STAGEDIR}${PREFIX}/share/zsh/site-functions
.include <bsd.port.mk>
diff --git a/ports-mgmt/pkg_replace/distinfo b/ports-mgmt/pkg_replace/distinfo
index 83a661cbba15..0f1a87660a35 100644
--- a/ports-mgmt/pkg_replace/distinfo
+++ b/ports-mgmt/pkg_replace/distinfo
@@ -1,2 +1,4 @@
SHA256 (pkg_replace-0.8.0.tar.bz2) = 3092f5fc0d18529eb5d38776941c0ee4d0073ecb524ab17671c81ca69c29e214
SIZE (pkg_replace-0.8.0.tar.bz2) = 17296
+SHA256 (pkg_replace-0.8.0_3.patch) = cfa2adb3643a8684281143e4c241b8597510251730657816d68926701615ae98
+SIZE (pkg_replace-0.8.0_3.patch) = 11125
diff --git a/ports-mgmt/pkg_replace/files/patch-pkg_replace_pkgng b/ports-mgmt/pkg_replace/files/patch-pkg_replace_pkgng
deleted file mode 100644
index 437379020d1f..000000000000
--- a/ports-mgmt/pkg_replace/files/patch-pkg_replace_pkgng
+++ /dev/null
@@ -1,423 +0,0 @@
---- sbin/pkg_replace/pkg_replace.sh.orig 2007-01-25 21:55:46.000000000 +0900
-+++ sbin/pkg_replace/pkg_replace.sh 2013-09-03 06:58:43.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
-@@ -715,7 +783,7 @@
- if empty ${_log}; then
- try "$@" || return $?
- else
-- _cookie="${tmpdir}/.$1_failed"
-+ _cookie="${tmpdir}/.${1##*/}_failed"
-
- { try "$@" || echo $? > "${_cookie}"; } | tee -a "${_log}" ||
- warn "tee(1) failed."
-@@ -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"
-+ [ "x$1" = "x$2" ] && return 0 || ${PKG_SET} -y -o $1:$2
-+ 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
diff --git a/ports-mgmt/pkg_replace/pkg-plist b/ports-mgmt/pkg_replace/pkg-plist
index 292df631b1fb..fc930a45a2ce 100644
--- a/ports-mgmt/pkg_replace/pkg-plist
+++ b/ports-mgmt/pkg_replace/pkg-plist
@@ -1,6 +1,8 @@
+etc/pkg_replace.conf.sample
+man/man1/pkg_replace.1.gz
sbin/pkg_replace
+%%PKGDB_FIX%%man/man1/pkgdb_fix.1.gz
%%PKGDB_FIX%%sbin/pkgdb_fix
-etc/pkg_replace.conf.sample
%%ZSH%%share/zsh/site-functions/_pkg_replace
-%%ZSH%%@unexec [ -f %D/bin/zsh ] || rmdir %D/share/zsh/site-functions 2>/dev/null || true
+%%ZSH%%@dirrmtry share/zsh/site-functions
%%ZSH%%@dirrmtry share/zsh