Commit Graph

875 Commits

Author SHA1 Message Date
Bartłomiej Piotrowski ab3368f061 Remove corepkg symlink
While still possible with 'commitpkg core', there is a chance it will
prevent accidental pushes straight to [core].
2018-03-24 20:35:09 +01:00
Bartłomiej Piotrowski 38c7a391b0 makechrootpkg: make sure that makepkg.conf is always parsed as text 2018-01-21 14:18:43 +01:00
Luke Shumaker 75ad2aca57 makechrootpkg: Adjust to work properly with `set -e`
This worked properly until eab5aba.
2018-01-21 14:16:10 +01:00
Luke Shumaker aee72cae32 lib/common.sh: Adjust to work properly with `set -u`
Support for working with `set -u` was broken by 94160d6.  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.
2018-01-21 14:16:10 +01:00
Luke Shumaker 5ab8f8430a arch-nspawn: Remove pointless $(echo ...) subshell 2018-01-21 14:16:10 +01:00
Luke Shumaker c9e287e845 arch-nspawn: make sure that makepkg.conf is always parsed as text
https://lists.parabola.nu/pipermail/dev/2017-June/005576.html
2018-01-21 14:16:10 +01:00
Eli Schwartz 48b2f8dcc4 makechrootpkg: Fix anti-pattern when checking for enabled features
Don't use error-prone logic e.g.
foo=true; if $foo ...

This completely fails to act as expected when the variable is unset
because of unrelated bugs.

While this merely causes the default behavior to be "false" rather than
"true" in such cases, it is better to fail to enable explicitly
requested behavior (which will be noticed by the user) than to simply
upgrade to this behavior for free (which may not seem to have any
obvious cause).

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
2018-01-21 14:16:10 +01:00
Eli Schwartz 3b725b5843 makechrootpkg: Fix unconditionally running namcap
Fixes regression in 2fd5931a8c

$run_namcap will always be set to ""
`if $not_a_var; then ...; fi` is always truthful when $not_a_var is
unset or equal to "" and the `then` clause will always be run.

I'm not sure why global state variables need to be cloned locally for
their sole explicit purpose.

But for now this patch implements the minimum necessary work to properly
pass the "do I want namcap" variable into prepare_chroot() according to
the current logic flow.
Note that I have still not thorougly tested makechrootpkg.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
2018-01-21 14:16:10 +01:00
Evangelos Foutras 7a3c508501 Revert "makechrootpkg: Reopen console to assign the CTTY"
This reverts commit ddd508efc0.

