Merge remote-tracking branch 'vanilla/next' into gaps-next
Ingo Bürk
3 years ago
33 | 33 | # # TODO(autotools-removal): autoconf build has to keep working until i3 4.19 |
34 | 34 | # is released, so we keep building it in travis. |
35 | 35 | - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} /bin/sh -c 'autoreconf -fi && mkdir -p build && cd build && (../configure || (cat config.log; false)) && make -j CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Werror -fno-common"' |
36 | - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} /bin/sh -c 'rm -rf build; mkdir -p build && cd build && CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Werror -fno-common" meson .. -Ddocs=true -Dmans=true -Db_sanitize=address && ninja -v && mkdir ../distbuild && cd ../distbuild && meson .. -Ddocs=true -Dmans=true && ninja -v dist' | |
36 | - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} /bin/sh -c 'rm -rf build; mkdir -p build && cd build && CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Werror -fno-common" meson .. -Ddocs=true -Dmans=true -Db_sanitize=address && ninja -v' | |
37 | 37 | - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-spelling.pl |
38 | 38 | - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} ./travis/run-tests.sh |
39 | - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} /bin/sh -c 'rm -rf distbuild; mkdir distbuild && cd distbuild && meson .. -Ddocs=true -Dmans=true && ninja -v dist' | |
39 | 40 | - ./travis/skip-pkg.sh || docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/debian-build.sh deb/debian-amd64/DIST |
40 | 41 | - ./travis/skip-pkg.sh || docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME_UBUNTU} ./travis/debian-build.sh deb/ubuntu-amd64/DIST |
41 | 42 | - ./travis/skip-pkg.sh || docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME_386} linux32 ./travis/debian-build.sh deb/debian-i386/DIST |
41 | 41 | • build: correctly provide auxiliary functions when needed |
42 | 42 | • build: fix issues with parallel build |
43 | 43 | • set _NET_DESKTOP_VIEWPORT after randr changes |
44 | • fix a bug with i3-nagbar not starting after it has already started once |
142 | 142 | void start_nagbar(pid_t *nagbar_pid, char *argv[]); |
143 | 143 | |
144 | 144 | /** |
145 | * Kills the i3-nagbar process, if *nagbar_pid != -1. | |
145 | * Kills the i3-nagbar process, if nagbar_pid != -1. | |
146 | 146 | * |
147 | 147 | * If wait_for_it is set (restarting i3), this function will waitpid(), |
148 | 148 | * otherwise, ev is assumed to handle it (reloading). |
149 | 149 | * |
150 | 150 | */ |
151 | void kill_nagbar(pid_t *nagbar_pid, bool wait_for_it); | |
151 | void kill_nagbar(pid_t nagbar_pid, bool wait_for_it); | |
152 | 152 | |
153 | 153 | /** |
154 | 154 | * Converts a string into a long using strtol(). |
124 | 124 | endforeach |
125 | 125 | |
126 | 126 | else |
127 | install_data( | |
128 | [ | |
129 | 'docs/hacking-howto.html', | |
130 | 'docs/userguide.html', | |
131 | 'docs/ipc.html', | |
132 | 'docs/multi-monitor.html', | |
133 | 'docs/wsbar.html', | |
134 | 'docs/testsuite.html', | |
135 | 'docs/i3bar-protocol.html', | |
136 | 'docs/layout-saving.html', | |
137 | 'docs/debugging.html', | |
138 | ], | |
139 | install_dir: docdir, | |
140 | ) | |
127 | if run_command('[', '-f', 'docs/hacking-howto.html', ']').returncode() == 0 | |
128 | install_data( | |
129 | [ | |
130 | 'docs/hacking-howto.html', | |
131 | 'docs/userguide.html', | |
132 | 'docs/ipc.html', | |
133 | 'docs/multi-monitor.html', | |
134 | 'docs/wsbar.html', | |
135 | 'docs/testsuite.html', | |
136 | 'docs/i3bar-protocol.html', | |
137 | 'docs/layout-saving.html', | |
138 | 'docs/debugging.html', | |
139 | ], | |
140 | install_dir: docdir, | |
141 | ) | |
142 | endif | |
141 | 143 | endif |
142 | 144 | |
143 | 145 | install_data( |
263 | 265 | endforeach |
264 | 266 | |
265 | 267 | else |
266 | install_data( | |
267 | [ | |
268 | 'man/i3.1', | |
269 | 'man/i3bar.1', | |
270 | 'man/i3-msg.1', | |
271 | 'man/i3-input.1', | |
272 | 'man/i3-nagbar.1', | |
273 | 'man/i3-config-wizard.1', | |
274 | 'man/i3-migrate-config-to-v4.1', | |
275 | 'man/i3-sensible-editor.1', | |
276 | 'man/i3-sensible-pager.1', | |
277 | 'man/i3-sensible-terminal.1', | |
278 | 'man/i3-dump-log.1', | |
279 | 'man/i3-dmenu-desktop.1', | |
280 | 'man/i3-save-tree.1', | |
281 | ], | |
282 | install_dir: man1, | |
283 | ) | |
268 | if run_command('[', '-f', 'man/i3.1', ']').returncode() == 0 | |
269 | install_data( | |
270 | [ | |
271 | 'man/i3.1', | |
272 | 'man/i3bar.1', | |
273 | 'man/i3-msg.1', | |
274 | 'man/i3-input.1', | |
275 | 'man/i3-nagbar.1', | |
276 | 'man/i3-config-wizard.1', | |
277 | 'man/i3-migrate-config-to-v4.1', | |
278 | 'man/i3-sensible-editor.1', | |
279 | 'man/i3-sensible-pager.1', | |
280 | 'man/i3-sensible-terminal.1', | |
281 | 'man/i3-dump-log.1', | |
282 | 'man/i3-dmenu-desktop.1', | |
283 | 'man/i3-save-tree.1', | |
284 | ], | |
285 | install_dir: man1, | |
286 | ) | |
287 | endif | |
284 | 288 | endif |
285 | 289 | |
286 | 290 | if meson.version().version_compare('>=0.53') |
1614 | 1614 | */ |
1615 | 1615 | void cmd_reload(I3_CMD) { |
1616 | 1616 | LOG("reloading\n"); |
1617 | kill_nagbar(&config_error_nagbar_pid, false); | |
1618 | kill_nagbar(&command_error_nagbar_pid, false); | |
1617 | ||
1618 | kill_nagbar(config_error_nagbar_pid, false); | |
1619 | kill_nagbar(command_error_nagbar_pid, false); | |
1620 | /* start_nagbar() will refuse to start a new process if the passed pid is | |
1621 | * set. This will happen when our child watcher is triggered by libev when | |
1622 | * the loop re-starts. However, config errors might be detected before | |
1623 | * that since we will read the config right now with load_configuration. | |
1624 | * See #4104. */ | |
1625 | config_error_nagbar_pid = command_error_nagbar_pid = -1; | |
1626 | ||
1619 | 1627 | load_configuration(NULL, C_RELOAD); |
1620 | 1628 | x_set_i3_atoms(); |
1621 | 1629 | /* Send an IPC event just in case the ws names have changed */ |
180 | 180 | ipc_shutdown(SHUTDOWN_REASON_EXIT, -1); |
181 | 181 | unlink(config.ipc_socket_path); |
182 | 182 | xcb_disconnect(conn); |
183 | ||
184 | /* If a nagbar is active, kill it */ | |
185 | kill_nagbar(config_error_nagbar_pid, false); | |
186 | kill_nagbar(command_error_nagbar_pid, false); | |
183 | 187 | |
184 | 188 | /* We need ev >= 4 for the following code. Since it is not *that* important (it |
185 | 189 | * only makes sure that there are no i3-nagbar instances left behind) we still |
286 | 286 | void i3_restart(bool forget_layout) { |
287 | 287 | char *restart_filename = forget_layout ? NULL : store_restart_layout(); |
288 | 288 | |
289 | kill_nagbar(&config_error_nagbar_pid, true); | |
290 | kill_nagbar(&command_error_nagbar_pid, true); | |
289 | kill_nagbar(config_error_nagbar_pid, true); | |
290 | kill_nagbar(command_error_nagbar_pid, true); | |
291 | 291 | |
292 | 292 | restore_geometry(); |
293 | 293 | |
335 | 335 | static void nagbar_exited(EV_P_ ev_child *watcher, int revents) { |
336 | 336 | ev_child_stop(EV_A_ watcher); |
337 | 337 | |
338 | int exitcode = WEXITSTATUS(watcher->rstatus); | |
338 | 339 | if (!WIFEXITED(watcher->rstatus)) { |
339 | ELOG("ERROR: i3-nagbar did not exit normally.\n"); | |
340 | return; | |
341 | } | |
342 | ||
343 | int exitcode = WEXITSTATUS(watcher->rstatus); | |
344 | DLOG("i3-nagbar process exited with status %d\n", exitcode); | |
345 | if (exitcode == 2) { | |
346 | ELOG("ERROR: i3-nagbar could not be found. Is it correctly installed on your system?\n"); | |
347 | } | |
348 | ||
349 | *((pid_t *)watcher->data) = -1; | |
350 | } | |
351 | ||
352 | /* | |
353 | * Cleanup handler. Will be called when i3 exits. Kills i3-nagbar with signal | |
354 | * SIGKILL (9) to make sure there are no left-over i3-nagbar processes. | |
355 | * | |
356 | */ | |
357 | static void nagbar_cleanup(EV_P_ ev_cleanup *watcher, int revent) { | |
358 | pid_t *nagbar_pid = (pid_t *)watcher->data; | |
359 | if (*nagbar_pid != -1) { | |
360 | LOG("Sending SIGKILL (%d) to i3-nagbar with PID %d\n", SIGKILL, *nagbar_pid); | |
361 | kill(*nagbar_pid, SIGKILL); | |
340 | ELOG("i3-nagbar (%d) did not exit normally. This is not an error if the config was reloaded while a nagbar was active.\n", watcher->pid); | |
341 | } else if (exitcode != 0) { | |
342 | ELOG("i3-nagbar (%d) process exited with status %d\n", watcher->pid, exitcode); | |
343 | } else { | |
344 | DLOG("i3-nagbar (%d) process exited with status %d\n", watcher->pid, exitcode); | |
345 | } | |
346 | ||
347 | pid_t *nagbar_pid = watcher->data; | |
348 | if (*nagbar_pid == watcher->pid) { | |
349 | /* Only reset if the watched nagbar is the active nagbar */ | |
350 | *nagbar_pid = -1; | |
362 | 351 | } |
363 | 352 | } |
364 | 353 | |
394 | 383 | ev_child_init(child, &nagbar_exited, *nagbar_pid, 0); |
395 | 384 | child->data = nagbar_pid; |
396 | 385 | ev_child_start(main_loop, child); |
397 | ||
398 | /* install a cleanup watcher (will be called when i3 exits and i3-nagbar is | |
399 | * still running) */ | |
400 | ev_cleanup *cleanup = smalloc(sizeof(ev_cleanup)); | |
401 | ev_cleanup_init(cleanup, nagbar_cleanup); | |
402 | cleanup->data = nagbar_pid; | |
403 | ev_cleanup_start(main_loop, cleanup); | |
404 | } | |
405 | ||
406 | /* | |
407 | * Kills the i3-nagbar process, if *nagbar_pid != -1. | |
386 | } | |
387 | ||
388 | /* | |
389 | * Kills the i3-nagbar process, if nagbar_pid != -1. | |
408 | 390 | * |
409 | 391 | * If wait_for_it is set (restarting i3), this function will waitpid(), |
410 | 392 | * otherwise, ev is assumed to handle it (reloading). |
411 | 393 | * |
412 | 394 | */ |
413 | void kill_nagbar(pid_t *nagbar_pid, bool wait_for_it) { | |
414 | if (*nagbar_pid == -1) | |
395 | void kill_nagbar(pid_t nagbar_pid, bool wait_for_it) { | |
396 | if (nagbar_pid == -1) | |
415 | 397 | return; |
416 | 398 | |
417 | if (kill(*nagbar_pid, SIGTERM) == -1) | |
399 | if (kill(nagbar_pid, SIGTERM) == -1) | |
418 | 400 | warn("kill(configerror_nagbar) failed"); |
419 | 401 | |
420 | 402 | if (!wait_for_it) |
424 | 406 | * exec(), our old pid is no longer watched. So, ev won’t handle SIGCHLD |
425 | 407 | * for us and we would end up with a <defunct> process. Therefore we |
426 | 408 | * waitpid() here. */ |
427 | waitpid(*nagbar_pid, NULL, 0); | |
409 | waitpid(nagbar_pid, NULL, 0); | |
428 | 410 | } |
429 | 411 | |
430 | 412 | /* |
4 | 4 | |
5 | 5 | DEST=$1 |
6 | 6 | |
7 | cd build | |
7 | cd distbuild | |
8 | 8 | # unpack dist tarball |
9 | 9 | mkdir -p "${DEST}" |
10 | 10 | tar xf meson-dist/*.tar.xz -C "${DEST}" --strip-components=1 |
2 | 2 | set -e |
3 | 3 | set -x |
4 | 4 | |
5 | for f in $(grep '\.html$' debian/i3-wm.docs | grep -v 'docs/refcard.html' | grep -v 'docs/lib-i3test') | |
5 | # TODO: install the docs via meson, inject styles with an option | |
6 | ||
7 | for f in $(sed -n "s/^\s*'\(docs\/.*\)',$/\1/gp" meson.build | grep -vF .) | |
6 | 8 | do |
7 | 9 | asciidoc -a linkcss -a stylesdir=https://i3wm.org/css -a scriptsdir=https://i3wm.org/js --backend=xhtml11 -f docs/asciidoc-git.conf $(dirname $f)/$(basename $f .html) |
8 | 10 | done |
11 | ||
9 | 12 | ./docs/i3-pod2html --stylesurl=https://i3wm.org/css i3-dmenu-desktop man/i3-dmenu-desktop.html |
10 | 13 | ./docs/i3-pod2html --stylesurl=https://i3wm.org/css i3-save-tree man/i3-save-tree.html |
11 | ./docs/i3-pod2html --stylesurl=https://i3wm.org/css build/testcases/lib/i3test.pm docs/lib-i3test.html | |
14 | ./docs/i3-pod2html --stylesurl=https://i3wm.org/css build/i3test.pm docs/lib-i3test.html | |
12 | 15 | ./docs/i3-pod2html --stylesurl=https://i3wm.org/css testcases/lib/i3test/Test.pm docs/lib-i3test-test.html |
13 | for file in $(sed 's/\.1$/.man/g' debian/i3-wm.manpages) | |
16 | ||
17 | for file in $(sed -n "s/^\s*'\(man\/.*\).man',$/\1.man/gp" meson.build) | |
14 | 18 | do |
15 | 19 | [ -f "$file" ] && asciidoc -a linkcss -a stylesdir=https://i3wm.org/css -a scriptsdir=https://i3wm.org/js --backend=xhtml11 -f docs/asciidoc-git.conf "$file" |
16 | 20 | done |
17 | 21 | |
18 | 22 | mkdir -p deb/COPY-DOCS |
19 | 23 | |
20 | cp $(tr "\n" ' ' < debian/i3-wm.docs) deb/COPY-DOCS/ | |
21 | cp $(sed 's/\.1$/.html/g' debian/i3-wm.manpages | tr "\n" ' ') deb/COPY-DOCS/ | |
24 | cp $(sed -n "s/^\s*'\(docs\/.*\)',$/\1/gp" meson.build | grep -F .) deb/COPY-DOCS/ | |
25 | cp $(sed -n "s/^\s*'\(man\/.*\).man',$/\1.html/gp" meson.build) deb/COPY-DOCS/ |