-
Notifications
You must be signed in to change notification settings - Fork 2
/
portz_build_site
executable file
·127 lines (106 loc) · 3.29 KB
/
portz_build_site
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash
#
# This file is part of 'portz'
#
# Copyright (C) Zbigniew Zagorski <[email protected]> and others,
# licensed to the public under the terms of the GNU GPL (>= 2)
# see the file COPYING for details
#
# I.e., do what you like, but keep copyright and there's NO WARRANTY.
#
PNAME=portz_build_site
export PNAME
set -e
portz_libdir=${portz_libdir-`pwd`}
. ${portz_libdir}/scripts/runtime.sh
. ${portz_scripts}/functions.sh
. ${portz_scripts}/package_defs.sh
packages_required="$*"
find_available_packages()
(
local ddd=$1
(
shopt -s failglob
(cd $ddd ; ls -1 *.portz || true ) | sed -e 's/\.portz//'
if [ -f "$1/portz_import_packages" ] ; then
cat $1/portz_import_packages
fi
echo "$param_packages"
) | sort -u
)
if [ -z "$packages_required" ] ; then
packages_required="$(find_available_packages $portz_repo)"
fi
log_info "packages = $packages_required"
if [ -z "$packages_required" ] ; then
log_error "no packag definitions found in prefix '$prefix'"
exit 1
fi
overall_result=0
readonly packages_to_install="$(bashfoo.mktemp portz_build_size-to-install)"
readonly packages_analyzed="$(bashfoo.mktemp portz_build_size-already-installed)"
readonly packages_unknown="$(bashfoo.mktemp portz_build_size-unknown)"
analyze_package_list()
{
local packages="$*"
touch "$packages_analyzed"
#log_info "analyze_package_list: $packages"
local package=""
for package in $packages ; do
#log_info "analyze_package_list: $package"
if grep -qxF "$package" "$packages_analyzed" ; then
continue
fi
log_quiet=1
unset name package_name
if ! load_package "$package" ; then
echo "$package" >> "$packages_unknown"
continue
fi
log_quiet=0
if [ -n "$depends" ] ; then
(
local xdepends="$depends"
unset depends
dependency_of=" (dependency of $package)"
unset name package_name
analyze_package_list $xdepends
)
fi
if log_quiet=1 portz_check_installed $package_name ; then
log_info "already installed: $package$dependency_of"
#portz_show_pkginfo $package_name
else
log_info "marked for install: $package ($package_name-$package_version from $package_def_file)$dependency_of"
echo "$package_def_file" >> "$packages_to_install"
fi
echo "$package" >> "$packages_analyzed"
done
}
analyze_package_list $packages_required
if [ -s "$packages_unknown" ] ; then
ls -al "$packages_unknown"
while read package ; do
log_error "unknown package: $package"
done < <(cat "$packages_unknown" | sort -u )
exit 2
fi
if [ -n "$portz_dry_run" ]; then
log_info "dry_run mode, skipping install part"
exit 0
fi
while read package ; do
(
${portz_libdir}/portz_install $package
)
r=$?
if [ "$r" != 0 ] ; then
overall_result=$r
failed_packages="$failed_packages $package"
fi
done < <(cat "$packages_to_install" )
if [ "$overall_result" != 0 ] ; then
log_info "failure, following packages failed to install: $failed_packages"
fi
exit $overall_result
# jedit: :tabSize=8:indentSize=4:noTabs=true:mode=shellscript: