Commit Graph

37 Commits

Author SHA1 Message Date
Eli Schwartz f8f2f02028
archbuild: use better umask
In commit 40a90e2cab we tried to protect
against system umasks resulting in unreadable chroots. However, we tried
to do this in a targeted manner due to not wanting to fiddle with
permissions for user-owned files. Unfortuantely, mkdir -p -m755 does not
actually work that way -- the parent directory is created with broken
permissions. We need umask.

Run umask and mkdir in a subshell to prevent leakage.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
2019-11-30 13:21:23 +01:00
Levente Polyak 144f896660
makechrootpkg: run checkpkg automatically after build
Cache previous versions required for checkpkg via pacman to avoid
multiple downloads when running multiple times.

In case we can't download the packages, like while building out of repo
packages, print a warning instead of running checkpkg

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2019-09-28 00:15:33 +02:00
Eli Schwartz 10c6efc440
archbuild: prefer repo/arch-specific configs if they exist
When mixing and matching different repos and architectures not present
in mainline archlinux, it is sometimes desirable to set up differing
presets with more granularity than devtools currently allows.

One example of this is when building for architectures that are only
supported by another project -- in order to coexist on a mainline
archlinux host, a different mirrorlist needs to be used.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2019-08-09 19:41:53 +02:00
Eli Schwartz 8e4293034b
makechrootpkg: also downgrade packages when updating chroots
Packages should never be getting downgraded... unless a package is
pulled from testing, e.g. for example if gcc9 totally breaks the linux
kernel. In such cases, the master repo says there is a downgrade, so
we'd better go with that. Basically, ensure that packages match the repo
they are being built against. Consistency at all costs!

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2019-08-09 19:41:53 +02:00
Eli Schwartz 40a90e2cab
ensure that sane umask is used where needed
If a user umask is restrictive, a chroot may be created as root without the
ability for the user to read it, which then causes makepkg
--verifysource to fail.

Do not set this in lib/common.sh, where it would apply to all scripts,
as we do not want to override the user's policy for things like $SRCDEST
files, svn checkouts, etc.

Fixes FS#47625

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2019-08-09 19:41:52 +02:00
Erich Eckner 321e998020
fix whitespace/indentation errors
Some lines are indented by spaces, while adjacent lines are indentet by tabs.
We should use tabs on both.

Signed-off-by: Erich Eckner <git@eckner.net>
2019-04-20 17:58:55 +02:00
Morten Linderud 7b09525003
Expand check_root keepenv variables
Les us source makepkg.conf settings from the environemnt. This also includes
`GNUPGHOME` which is present in `makechrootpkg`, but not included in archbuild.

