1 | #! /bin/sh |
---|
2 | # |
---|
3 | # RTEMS Tools Project (http://www.rtems.org/) |
---|
4 | # Copyright 2017 Chris Johns (chrisj@rtems.org) |
---|
5 | # All rights reserved. |
---|
6 | # |
---|
7 | # This file is part of the RTEMS Tools package in 'rtems-tools'. |
---|
8 | # |
---|
9 | # Redistribution and use in source and binary forms, with or without |
---|
10 | # modification, are permitted provided that the following conditions are met: |
---|
11 | # |
---|
12 | # 1. Redistributions of source code must retain the above copyright notice, |
---|
13 | # this list of conditions and the following disclaimer. |
---|
14 | # |
---|
15 | # 2. Redistributions in binary form must reproduce the above copyright notice, |
---|
16 | # this list of conditions and the following disclaimer in the documentation |
---|
17 | # and/or other materials provided with the distribution. |
---|
18 | # |
---|
19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
---|
23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
29 | # POSSIBILITY OF SUCH DAMAGE. |
---|
30 | # |
---|
31 | |
---|
32 | # |
---|
33 | # This worker script to build the doco. |
---|
34 | # |
---|
35 | . ${release_top}/rtems-release-version |
---|
36 | echo "RTEMS Release Notes builder, v${rtems_release_version}" |
---|
37 | |
---|
38 | # |
---|
39 | # Defaults. |
---|
40 | # |
---|
41 | . ${release_top}/rtems-release-defaults |
---|
42 | |
---|
43 | # |
---|
44 | # Only build if wkhtmltopdf is present on the system. |
---|
45 | # |
---|
46 | if [ "`command -v wkhtmltopdf`"no = no ]; then |
---|
47 | echo "warning: release notes not built: no wkhtmltopdf" |
---|
48 | exit 0 |
---|
49 | fi |
---|
50 | |
---|
51 | # |
---|
52 | # Only build if gs is present on the system. |
---|
53 | # |
---|
54 | if [ "`command -v gs`"no = no ]; then |
---|
55 | echo "warning: release notes not built: no gs" |
---|
56 | exit 0 |
---|
57 | fi |
---|
58 | |
---|
59 | # |
---|
60 | # Common package start. No git repo the data source is Trac. |
---|
61 | # |
---|
62 | rtems_git_repo=no |
---|
63 | . ./rtems-release-package-start |
---|
64 | |
---|
65 | # |
---|
66 | # The workspace pwd |
---|
67 | # |
---|
68 | ws_pwd=${PWD} |
---|
69 | |
---|
70 | # |
---|
71 | # The release notes are all held in the wiki |
---|
72 | # |
---|
73 | release_pages="https://devel.rtems.org/wiki/Release/" |
---|
74 | |
---|
75 | # |
---|
76 | # Set up the wkhtmltopdf defaults. |
---|
77 | # |
---|
78 | page_options="--print-media-type --zoom 0.8" |
---|
79 | header="--header-right [page]/[toPage] --header-font-size 10" |
---|
80 | footer="--footer-left [webpage] --footer-font-size 10" |
---|
81 | |
---|
82 | echo "Creating release notes" |
---|
83 | |
---|
84 | rel_html="" |
---|
85 | rel_html_line="<div>@RELEASE@</div>" |
---|
86 | rev=0 |
---|
87 | while [ ${rev} -le ${revision_no} ] |
---|
88 | do |
---|
89 | rel=${version}.${rev} |
---|
90 | rel_html="$(echo ${rel_html_line} | sed -e "s/@RELEASE@/${rel}/g")${rel_html}" |
---|
91 | rev=$(expr ${rev} + 1) |
---|
92 | done |
---|
93 | rel_html=$(echo ${rel_html} | sed -e 's/\./\\\./g' -e 's/\//\\\//g') |
---|
94 | |
---|
95 | echo "Create the coverpage" |
---|
96 | cp ${top}/rtems-release-notes-coverpage/* . |
---|
97 | cat rtems-release-notes-coverpage.html.in | \ |
---|
98 | sed -e "s/@RELEASE@/${release}/g" \ |
---|
99 | -e "s/@VERSION@/${version}/g" \ |
---|
100 | -e "s/@REVISION@/${revision}/g" \ |
---|
101 | -e "s/@DATE@/${now}/g" \ |
---|
102 | -e "s/@REVISIONS@/${rel_html}/g" > rtems-release-notes-coverpage.html |
---|
103 | wkhtmltopdf file://${ws_pwd}/rtems-release-notes-coverpage.html \ |
---|
104 | --disable-smart-shrinking \ |
---|
105 | ${page_options} \ |
---|
106 | --no-header-line \ |
---|
107 | --no-footer-line cp.pdf |
---|
108 | |
---|
109 | pdfs="" |
---|
110 | rev=0 |
---|
111 | while [ ${rev} -le ${revision_no} ] |
---|
112 | do |
---|
113 | rel=${version}.${rev} |
---|
114 | echo "Creating the ${rel} PDF" |
---|
115 | wkhtmltopdf --user-style-sheet file://${ws_pwd}/trac-rtems-style.html \ |
---|
116 | -L 5mm -R 5mm \ |
---|
117 | ${release_pages}/${version}/${version}.${rev} \ |
---|
118 | ${page_options} \ |
---|
119 | --header-left "RTEMS ${rel} Release Notes" ${header} \ |
---|
120 | ${footer} \ |
---|
121 | p${rev}.pdf |
---|
122 | pdfs="p${rev}.pdf ${pdfs}" |
---|
123 | rev=$(expr ${rev} + 1) |
---|
124 | done |
---|
125 | |
---|
126 | gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=../rtems-${release}-release-notes.pdf cp.pdf ${pdfs} |
---|
127 | |
---|
128 | echo "Created: ${release}/rtems-${release}-release-notes.pdf cp.pdf" |
---|
129 | |
---|
130 | # |
---|
131 | # Comman package end. |
---|
132 | # |
---|
133 | . ${top}/rtems-release-package-end |
---|
134 | |
---|
135 | exit 0 |
---|