Skip to content
Snippets Groups Projects
  1. Jan 21, 2018
    • Luke Shumaker's avatar
      lib/common.sh: Adjust to work properly with `set -u` · aee72cae
      Luke Shumaker authored
      Support for working with `set -u` was broken by 94160d62.  Egg on my
      face; I'm the one who wants `set -u` support, and I'm the author of
      that commit!
      
      libmakepkg does not work with `set -u`; but mostly because of the include
      guards!  So we just need to temporarily disable `set -u` (nounset) while
      loading libmakepkg.  Instead of introducing a new variable, just store the
      initial nounset status in _INCLUDE_COMMON_SH; rather than a useless
      fixed-string "true".
      
      While we're at it, disable POSIX-mode (just in case we're running as "sh"
      instead of "bash"), since libmakepkg uses bash-isms that won't parse in
      POSIX mode.
      aee72cae
  2. Nov 22, 2017
  3. Nov 08, 2017
  4. Oct 30, 2017
  5. Jul 05, 2017
    • Luke Shumaker's avatar
      Add `# shellcheck` directives to quiet shellcheck, add PKGBUILD.proto · a9dab953
      Luke Shumaker authored
      The added PKGBUILD.proto file is so that shellcheck can know know what
      to expect that a PKGBUILD sets.
      a9dab953
    • Luke Shumaker's avatar
      Make slightly more involved changes to make shellcheck happy. · a396a690
      Luke Shumaker authored
       - Use `read -r` instead of other forms of read or looping
       - Use arrays instead of strings with whitespaces.
       - In one instance, use ${var%%.*} instead of $(echo $var|cut -f. -d1)
      a396a690
    • Luke Shumaker's avatar
      Quote strings that shellcheck warns about. · 78fabcfa
      Luke Shumaker authored
      These changes are all strictly "slap some double-quotes in there".
      Anything more than that is not included in this commit.
      78fabcfa
    • Luke Shumaker's avatar
      Make purely stylistic changes to make shellcheck happier. · 3f72579b
      Luke Shumaker authored
      These are purely stylistic changes that make shellcheck complain less.
      
      This does NOT include things like quoting currently unquoted variables.
      3f72579b
    • Luke Shumaker's avatar
      lib/archroot.sh: subvolume_delete_recursive: support arbitrary recursion · 31a800fd
      Luke Shumaker authored
      The `-xdev` flag to `find` makes it not recurse over subvolumes; so it only
      supports recursion with depth=1.  Fix this by having the function
      recursively call itself.
      31a800fd
    • Luke Shumaker's avatar
      makechrootpkg: sync_chroot: Make more general. · 6d199290
      Luke Shumaker authored
      This is inspired by the thought that went in to the delete_chroot
      is_subvolume commit.
      
      sync_chroot($chrootdir, $copydir) copies `$chrootdir/root` to `$copydir`.
      That seems a little silly; why do we care about "$chrootdir"?  Have it just
      be sync_chroot(source, destination) like every other sync/copy command.
      
      Where this becomes tricky is check to decide if we are going to use btrfs
      subvolumes or not.  We don't care if "$source/.." is on btrfs; the root
      could be a directly-mounted subvolume, but and the destination could be
      another subvolume of the same btrfs mounted somewhere else.
      
      The things we do care about are:
      
       - The source is a btrfs subvolume (so that we can snapshot it)
       - The source is on the same filesystem as the directory that the copy will
         be created in.
       - If the destination exists:
         * that it is not a mountpoint (so that we can delete and recreate it)
         * that it is a btrfs subvolume (so that we can quickly delete it)
      
      On the last point, it isn't necessary for creating the new snapshot, just
      for quick deletion.  That can be a separate check, where we use regular
      `rm` for deleting the existing copy, but use subvolume snapshots for
      creating the new one.
      6d199290
    • Luke Shumaker's avatar
      makechrootpkg: delete_chroot: Fix the is-btrfs-subvolume check. · 2a9b30ed
      Luke Shumaker authored
      First of all, it ran `is_btrfs "$chrootdir"` to decide if it was on
      btrfs, but $chrootdir wasn't defined locally; it just happens to work
      because $chrootdir was defined in main().  (I noticed this because in
      Parabola, it is called differently, so $chrootdir was empty).
      
      So I was tempted to just change it to `is_btrfs "$copydir"`, but if
      $copydir is just a regular directory on a btrfs filesystem, then it
      It would leave much of $copydir intact.  What we really care about is
      if $copydir is a btrfs subvolume; which we can check by combining the
      is_btrfs check with inspecting the inum of the directory.
      
      I put this combined check in lib/archroot.sh:is_subvolume.
      
      https://lists.archlinux.org/pipermail/arch-projects/2013-September/003901.html
      2a9b30ed
  6. Apr 05, 2017
    • Luke Shumaker's avatar
      lib/common.sh: Make it safe to include multiple times. · c1a056c9
      Luke Shumaker authored
      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.
      c1a056c9
    • Luke Shumaker's avatar
    • Luke Shumaker's avatar
      Avoid using string interpolation; use printf format strings instead. · cb35d74f
      Luke Shumaker authored
      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.
      cb35d74f
    • Luke Shumaker's avatar
      Add a "License:" tag to all code files. · 14d5e1c2
      Luke Shumaker authored
      In cases where there is no license specified, the file is tagged as
      "License: Unspecified".  Obviously, that is not ideal, but it
      highlights the fact, and I hope that it encourages whoever has the
      authority to specify the license to do so.
      
      On that note, to anyone who may have the authority to specify the
      license of files in devtools: the current licence of many files is
      GPLv2 with no option for later versions; I impore you to re-license
      them to have the "or any later version" option.
      14d5e1c2
    • Luke Shumaker's avatar
      Add '#!/hint/bash' headers to non-executable bash files. · f55786b7
      Luke Shumaker authored
      This provides a cross-editor hint that the syntax of the file is Bash.
      f55786b7
    • Luke Shumaker's avatar
    • Luke Shumaker's avatar
    • Luke Shumaker's avatar
      lib/common.sh: lock, slock: Allow locks to be inherited. · d3334408
      Luke Shumaker authored
      Allow for locks to be inherited.  Inheriting the lock is something that
      mkarchroot could do previously, but has since lost the ability to do.  This
      allows for the programs to be more compos-able.
      
      Do this by instead of unconditionally opening $file on $fd, first check if
      $file is already open on $fd; and go ahead use it if it is.
      
      The naive way of doing this would be to `$(readlink /dev/fd/$fd)` and
      compare that to `$file`.  However, if `$file` is itself a symlink; or there
      is a symlink somewhere in the path to `$file`, then this could easily fail.
      Instead, check `[[ "/dev/fd/$fd" -ef "$file" ]]`.  Even though the Bash
      documentation (`help test`) says that `-ef` checks for if the two files are
      hard links to eachother, because it uses stat(3) (which resolves symlinks)
      to do this check, it also works with the /dev/fd/ soft links.
      d3334408
    • Luke Shumaker's avatar
      lib/common.sh: add 'lock_close'; use it as appropriate. · 997bc1dc
      Luke Shumaker authored
      `lock_close FD` is easier to remember than 'exec FD>&-`; and is especially
      easier if FD is a variable (though that isn't actually taken advantage of
      here).
      
      This uses Bash 4.1+ `exec {var}>&-`, rather than the clunkier
      `eval exec "$var>&-"` that was necessary in older versions of Bash.
      Thanks to Dave Reisner for pointing this new bit of syntax out to me
      the last time I submitted this (back in 2014, 4.1 had just come out).
      997bc1dc
  7. Mar 07, 2017
  8. Mar 04, 2017
  9. Nov 09, 2014
    • Ramon Buldó's avatar
      Update devtools to arch devtools 20141024 · 4b9f230c
      Ramon Buldó authored
      - Uses now systemd-nspawn, so its not compatible with openrc.
      - Added bash and zsh completion.
      - mkarchroot (mkmanjaroroot) lost the -b (branch) -a (arch) options instead you should copy the correct files using -M for makepkg (arch) or -S for pacman-mirrors (branch). The archbuild (manjarobuild) script have been updated to follow this.
      - makechrootpkg also lost the -b option (branch), instead it should point to a chroot with the correct branch and other config files already set.
      - manjarobuild and mkmanjaroroot are now symlinks to archbuild and mkarchroot (to keep differences from upstream to a minimum).
      - Includes all fixes and updates between upstream devtools-20130408 and devtools-20141024.
  10. Sep 22, 2014
    • Dave Reisner's avatar
      common: remove unreachable statement · 98841eb6
      Dave Reisner authored
      We run from a non-interactive shell, so the exec which is inevitably
      called will replace the current process and 'die' will never run under
      any circumstances.
      
      This also fixes a bug with the su fallback which would cause multiple
      arguments to be concatenated without any whitespace between them.
      98841eb6
    • Dave Reisner's avatar
      common.sh: propagate error through trap_exit · af6c0a0f
      Dave Reisner authored
      Fixes a breakage introduced in 6db31cc1 which leads to errors
      being masked from makechrootpkg.
      af6c0a0f
  11. May 10, 2014
  12. Nov 04, 2013
  13. Nov 01, 2013
    • Dave Reisner's avatar
      common: implement find_cached_package · 27441f20
      Dave Reisner authored
      
      This function (currently) searches through $PWD and $PKGDEST looking
      for a tarball matching the requested package name, architecture, and
      pkgver. If found, it writes the full path to the located package to
      stdout and returns 0, else 1. If more than 1 match is found, it's
      treated as an error and the user will need to figure out what to do.
      
      Use this in checkpkg and commitpkg, which previously implemented their
      own less complete logic, to locate the build artifacts they rely on.
      
      Signed-off-by: default avatarDave Reisner <dreisner@archlinux.org>
      Signed-off-by: default avatarPierre Schmitz <pierre@archlinux.de>
      27441f20
  14. Aug 08, 2013
  15. May 03, 2013
  16. May 01, 2013
  17. Oct 27, 2012
  18. Oct 03, 2012
Loading