Add back local package installation support, which was disabled for PKG_NG.

The patch attached to PR 181450 did no longer apply cleanly, therefore I
edited portmaster to follow the intent and in part the letter of the patch.
This patch should not affect port building in any way. I have no use for
the feature (and I'm still considering to completely remove support for the
installation of packages in portmaster), and therefore did not test that
it performs as expected by the submitter.

PR:		181450
Submitted by:	rozhuk.im@gmail.com
Approved by:	antoine (implicit)
This commit is contained in:
Stefan Eßer 2017-12-19 12:25:34 +00:00
parent 773599af86
commit 9d15f65803
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=456715
2 changed files with 143 additions and 10 deletions

View file

@ -2,7 +2,7 @@
PORTNAME= portmaster
PORTVERSION= 3.17.11
PORTREVISION= 8
PORTREVISION= 9
CATEGORIES= ports-mgmt
MASTER_SITES= LOCAL/bdrewery/${PORTNAME}/ \
http://mirror.shatow.net/freebsd/${PORTNAME}/ \

View file

@ -18,7 +18,23 @@
--update-if-newer) PM_UPDATE_IF_NEWER=pm_update_if_newer
export PM_UPDATE_IF_NEWER ;;
--delete-build-only) PM_DEL_BUILD_ONLY=pm_dbo
@@ -1039,7 +1039,7 @@ find_moved_port () {
@@ -811,15 +811,6 @@ if [ "$$" -eq "$PM_PARENT_PID" ]; then
[ -n "$PM_URB" -o -n "$UPDATE_ALL" ] && [ -n "$1" ] &&
fail 'The -[ar] options are not compatible with other updates'
- if [ -n "$PM_PACKAGES" -o -n "$PM_PACKAGES_BUILD" ]; then
- unset PM_PACKAGES PM_PACKAGES_BUILD PM_PACKAGES_LOCAL PM_PACKAGES_NEWER PM_ALWAYS_FETCH PM_DELETE_PACKAGES
- echo "===>>> Package installation support cannot be used with pkgng yet,"
- echo " it will be disabled"
- echo ''
- [ `/sbin/sysctl -n kern.osreldate 2>/dev/null` -lt 600400 ] &&
- fail Package installation support requires FreeBSD 6.4 or newer
- fi
-
if [ -n "$PM_INDEX" ] &&
[ -z "$LIST" -a -z "$LIST_ORIGINS" -a -z "$EXPUNGE" -a -z "$CLEAN_STALE" ]; then
if [ -z "$INDEXFILE" ]; then
@@ -1039,7 +1030,7 @@ find_moved_port () {
return 0
else
reason=${moved##*|}
@ -27,7 +43,7 @@
fail "The $sf port has been deleted: $reason"
fi ;;
${sf}\|*) moved_npd=${moved#*\|} # New port directory
@@ -1449,6 +1449,24 @@ check_force_multi () {
@@ -1449,6 +1440,24 @@ check_force_multi () {
fi
}
@ -52,7 +68,16 @@
check_for_updates () {
# Global: num_updates
local nf iport originflavor flavor origin port_ver do_update skip
@@ -2148,24 +2166,6 @@ update_pm_nu () {
@@ -1622,7 +1631,7 @@ pm_pkg_create () {
pm_cd_pd $portdir
latest_link=`pm_make -V LATEST_LINK`
cd ${1}/Latest
- $PM_SU_CMD ln -sf ../All/$pkg ${latest_link}.tbz
+ $PM_SU_CMD ln -sf ../All/$pkg ${latest_link}.txz
fi
cd ${1}/${portdir%/*}
@@ -2148,24 +2157,6 @@ update_pm_nu () {
PM_NEEDS_UPDATE="${PM_NEEDS_UPDATE}${1} "
}
@ -77,7 +102,7 @@
update_build_l () {
local originflavor origin flavor iport
@@ -2280,10 +2280,12 @@ make_dep_list () {
@@ -2280,10 +2271,12 @@ make_dep_list () {
for dep_type in $*; do
case $dep_type in
@ -92,7 +117,7 @@
*)
fail "make_dep_list: Unsupported option '$dep_type'"
esac
@@ -2436,9 +2438,7 @@ dependency_check () {
@@ -2436,9 +2429,7 @@ dependency_check () {
confl_p=`pkg query -g "%n-%v" $glob 2>/dev/null`
if [ -n "$confl_p" ]; then
confl_p=${confl_p%% *}
@ -102,7 +127,7 @@
if [ "${d_port#$pd/}" = "$portdir" ]; then
echo -e "\n===>>> $origin seems to depend on $portdir"
echo ' which looks like a dependency loop'
@@ -2797,7 +2797,12 @@ multiport () {
@@ -2797,7 +2788,12 @@ multiport () {
numports=$(( $numports - 1 ))
continue
fi
@ -116,7 +141,7 @@
esac
case "$PM_NEEDS_UPDATE" in
@@ -3033,7 +3038,7 @@ if [ -z "$REPLACE_ORIGIN" ]; then
@@ -3033,7 +3029,7 @@ if [ -z "$REPLACE_ORIGIN" ]; then
*) echo '' ; no_valid_port ;;
esac
done ;;
@ -125,7 +150,7 @@
esac
if [ -z "$portdir" -a -z "$upg_port" ]; then
@@ -3129,12 +3134,13 @@ iport_from_pkgname () {
@@ -3129,12 +3125,13 @@ iport_from_pkgname () {
dir=$(dir_part $1)
flavor=$(flavor_part $1)
pkgname=$(make -C "$pd/$dir" -V PKGNAME FLAVOR=$flavor) || return 1
@ -141,7 +166,86 @@
# || fail "XXX Cannot find installed port '$portdir'"
fi
@@ -3594,6 +3600,7 @@ if [ -z "$use_package" ]; then
@@ -3383,7 +3380,7 @@ fetch_package () {
fi
if [ -z "$PM_ALWAYS_FETCH" ]; then
- if [ -r "${ppd}/${1}.tbz" ]; then
+ if [ -r "${ppd}/${1}.txz" ]; then
pm_v "===>>> Package exists, skipping fetch"
return 0
else
@@ -3391,7 +3388,7 @@ fetch_package () {
fi
else
do_fetch=do_fetch_always_fetch
- pm_unlink_s ${ppd}/${1}.tbz
+ pm_unlink_s ${ppd}/${1}.txz
fi
if [ -n "$do_fetch" ]; then
@@ -3403,10 +3400,10 @@ fetch_package () {
fi
fi
- pm_sv Fetching ${1}.tbz
- if ! $PM_SU_CMD fetch $FETCH_ARGS -o $ppd ${sitepath}${1}.tbz 2>/dev/null; then
- pm_unlink_s ${ppd}/${1}.tbz
- $PM_SU_CMD fetch $FETCH_ARGS -o $ppd ${sitepath}${1}.tbz 2>/dev/null
+ pm_sv Fetching ${1}.txz
+ if ! $PM_SU_CMD fetch $FETCH_ARGS -o $ppd ${sitepath}${1}.txz 2>/dev/null; then
+ pm_unlink_s ${ppd}/${1}.txz
+ $PM_SU_CMD fetch $FETCH_ARGS -o $ppd ${sitepath}${1}.txz 2>/dev/null
fi
fi
}
@@ -3420,9 +3417,11 @@ fetch_package () {
release=packages-${release%-RELEASE*}-release ;;
9\.0-CURRENT*) release=packages-9-current ;;
10\.0-CURRENT*) release=packages-10-current ;;
- *RC[0-9]*) release=${release%-RC[0-9]}
+ 11\.0-CURRENT*) release=packages-11-current ;;
+ 12\.0-CURRENT*) release=packages-12-current ;;
+ *RC[0-9]*) release=${release%-RC[0-9]*}
release=packages-${release}-release ;;
- *BETA[0-9]*) release=${release%-BETA[0-9]}
+ *BETA[0-9]*) release=${release%-BETA[0-9]*}
release=packages-${release}-release ;;
esac
@@ -3439,15 +3438,17 @@ fetch_package () {
echo "===>>> Checking package repository for latest available version"
if [ -n "$LOCAL_PACKAGEDIR" ]; then
- if [ -r "${LOCAL_PACKAGEDIR}/All/${new_port}.tbz" ]; then
- local_package=${LOCAL_PACKAGEDIR}/All/${new_port}.tbz
+ pm_v "===>>> ... checking: ${LOCAL_PACKAGEDIR}/All/${new_port}.txz"
+ if [ -r "${LOCAL_PACKAGEDIR}/All/${new_port}.txz" ]; then
+ local_package=${LOCAL_PACKAGEDIR}/All/${new_port}.txz
latest_pv=${local_package##*/}
fi
if [ -z "$latest_pv" -a -z "$PM_INDEX_ONLY" ]; then
s=`pm_make -V LATEST_LINK`
- if [ -r "${LOCAL_PACKAGEDIR}/Latest/${s}.tbz" ]; then
- local_package=${LOCAL_PACKAGEDIR}/Latest/${s}.tbz
- latest_pv=`readlink ${LOCAL_PACKAGEDIR}/Latest/${s}.tbz`
+ echo "===>>> ... checking: ${LOCAL_PACKAGEDIR}/Latest/${s}.txz"
+ if [ -r "${LOCAL_PACKAGEDIR}/Latest/${s}.txz" ]; then
+ local_package=${LOCAL_PACKAGEDIR}/Latest/${s}.txz
+ latest_pv=`readlink ${LOCAL_PACKAGEDIR}/Latest/${s}.txz`
latest_pv=${latest_pv##*/}
else
pm_v "===>>> No local package for ${new_port}, attempting fetch"
@@ -3510,7 +3511,7 @@ fetch_package () {
fi
else
latest_pv=${latest_pv#*href=\"}
- latest_pv=${latest_pv%%\.tbz*}
+ latest_pv=${latest_pv%%\.txz*}
fi
notnewer () {
@@ -3594,6 +3595,7 @@ if [ -z "$use_package" ]; then
fi
pm_cd_pd $portdir
@ -149,3 +253,32 @@
[ -z "$DONT_PRE_CLEAN" ] && { pm_make clean NOCLEANDEPENDS=ncd ||
fail 'make clean failed'; }
@@ -3635,7 +3637,7 @@ pkg_flavor () {
eval pm_make -DNO_DEPENDS stage $port_log_args || fail "make stage failed for $portdir"
else
[ -z "$local_package" ] && {
- fetch_package $latest_pv || fail "Fetch for ${latest_pv}.tbz failed"; }
+ fetch_package $latest_pv || fail "Fetch for ${latest_pv}.txz failed"; }
fi
# Ignore if no old port exists, or -F
@@ -3762,14 +3764,14 @@ if [ -z "$use_package" ]; then
else
[ -n "$local_package" ] && ppd=${LOCAL_PACKAGEDIR}/All
- echo "===>>> Installing package"
- if $PM_SU_CMD pkg add --accept-missing --force ${ppd}/${latest_pv}.tbz; then
+ echo "===>>> Installing package from: ${ppd}/${latest_pv}.txz"
+ if $PM_SU_CMD pkg add --accept-missing --force ${ppd}/${latest_pv}.txz; then
if [ -n "$PM_DELETE_PACKAGES" ]; then
- pm_v "===>>> Deleting ${latest_pv}.tbz"
- pm_unlink_s ${ppd}/${latest_pv}.tbz
+ pm_v "===>>> Deleting ${latest_pv}.txz"
+ pm_unlink_s ${ppd}/${latest_pv}.txz
fi
else
- install_failed ${latest_pv}.tbz
+ install_failed ${latest_pv}.txz
fi
fi