The underlying bug (FS#56529) was fixed in glibc 2.26-9.
2017-12-27 23:33:45 +02:00
Eli Schwartz eab5aba9b0 Support reproducible builds
Recent development versions of makepkg support reproducible builds
through the environment variable SOURCE_DATE_EPOCH. Pass this variable
through makechrootpkg to makepkg when available.

Also initialize SOURCE_DATE_EPOCH whenever running archbuild to enforce
reproducible builds for repository packages.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2017-11-22 16:35:25 +01:00
Bartłomiej Piotrowski 2a308821b3 Version 20171108 2017-11-08 14:23:26 +01:00
Bartłomiej Piotrowski 7259e7def0 Remove i686 support 2017-11-08 14:22:56 +01:00
Luke Shumaker 94160d62b8
use makepkg library instead of local function copies
This mirrors dbscripts commit
625fa02 by Pierre Schmitz <pierre@archlinux.de> at 2017-04-18 14:20:49
2017-10-30 16:03:15 +01:00
Luke Shumaker 095e5305e4
makechrootpkg: Fix function usage comments
A couple of the comments noting which globals are used by functions are
outdated/wrong.

 - download_sources() : Remove USER from the list.  It was always wrong.
   Originally, it should have been SUDO_USER (not USER), but I should have
   removed it entirely in 4f23609.

 - move_products() : Add SRCPKGDEST to the list.  Though the commit adding
   the comment was only recently upstreamed (as 2fd5931), it originated in
   2013 in a commit that has since  been rebased many times.  Anyway, in
   this rebasing, it missed move_products() starting to pay attention to
   SRCPKGDEST in fd1be1b (since nothing made git think there was a
   "conflict").
2017-10-30 15:59:38 +01:00
Luke Shumaker e4db687d10
makechrootpkg: move init_variables() to be part of main()
The reason it wasn't moved before was just to keep the diffs
(with --ignore-all-space) smaller, to make merging and rebasing work
easier.  Moving code around in a file tends to make that difficult.

But, readability wise, it belongs in main().
2017-10-30 15:59:05 +01:00
Jan Alexander Steffens (heftig) ddd508efc0
makechrootpkg: Reopen console to assign the CTTY
nspawn does not give us a controlling terminal, hence we ignore
interrupts. Apparently this was lost in systemd at some point.

Hack around this by reopening the console to make it the controlling
terminal.
2017-09-14 23:33:47 +02:00
Jan Alexander Steffens (heftig) 0f3778c3d3
makechrootpkg: Prevent collecting coredumps
Coredumps from build chroots are not generally useful. Prevent
them from being generated.

Avoids a lot of annoyance from the GCC testsuite spawning lots of
systemd-coredump processes.

Just set the soft limit so the user can still raise it in the PKGBUILD
if they insist.
2017-09-14 23:31:36 +02:00
Jan Alexander Steffens (heftig) 6b55282bd7
Revert "arch-nspawn: Hack to give the inner process a controlling terminal"
Whoops, this will of course mess with nspawn arguments passed to
arch-nspawn.
2017-09-13 00:25:06 +02:00
Jan Alexander Steffens (heftig) 6a7dcdeff9
arch-nspawn: Hack to give the inner process a controlling terminal
This was lost at some point.
2017-09-13 00:17:49 +02:00
Jan Alexander Steffens (heftig) cd500d161f
arch-nspawn: Pass --as-pid2
As not all commands we run are capable of reaping processes correctly.
For example, pacman is not.
2017-09-12 23:27:07 +02:00
Sébastien Luttringer 5ebb9c16c0 Version 20170911 2017-09-11 21:26:07 +02:00
Sébastien Luttringer fecf107c37 arch-nspawn: Force PATH to be the Arch default
systemd-nspawn use a default environ PATH value of:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Since filesystem 2017.08, this is no more overrided by /etc/profile
to the Arch default:
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin
2017-09-11 21:21:51 +02:00
Jan Alexander Steffens (heftig) bd826752c9
makechrootpkg: Also look for -e as --noextract 2017-08-24 17:20:59 +02:00
Martchus d0e684d2e9
makechrootpkg: Prevent removing build dir when --noextract specified 2017-08-24 17:20:59 +02:00
Jan Alexander Steffens (heftig) 000ea6c7bb
arch-nspawn: Add --keep-unit to prevent scope conflicts 2017-08-24 17:03:32 +02:00
Jan Alexander Steffens (heftig) 5715134884
Version 20170813 2017-08-13 01:24:11 +02:00
Jan Alexander Steffens (heftig) 75fdff1811
makechrootpkg: Skip integrity checks inside the chroot
We've already done these during download_sources().
2017-07-13 19:43:52 +02:00
Jan Alexander Steffens (heftig) 0cbc179d21
makechrootpkg: Use long args for makepkg
Slightly more verbose, but also more understandable.
2017-07-13 19:42:01 +02:00
Jan Alexander Steffens (heftig) a8f512a665
makechrootpkg: Move makepkg-as-root check to main()
download_sources(), while the first invocation of makepkg, is a rather
odd place for this kind of guard.
2017-07-13 19:37:15 +02:00
Jan Alexander Steffens (heftig) 086ff8b9e7
archrelease: Whitespace adjustment 2017-07-05 18:35:16 +02:00
Laurent Carlier via arch-projects 041afb5f07
archrelease: sync the repos directory before commiting changes 2017-07-05 18:23:38 +02:00
Luke Shumaker 3efa4b7bf5
makechrootpkg: Fix broken symlinks because of chroot SRCPKGDEST /srcpkgdest
Commit 58968cf fixed symlinks for package products in $startdir in
light of the simplified chroot setup.  However, a similar change needs
to be made for source-package products.  This was an easy omission to
make because makechrootpkg does not produce source-pakcages by
default.
2017-07-05 18:22:31 +02:00
Luke Shumaker a9dab95334
Add `# shellcheck` directives to quiet shellcheck, add PKGBUILD.proto
The added PKGBUILD.proto file is so that shellcheck can know know what
to expect that a PKGBUILD sets.
2017-07-05 18:21:56 +02:00
Luke Shumaker a396a69081
Make slightly more involved changes to make shellcheck happy.
- 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)
2017-07-05 18:21:56 +02:00
Luke Shumaker 78fabcfa06
Quote strings that shellcheck warns about.
These changes are all strictly "slap some double-quotes in there".
Anything more than that is not included in this commit.
2017-07-05 18:21:56 +02:00
Luke Shumaker 3f72579b28
Make purely stylistic changes to make shellcheck happier.
These are purely stylistic changes that make shellcheck complain less.

