blob: c5e5c956e6aa1d24a0c381cd2d9fc0530a13a87b (
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
|
#!@@SH@@
#
# opkbuild
# src/ob-genchanges.sh
# Generates a changes file to describe binary packages and their changes.
#
# Copyright (C) 2013 Patrick "P. J." McDermott
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
. '@@PKGLIBDIR@@/load.sm'
ob_use locale
ob_use output
ob_use package
main()
{
ob_set_text_domain 'opkbuild'
ob_init_package '..' || exit 1
ob_parse_package_metadata -c '.opkbuild.cache' || exit 1
if [ -n "${OB_DO_SOURCE}" ]; 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
}
write_changes()
{
version="${1}"
arch="${2}"
plat="${3}"
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')" >&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}")"
printf ' %s - %s\n' "${pkg}" "${desc}" >&3
done
printf 'Changes:\n%s\n' "$(ob_get_source_parameter 'Changes' | \
sed 's/^$/./; s/^/ /;')" >&3
}
write_files_src()
{
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
}
write_files_bin()
{
printf 'Files:\n' >&3
for pkg in $(ob_get_binary_packages); do
arch="$(ob_get_binary_parameter "${pkg}" 'Architecture')"
[ "${arch}" != 'all' ] && arch="${OPK_HOST_ARCH}"
plat="$(ob_get_binary_parameter "${pkg}" 'Platform')"
[ "${plat}" != 'all' ] && plat="${OPK_HOST_PLAT}"
file="${pkg}_${version}_${arch}_${plat}.opk"
printf ' %s %s %s\n' \
"$(wc -c "../../${file}" | cut -d ' ' -f 1)" \
'base' "${file}" >&3
done
}
main "${@}"
|