blob: 9e8c75a60539d1b3d7f133200f688a98e14d86af (
plain)
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
127
|
# Generate a changes file to describe binary packages and their changes
#
# Copyright (C) 2013 Patrick McDermott
#
# This file is part of opkbuild.
#
# opkbuild is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# opkbuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with opkbuild. If not, see <http://www.gnu.org/licenses/>.
set -eu
write_changes()
{
local version="${1}"
local arch="${2}"
local plat="${3}"
shift 3
local pkg=
local desc=
printf 'Format: 1.0\n' >&3
printf 'Source: %s\n' "${OPK_SOURCE}" >&3
printf 'Binary: %s\n' "$(ob_get_binary_packages)" >&3
printf 'Version: %s\n' "${version}" >&3
printf 'Architecture: %s\n' "${arch}" >&3
printf 'Platform: %s\n' "${plat}" >&3
printf 'Distribution: %s\n' \
"$(ob_get_source_parameter 'Distribution')" >&3
printf 'Maintainer: %s\n' "$(ob_get_source_parameter 'Maintainer' | \
tr '\n' ' ')" >&3
printf 'Changed-By: %s\n' "$(ob_get_source_parameter 'Uploader')" >&3
printf 'Date: %s\n' "$(ob_get_source_parameter 'Date')" >&3
printf 'Description:\n' >&3
for pkg in $(ob_get_binary_packages); do
ob_set_package_substvars "${pkg}"
desc="$(ob_get_binary_parameter "${pkg}" 'Description' | \
head -n 1)"
desc="$(ob_substvars "${desc}" "${pkg}")"
printf ' %s - %s\n' "${pkg}" "${desc}" >&3
done
printf 'Changes:\n%s\n' "$(ob_get_source_parameter 'Changes' | \
sed 's/^$/./; s/^/ /;')" >&3
return 0
}
write_files_src()
{
local file=
printf 'Files:\n' >&3
file="src-${OPK_SOURCE}_${OPK_SOURCE_VERSION}_src_all.opk"
printf ' %s %s %s\n' \
"$(wc -c "../../${file}" | cut -d ' ' -f 1)" \
'base' "${file}" >&3
return 0
}
write_files_bin()
{
local pkg=
local arch=
local plat=
local file=
printf 'Files:\n' >&3
for pkg in ${OPK_PACKAGES_REDUCED}; do
arch="$(ob_get_binary_parameter "${pkg}" 'Architecture')"
[ x"${arch}" != x'all' ] && arch="${OPK_HOST_ARCH}"
plat="$(ob_get_binary_parameter "${pkg}" 'Platform')"
[ x"${plat}" != x'all' ] && plat="${OPK_HOST_PLAT}"
file="${pkg}_${OPK_BINARY_VERSION}_${arch}_${plat}.opk"
printf ' %s %s %s\n' \
"$(wc -c "../../${file}" | cut -d ' ' -f 1)" \
'base' "${file}" >&3
done
return 0
}
main()
{
local changes=
if ! ob_set_text_domain 'opkbuild'; then
printf '%s: Error: Failed to load locale messages\n' \
"${0##*/}" >&2
return 1
fi
ob_init_package '..' || return 1
if [ x"${OB_DO_SOURCE:+set}" = x'set' ]; then
changes="${OPK_SOURCE}_${OPK_SOURCE_VERSION}_src_all.changes"
ob_info "$(ob_get_msg 'gen_changes')" "${changes}"
exec 3>"../../${changes}"
write_changes "${OPK_SOURCE_VERSION}" 'src' 'all'
write_files_src
exec 3>&-
else
changes="${OPK_SOURCE}_${OPK_SOURCE_VERSION}"
changes="${changes}_${OPK_HOST_ARCH}_${OPK_HOST_PLAT}.changes"
ob_info "$(ob_get_msg 'gen_changes')" "${changes}"
exec 3>"../../${changes}"
write_changes "${OPK_BINARY_VERSION}" \
"${OPK_HOST_ARCH}" "${OPK_HOST_PLAT}"
write_files_bin
exec 3>&-
fi
return 0
}
|