This does NOT include things like quoting currently unquoted variables.
2017-07-05 18:21:55 +02:00
Luke Shumaker 430e1265fb
Makefile: Add a simple 'check' target that runs shellcheck 2017-07-05 18:21:55 +02:00
Luke Shumaker 56cace32b2
makechrootpkg: Add a comment warning about a bug in "sudo -i"
The bug isn't currently triggered, but I accidentally did trigger when I
was trying to modify the command a bit.  I figure a "caution" sign would be
helpful to any future developers.
2017-07-05 18:21:55 +02:00
Luke Shumaker 2fdd1654b5
Makefile: m4_changequote([[[, ]]]) to avoid accidental quoting.
The default m4 quote characters: `QUOTE' are troublesome, because ` is
fairly likely to pop up in a shell script (if not for a subshell, because
it is a useful character in comments and user-facing messages).

So, this changes it to [[[QUOTE]]], as it is unlikely to see three braces
together like that, let alone in unbalanced sets.
2017-07-05 18:21:55 +02:00
Luke Shumaker 007d6fc15f
Makefile: add .DELETE_ON_ERROR:
The absence of it was allowing an (m4-produced) syntax error in
in a change I had made to be masked.
2017-07-05 18:21:55 +02:00
Luke Shumaker 4f23609d4e
makechroot: download_sources: Accept makepkg_owner as an argument
What this is really doing is fixing a conflict that I had incorrectly
resolved when rebasing what became 2fd5931 onto cda9cf4.  Of course,
because of dynamic scoping, everything worked out, and everything worked as
intended.

Before cda9cf4, it was appropriate for download_sources to take src_owner
as an argument, but after cda9cf4, it is now appropriate to take
makepkg_user as an argument.  However, it still takes src_owner as an
argument, but pays 0 attention to it; instead looking at makepkg_user which
it happily inherited because of dynamic scoping.

So change it to take makepkg_user as the argument.
2017-07-05 18:21:55 +02:00
Luke Shumaker 31a800fd88
lib/archroot.sh: subvolume_delete_recursive: support arbitrary recursion
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.
2017-07-05 18:21:55 +02:00
Luke Shumaker 6d1992909c
makechrootpkg: sync_chroot: Make more general.
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.
2017-07-05 18:21:55 +02:00
Luke Shumaker 928744cbc4
makechrootpkg: sync_chroot: make usage easier to understand.
Also, shorten the "Synchronizing" message to only include the full path
to the copy if it was specified.

The capslocked variable names in the Usage comment were references to
things in Parabola's tools, that didn't make much sense here out of
context.
2017-07-05 18:21:54 +02:00
Luke Shumaker 2a9b30ed35
makechrootpkg: delete_chroot: Fix the is-btrfs-subvolume check.
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
2017-07-05 18:21:54 +02:00
Bartłomiej Piotrowski c9b1fc08b5 Sync makepkg.conf files with pacman 5.0.2-2 2017-07-04 12:04:51 +02:00
Luke Shumaker 49088b0860
makechrootpkg: Avoid having code floating around outside of a function.
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.

It make make sense to move init_variables() down into the main()
function, instead of having it as a separate function up top (if this
done, then the `-g` flag passed to `declare` in init_variables() can
be dropped).  However, in interest of keeping the `diff -w` small, and
merges/rebases simpler, this isn't done here.
2017-04-17 03:11:34 +02:00
Jan Alexander Steffens (heftig) a1f8ac9c70
makechrootpkg: Delete chroot subvols recursively when using -T
I overlooked this one. Fixes FS#53513.
2017-04-09 02:37:24 +02:00
Jan Alexander Steffens (heftig) 2243a276e4
makechrootpkg: Unindent as suggested in 2fd5931 2017-04-05 22:20:01 +02:00
Luke Shumaker 578a62f1e0
mkarchroot: Don't let the environment affect pacstrap (sans proxy settings).
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-04-05 22:17:51 +02:00