Signed-off-by: Morten Linderud <foxboron@archlinux.org>
2019-01-22 01:29:06 +01: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
Luke Shumaker cb35d74f8c
Avoid using string interpolation; use printf format strings instead.
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-04-05 22:11:16 +02:00
Luke Shumaker 14d5e1c21b
Add a "License:" tag to all code files.
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.
2017-04-05 22:10:03 +02:00
Luke Shumaker 997bc1dc0d
lib/common.sh: add 'lock_close'; use it as appropriate.
`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).
2017-04-05 22:03:00 +02:00
Jan Alexander Steffens (heftig) eec7fcf965
archbuild/makechrootpkg: Delete subvolumes in roots
The systemd package creates a subvolume at /var/lib/machines (through
tmpfiles), if it can. We need to delete this subvolume before we can
delete the parent subvolume.

Look through the root for inodes with the number 256. These identify
subvolume roots.
2017-03-07 20:39:11 +01:00
Jan Alexander Steffens (heftig) c53a3e8017
lib/archroot.sh: Add is_btrfs helper 2017-03-07 20:37:54 +01:00
Jan Alexander Steffens (heftig) 45f87aa9d5
lib/archroot.sh: Simplify check_root
Move the function and save the orig_argv right along it.
2017-03-07 19:35:09 +01:00
Dave Reisner bf7dc83bab save and reuse original argv when auto-elevating
Fixes FS#42277.
2014-10-19 16:48:03 -04:00
Luke Shumaker 6dce935b99 archbuild: Fix a variable name mistake. ($copydir -> $copy)
It tried to lock `$copydir.lock`, which was the ONLY mention of $copydir in
the entire file.  Surely it meant `$copy.lock`; the line was probably
originally copy/pasted from makechrootpkg or similar, where $copydir is
used.
2014-09-22 08:25:43 -04:00
Sébastien Luttringer 03611dc63e Switch to root when started as regular user
In collaborative builder machine, these scripts are often allowed to become root
via sudo. This patch avoid to prefix them by sudo each time or call su.

Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2014-05-10 08:05:08 +02:00
Jan Alexander Steffens (heftig) 38692e8d74 archbuild: Correct makechrootpkg argument order
The user-passed makechrootpkg_args may contain a "--" to pass
arguments to makepkg. In this case, the order is wrong.
2013-05-11 12:26:21 +02:00
Jan Alexander Steffens (heftig) 1489f75419 arch-nspawn: setarch to CARCH
Allows calling makechrootpkg without worrying about the architecture
2013-05-06 01:50:05 +02:00
Jan Alexander Steffens (heftig) a7a05deb37 lib/common.sh: Introduce locking helper functions
Reduces code duplication.

With makechrootpkg not calling mkarchroot anymore,
the lock handover protocol is unneeded.

arch-nspawn does not do any locking, so add protection to archbuild.
2013-05-03 04:34:29 +02:00
Jan Alexander Steffens (heftig) 453558c4bb mkarchroot: Refactor chroot running into a new script
Separates the two features of mkarchroot. Provides users of the new
arch-nspawn with the full feature set of systemd-nspawn.

For example, this can be used to bind custom directories into the chroot.
2013-05-02 10:33:24 +02:00
Pierre Schmitz 6caad191c1 Only try to use btrfs snapshots if chroots are on a btrfs partition 2013-04-06 19:50:17 +02:00
Sébastien Luttringer 89bda9217d archbuild: only use base-devel to new chroot
Since TODO [1] which state:
It would be good for base-devel to install everything needed for a build chroot
we can remove base and sudo

[1] https://www.archlinux.org/todo/add-more-to-base-devel/

Signed-off-by: Sébastien Luttringer <seblu@seblu.net>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2013-03-17 11:23:24 +01:00
Pierre Schmitz 10eba28151 archbuild: fix default build flags 2013-01-22 20:12:36 +01:00
Sébastien Luttringer fb71ad1e7f Allow makechroot options in archbuild
This will allow, by example, to easily build a package with a custom pkg.

staging-x86_64-build -- -cI /var/cache/pacman/pkg/ldoc-1.2.0-1-any.pkg.tar.xz
staging-x86_64-build -- -n

Signed-off-by: Sébastien Luttringer <seblu@seblu.net>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2013-01-20 10:21:31 +01:00
Eric Bélanger 890baf6891 Make sure the usage functions are consistent
The usage messages now begins with a "Usage:", i.e. capitalized and with a colon. Fixes FS#26956.

Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2012-11-15 15:25:07 +01:00
Pierre Schmitz 37bb1d33a7 archbuild: abort if update or creation of the chroot fails 2012-10-03 12:32:03 +02:00
Pierre Schmitz b14a1b1bcc archbuild: do not cross filesystems when removing the chroot copies 2012-06-16 15:28:52 +02:00
Pierre Schmitz 0cd9e1ae7e archbuild: use flock -n as we do elsewhere 2012-06-16 15:24:16 +02:00
Pierre Schmitz e44c49aebb archbuild: Store chroots in /var/lib instead of /var/tmp
/var/tmp is cleaned up by tmpfiels by default which we cannot handle gracefully.
2012-06-12 06:53:11 +02:00
Pierre Schmitz c2d9a0e7b1 Set correct pacman.conf
Commit ee4edefa2f reverted too much and left pacman.conf unset
2012-01-18 16:56:41 +01:00
Pierre Schmitz ee4edefa2f Remove any pacman 4 related workarounds 2012-01-18 11:24:07 +01:00
Dave Reisner 0e32334cca archbuild: exec makechrootpkg to preserve exit value
This fixes a compound command such as the one below from continuing even
if the first fails.

  extra-x86_64-build && extra-i686-build

The problem is that 'cleanup 0' is triggered in archbuild even after an
unsucessful call to makechrootpkg. Since both archbuild and
makechrootpkg share the exact same cleanup function (from lib/common),
we simply force the shell to exit with the true return value by exec'ing
the call to makechrootpkg.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2011-12-04 18:13:13 +01:00
Pierre Schmitz 671643053d archbuild: Always use recent makepkg.conf and pacman.conf; Run namcap by default 2011-11-06 10:32:55 +01:00
Pierre Schmitz aaa68e49e8 Move common functions to a shared file
* common.sh is included on build time
* most functions are copied from makepkg
2011-11-01 15:33:08 +01:00
Pierre Schmitz e333a4da81 temporary workaround until pacman 4.0 moves to [core]
Pacman 3 refuses to work with the pacman 4 SigLevel config entry

Also related: https://bugs.archlinux.org/task/26555
2011-10-29 21:46:19 +02:00
Lukas Fleischer 46c4def073 Support non-standard install locations
This build system overhaul allows for adding (define-style) macros to
our scripts. All source files are now suffixed with ".in" to clarify
that they might contain unprocessed defines. The Makefile provides a new
rule to preprocess source files and generate proper output scripts.

Also, add a "@pkgdatadir@" define (as used in GNU Autotools) and use it
instead of hardcoded paths to "/usr/share/devtools" everywhere. We
missed this when adding PREFIX support to the build system in commit
35fc83ce7d.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-10-07 21:53:02 +02:00