Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-02-19Merge branch 'lukeshu/ng' into lukeshu/libretoolsLuke Shumaker
This is essentially merging the "archlinux" (upstream) branch. The "lukeshu/ng" branch is all of the changes on the "lukeshu/libretools" branch rebased on to "archlinux". I did this instead of a simple merge so that I wouldn't have to worry about the "big picture" when resolving conflicts; with rebasing I could look at each atomic change. Notable conflicts: - "makechrootpkg: _chrootprepare: Clean srcdest and startdir." I totally dropped this commit. The surrounding code was removed in upsteam commit ca819a235791 ("makechrootpkg: Simplify chroot preparation (v2)"). The change originated in libretools commit 564a4cfa06a8, but my commit message doesn't give any insight as to why I made that change. I've also scanned the issue tracker, and found no hints. So dropping this is a little scary; I don't know why I thought it was important in the first place. - "makechrootpkg, arch-nspawn: Force-enable local '/repo/' repository." I moved the code that force-updates `/var/lib/pacman/sync/repo.db from _chrootprepare() into prepare_chroot(). Other than that, conflicts were mostly just the context changing.
2017-02-19Merge branch 'lukeshu/libretools-to-upstream' into lukeshu/libretoolsLuke Shumaker
The 'lukeshu/libretools' branch is is all of the .patch files (and some edit scripts) from libretools.git being applied. The 'lukeshu/libretools-to-upstream' branch is all of these changes broken apart into atomic commits (i.e., suitable to be sent upstream). That is; they are two different patch-sets to get to the same tree.
2017-02-19lib/common.sh: Tidy formatting.Luke Shumaker
2017-02-19lib/common.sh: simplify include-guardLuke Shumaker
2017-02-19makechrootpkg: re-add "main" callLuke Shumaker
2017-02-19makechrootpkg: tidyLuke Shumaker
2017-02-19makechrootpkg: re-indentLuke Shumaker
2017-02-19mkarchroot: Use librelib rather than PATH to find arch-nspawn.Luke Shumaker
2017-02-19lib/common.sh: Discourage use in favor of libremessages.Luke Shumaker
2017-02-19checkpkg, find-libdeps, finddeps, lddd: Use libremessages to add help text.Luke Shumaker
2017-02-19lib/common.sh: Internationalize.Luke Shumaker
2017-02-19makechrootpkg: Avoid having code floating around outside of a function.Luke Shumaker
This means wrapping variable initialization in init_variables(), and the main program routine in main(). I did NOT put `shopt -s nullglob` in to a function.
2017-02-19makechrootpkg: Adjust to have the functions work with `set -u`.Luke Shumaker
Even though main() doesn't call `set -u`; this way the functions will continue to work if copied into an environment with `set -u`, or so that we are ready if we ever want to start using `set -u`.
2017-02-19makechrootpkg, arch-nspawn: Force-enable local '/repo/' repository.Luke Shumaker
The change in arch-nspawn is subtle: This was the source of "infamous" "it fails every other time" bug that took me over a year to solve. <https://labs.parabola.nu/issues/435> By having a repository of local packages (rather than simply running `pacman -U`), we are inviting pacman to cache them in `/var/cache/pacman/pkg`. Besides being needless disk writes, this actually causes a real issue. If the package gets rebuilt, pacman will balk, as the file no longer matches the cached signature. So, how do we prevent pacman from caching these local packages? Simple: include the directory they are already in in the pacman.conf:CacheDir list. This will prevent pacman from copying the files to one of the other cache directories.
2017-02-19makechrootpkg: move_products: Mimic `makepkg` and symlink products into PWD.Luke Shumaker
2017-02-19makechrootpkg: _chrootbuild: Split into _chroot{prepare,build}.Luke Shumaker
2017-02-19makechrootpkg: Detect the chroottype in individual functions, not globally.Luke Shumaker
2017-02-19makechrootpkg: Have functions be more function-y.Luke Shumaker
Rather than them simply being named blocks of code with braces around them. That is: have them take things via arguments rather than global variables. Specific notes: - download_sources: Observation: if $SUDO_USER is set, then src_owner=$SUDO_USER. So (for clarity), rather than checking if $SUDO_USER is set, check if $src_owner is different than $USER. This reduces how much we have to worry about global state. - install_packages: 1. Receive the list of packages as arguments, rather than a global variable. 2. Make the caller responsible for looking at PKGBUILD. From the name and arguments, one would never expect it to look at PKGBUILD. - create_chroot->sync_chroot: I pulled the `if [[ ! -d $copydir ]] || $clean_first;` check out; it is now the caller's responsibility to use that check when deciding if to call sync_chroot.
2017-02-19makechrootpkg: Improve status messages.Luke Shumaker
2017-02-19makechrootpkg: Quote directory passed to `rm -rf`.Luke Shumaker
2017-02-19mkarchroot: Don't let the environment affect pacstrap (sans proxy settings).Luke Shumaker
A previous iteration of this change (libretools commit d7dcce53396d) simply inserted `env -i` to clear the environment. However, that lead to it ignoring proxy settings, which some users had problems with: https://labs.parabola.nu/issues/487: > To fix other bugs, the pacstrap environment is blank, which also > means that the proxy settings are blank. So (in libretools commit d17d1d82349f), I changed it to use `declare -x` to inspect the environment, and create a version of it only consisting of variables ending with "_proxy" (case-insensitive). I honestly don't remember what "other bugs" prompted me to clear the environment in the first place.
2017-02-19mkarchroot, arch-nspawn: Add an `-s` flag to inhibit `setarch`.Luke Shumaker
This allows us to run an ARM chroot on an x86 box; as the binfmt runner will set the architecture for us, and the x86 `/usr/bin/setarch` program won't know about the ARM architecture string.
2017-02-19mkarchroot, arch-nspawn: Add an `-f` flag to add files to copy.Luke Shumaker
This allows us to copy in files like `qemu-arm-static`, which is necessary for running an ARM chroot on an x86 box.
2017-02-19lib/common.sh: Make it safe to include multiple times.Luke Shumaker
This is similar to common C #ifdef guards. I was tempted to wrap the entire thing in the if/fi (rather than use 'return' to bail early. However, that means it won't execute anything until after it reaches 'fi'. And if `shopt -s extglob` isn't executed before parsing, then it will syntax-error on the extended globs. One solution would have been to move `shopt -s extglob` up above the include-guard. But the committed solution is all-around simpler.
2017-02-19arch-nspawn: add a table of CARCH/setarch overrides (just armv7h->armv7lLuke Shumaker
for now)
2017-02-16Add a "License:" tag to all code files.Luke Shumaker
2017-02-16makechrootpkg: Be recursive when deleting btrfs subvolumes.Luke Shumaker
Motivation: tmpfiles.d(5) has directives to create btrfs subvolumes. This means that systemd-tmpfiles (which may be called by an ALPM hook) might create subvolumes. For instance, systemd's systemd-nspawn.conf creates a subvolume at `/var/lib/machines/`. This causes a problem when we go to delete the chroot. The command `btrfs subvolume delete` won't recursively delete subvolumes; if a child subvolume was created, it will fail with the fairly unhelpful error message "directory not empty". Solution: Because the subvolume that gets mounted isn't necessarily the toplevel subvolume, and `btrfs subvolume list` gives us paths relative to the toplevel; we need to figure out how our path relates to the toplevel. Figure out the mountpoint (which turns out to be slightly tricky; see below), and call `btrfs subvolume list -a` on it to get the list of subvolumes that are visible to us (and quite possibly some that aren't; the logic for determining which ones it shows is... absurd). This gives us a list of subvolumes with numeric IDs, and paths relative to the toplevel (actually it gives us more than that, and we use a hopefully-correct `sed` expression to trim it down) So then we look at that list of pairs and find the one that matches the ID of the subvolume we're trying to delete (which is easy to get with `btrfs subvolume show`); once we've found the path of our subvolume, we can use that to filter and trim the complete list of paths. From there the remainder of the solution is obvious. Now, back to "figure out the mountpoint"; the normal `stat -c %m` doesn't work. It gives the mounted path of the subvolume closest to the path we give it, not the actual mountpoint. Now, it turns out that `df` can figure out the correct mountpoint (though I haven't investigated how it knows when stat doesn't; but I suspect it parses `/proc/mounts`). So we are reduced to parsing `df`'s output. Now, back to "hopefully-correct `sed` expression"; the output of `btrfs subvolume list -a` is a space-separated sequence of "key value key value...". Unfortunately both keys and values can contain space, and there's no escaping or indication of when this happens. With how we choose to parse it, a path containing a space is truncated at the first space. This means that at least the prefix is correct; if a path gets mangled, it just means that the deletion fails. As "path" is (currently) the last key, it seems tempting to allow it to simply run until the end of the line. However, this creates the possibility of a path containing " path ", which would cause the *prefix* to be trimmed, which means our failure case is now unpredictable, and potentially harmful. While we pretty much trust the user, that's still scary.
2017-02-16arch-nspawn: usage(): Style improvement: two spaces after a period.Luke Shumaker
2017-02-16makechrootpkg: /chrootbuild accept makepkg_args as arguments rather than ↵Luke Shumaker
embedding.
2017-02-16makechrootpkg: usage(): Display the actual default makepkg flags.Luke Shumaker
It was displaing the value of the `makepkg_args` variable, which may have already been changed by the argument parsing by the time it gets to `-h`. Now there is a separate `default_makepkg_args` variable.
2017-02-16Avoid using string interpolation; use printf format strings instead.Luke Shumaker
This involves extending the signature of lib/common.sh's `stat_busy()`, `lock()`, and `slock()`. The `mesg=$1; shift` in stat_busy even suggests that this is what was originally intended from it.
2017-02-16commitpkg: Adjust fancy quoting/escaping to not confuse Emacs.Luke Shumaker
It was confusing Emacs and screwing up the syntax highlighting and auto-indentation for the rest of the file.
2017-02-16lib/common.sh: Adjust to work properly with `set -u`.Luke Shumaker
2017-02-15mkarchroot: Use librelib rather than PATH to find arch-nspawn.Luke Shumaker
2017-02-15lib/common.sh: Discourage use in favor of libremessages.Luke Shumaker
2017-02-15checkpkg, find-libdeps, finddeps, lddd: Use libremessages to add help text.Luke Shumaker
2017-02-15lib/common.sh: Internationalize.Luke Shumaker
2017-02-15makechrootpkg: Avoid having code floating around outside of a function.Luke Shumaker
This means wrapping variable initialization in init_variables(), and the main program routine in main(). I did NOT put `shopt -s nullglob` in to a function.
2017-02-15makechrootpkg: Adjust to have the functions work with `set -u`.Luke Shumaker
Even though main() doesn't call `set -u`; this way the functions will continue to work if copied into an environment with `set -u`, or so that we are ready if we ever want to start using `set -u`.
2017-02-15makechrootpkg, arch-nspawn: Force-enable local '/repo/' repository.Luke Shumaker
The change in arch-nspawn is subtle: This was the source of "infamous" "it fails every other time" bug that took me over a year to solve. <https://labs.parabola.nu/issues/435> By having a repository of local packages (rather than simply running `pacman -U`), we are inviting pacman to cache them in `/var/cache/pacman/pkg`. Besides being needless disk writes, this actually causes a real issue. If the package gets rebuilt, pacman will balk, as the file no longer matches the cached signature. So, how do we prevent pacman from caching these local packages? Simple: include the directory they are already in in the pacman.conf:CacheDir list. This will prevent pacman from copying the files to one of the other cache directories.
2017-02-15makechrootpkg: move_products: Mimic `makepkg` and symlink products into PWD.Luke Shumaker
2017-02-15makechrootpkg: _chrootprepare: Clean srcdest and startdir.Luke Shumaker
2017-02-15makechrootpkg: _chrootbuild: Split into _chroot{prepare,build}.Luke Shumaker
2017-02-15makechrootpkg: Detect the chroottype in individual functions, not globally.Luke Shumaker
2017-02-15makechrootpkg: Have functions be more function-y.Luke Shumaker
Rather than them simply being named blocks of code with braces around them. That is: have them take things via arguments rather than global variables. Specific notes: - download_sources: Observation: if $SUDO_USER is set, then src_owner=$SUDO_USER. So (for clarity), rather than checking if $SUDO_USER is set, check if $src_owner is different than $USER. This reduces how much we have to worry about global state. - install_packages: 1. Receive the list of packages as arguments, rather than a global variable. 2. Make the caller responsible for looking at PKGBUILD. From the name and arguments, one would never expect it to look at PKGBUILD. - create_chroot->sync_chroot: I pulled the `if [[ ! -d $copydir ]] || $clean_first;` check out; it is now the caller's responsibility to use that check when deciding if to call sync_chroot.
2017-02-15makechrootpkg: Improve status messages.Luke Shumaker
2017-02-15makechrootpkg: Quote directory passed to `rm -rf`.Luke Shumaker
2017-02-15mkarchroot: Don't let the environment affect pacstrap (sans proxy settings).Luke Shumaker
A previous iteration of this change (libretools commit d7dcce53396d) simply inserted `env -i` to clear the environment. However, that lead to it ignoring proxy settings, which some users had problems with: https://labs.parabola.nu/issues/487: > To fix other bugs, the pacstrap environment is blank, which also > means that the proxy settings are blank. So (in libretools commit d17d1d82349f), I changed it to use `declare -x` to inspect the environment, and create a version of it only consisting of variables ending with "_proxy" (case-insensitive). I honestly don't remember what "other bugs" prompted me to clear the environment in the first place.
2017-02-15mkarchroot, arch-nspawn: Add an `-s` flag to inhibit `setarch`.Luke Shumaker
This allows us to run an ARM chroot on an x86 box; as the binfmt runner will set the architecture for us, and the x86 `/usr/bin/setarch` program won't know about the ARM architecture string.
2017-02-15mkarchroot, arch-nspawn: Add an `-f` flag to add files to copy.Luke Shumaker
This allows us to copy in files like `qemu-arm-static`, which is necessary for running an ARM chroot on an x86 box.