Age | Commit message (Collapse) | Author |
|
expect input
If stdin is a TTY, systemd-nspawn will create a proxy PTY, and pump the
data from real stdin through the proxy PTY. Because the PTY acts as a
buffer, that means that it eats stdin, EVEN IF THE PROGRAM DOESN'T ACTUALLY
READ IT. This is surprising to the user.
We can't know if the command to `librechroot run` is going to read from
stdin, but for most uses of librechroot we do know. So, set stdin to
/dev/null for those cases.
|
|
|
|
Objectives:
- Once the source package has been created, never run makepkg with
networking enabled again, so that we can be 100% sure that the source
package has all of the sources that we need.
- Don't let makepkg edit the PKGBUILD (eg. by evaluating pkgver())
User-facing changes:
- libremakepkg now disables networking during prepare()
- libremakepkg no longer runs pkgver()
- chcleanup (and thus `librechroot clean-pkgs`) now also installs packages
Technical description of changes:
- In devtools (and not really in this commit):
* No longer split /chrootprepare off of /chrootbuild. The point of
splitting it was that we'd have prepare() run from /chrootprepare
and the rest later run from /chrootbuild, so that we could leave
networking enabled during prepare() but not the rest. Now that we're
disabling networking during prepare(), that's pointless.
* Have download_sources create a source package (rather than having
/chrootbuild create the source package at the same time that we create
the binary package). We adjust the caller to temporarily set
SRCPKGDEST to a temporary directory, so that we can get the file and
control the filename when we move it in to the real SRCPKGDEST.
- Have chcleanup install the dependencies. If we used the traditional
`makepkg --sync` to install the dependencies, then we'd be breaking the
"no networking for makepkg after source package creation" objective.
chcleanup already has all of the logic necessary to accomplish this.
If there's a discrepancy in chcleanup behavior and makepkg behavior, and
makepkg thinks it needs to install something, then that just means we'll
have to fix the bug in chcleanup, instead of letting it go for more than
a year (*cough* https://labs.parabola.nu/issues/1311 *cough*).
- Use files extracted from the source package (rather than files found in
the current directory) to build the package.
- We mount the temporary directory containing the extracted source package
files read-only, to be sure that makepkg doesn't modify the PKGBUILD.
This is necessary because --holdver only disables pkgver() if it's a VCS
package.
|
|
|
|
|
|
libremakepkg defined a cleanup() function, which overrode
common.sh:cleanup(), which meant that common.sh:die() exited with a
'0' status.
|
|
Do this by syncing makepkg_args with makechrootpkg's
default_makepkg_args; recent devtools have makechrootpkg not copy the
keyring in to the chroot.
This incorporates 3 commits from Arch devtools:
7ca4eb82d (2017-05-02): add --holdver
0cbc179d2 (2017-07-13): use long options; `-s`→`--syncdeps`, `-L`→`--log`
75fdff181 (2017-07-13): add --skipinteg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Only make this change in places where it shouldn't make a difference, and
something weird has to be going on for the subshell to fail. This is on
par with checking the return value of malloc. We don't need tests for each
of these failure cases.
|
|
These were found with the help of shellcheck.
|
|
|
|
|
|
|
|
|
|
|
|
Packages should be buildable without any extra incantations, and it was
more of a source of mistakes than anything else.
|
|
|
|
|
|
|
|
|
|
|
|
I can't figure out a reliable way to test this, as it depends on the host
pacman cache.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Feature request: https://labs.parabola.nu/issues/458
|
|
I'm a fan of systemd-nspawn. I really am. It handles a lot of things the
"right" way, so you don't have to.
However, it handles PTYs and signals in an incredibly stupid way. Working
around one is f---ed up by the other being wrong.
Before I implemented the change that this reverts, this is what happens:
systemd-nspawn> I need to create a PTY and proxy between it and stdio.
I can specify a terminal size when doing this--I should
set it to reflect the terminal I am connected to.
systemd-nspawn> /dev/stdout: Are you a TTY?
/dev/stdout> systemd-nspawn: No.
---- The correct thing to do here would be to either not set the size,
---- or set it to 80×24
systemd-nspawn> /dev/stdin: Are you a TTY?
/dev/stdin> systemd-nspawn: Yes.
systemd-nspawn> /dev/stdin: Great, what size are you?
/dev/stdin> systemd-nspawn: I am X×Y.
systemd-nspawn: libc: Please give me a PTY that is X×Y.
---- Why the f--- would you do this? The size only effects *output*.
---- If you don't know the characteristics of the output, set
---- reasonable defaults! Don't base it on the characteristics of the
---- input!
My solution was to make /dev/stdin not be a TTY by closing it. This had
the desired effect, but tripped up the signal handling.
Here is how signals were handled before:
systemd-nspawn> /dev/stdin: Are you a TTY?
/dev/stdin> systemd-nspawn: Yes.
systemd-nspawn> /dev/stdin: Great, please don't send SIGINT on C-c.
I will handle it myself.
*user presses C-c, systemd reads it*
systemd-nspawn> child processes: here's a SIGINT.
Here's what happens when I close, or do other things to make stdin not be a
TTY:
systemd-nspawn> /dev/stdin: Are you a TTY?
/dev/stdin> systemd-nspawn: No.
systemd-nspawn> /dev/stdin: Oh, OK.
*user presses C-c, /dev/stdin interprets it*
/dev/stdin> systemd-nspawn: Here's a SIGINT.
systemd-nspawn> *dies, abandoning child processes*
The clear correct thing to do would have been to *handle* SIGINT, and pass
it along to the children.
|
|
Besides preventing interactive use, this prevents the program from knowing
the size of the terminal.
|
|
|
|
There are two downsizes to using sed; it line-buffers, and (the existing
pattern) doesn't handle '\r'.
So, now I've included a Perl helper program to do a better job.
I'd originally written it in C, and while that version was faster (the Perl
version stutters occasionally), it required recompilation for different
architectures. I could have gotten around that with tcc, but I didn't want
to add any dependencies. Which is why I settled on Perl. It's part of
group=(base), and it is required by packages in group=(base-devel), so I
can count on it always being there.
It doesn't handle every movement character, just '\n' and '\r', but that's
enough for curl and pacman.
|
|
Conflicts:
src/abslibre-tools/createworkdir
|
|
|
|
|
|
We split chrootbuild so that the initialization bit runs before
hook_pre_build.
|
|
|
|
|
|
|
|
User-facing changes:
- libremessages: `lock_open_write` became `lock`
- libremessages: `lock_open_read` became `slock`
- librechroot: learned the `-r` and `-w` flags to do bind mounts.
Internal changes:
The changes to librechroot were pretty straight-forward; the biggest
change is that `archroot` got split into `mkarchroot` and
`arch-nspawn`.
libremakepkg got a major overhaul Honestly, the changes to
libremakepklg probably could have been a lot smaller, but... I wanted
to do it right/be clean. makechrootpkg in devtools got cleaned up a
lot, actually a lot of the same changes I was making. But, the small
differences between the way we did things made it less than simple to
adjust. The biggest changes in terms of conflict for me are how
devtools now uses bind-mounts to put files in the chroot, and that the
/chrootbuild file is more complicated.
I handled a lot of the complexity by moving things out of the main
program, and adding hooks for non-core functionality, including
chcleanup, distcc compatability hacks, and PKGBUILD/pkg checking.
Unfortunately, the files containing the hooks are currently
hard-coded. Perhaps they will be truly pluggable in the future. That
might be neat. Or over-complicated. We'll see where it goes.
|
|
|