mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-16 11:26:19 +02:00
Compare commits
9 Commits
v1.2.0
...
179-build-
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f77b767971 | ||
![]() |
144f9a871e | ||
![]() |
44328cd9a3 | ||
![]() |
0e2b16b0ac | ||
![]() |
6f0a8c345d | ||
![]() |
5f19853414 | ||
![]() |
2b62ac660d | ||
![]() |
7cb72699f6 | ||
![]() |
d1790c295a |
@@ -27,6 +27,7 @@ _makechrootpkg_args=(
|
|||||||
-I
|
-I
|
||||||
-l
|
-l
|
||||||
-n
|
-n
|
||||||
|
-t
|
||||||
-T
|
-T
|
||||||
-U
|
-U
|
||||||
-x
|
-x
|
||||||
@@ -36,6 +37,7 @@ _makechrootpkg_args_D_opts() { _filedir -d; }
|
|||||||
_makechrootpkg_args_r_opts() { _filedir -d; }
|
_makechrootpkg_args_r_opts() { _filedir -d; }
|
||||||
_makechrootpkg_args_I_opts() { _filedir '*.pkg.tar.*'; }
|
_makechrootpkg_args_I_opts() { _filedir '*.pkg.tar.*'; }
|
||||||
_makechrootpkg_args_l_opts() { _filedir -d; }
|
_makechrootpkg_args_l_opts() { _filedir -d; }
|
||||||
|
_makechrootpkg_args_t_opts() { _filedir -d; }
|
||||||
_makechrootpkg_args_U_opts() { :; }
|
_makechrootpkg_args_U_opts() { :; }
|
||||||
_makechrootpkg_args_x_opts() { _devtools_completions_inspect; }
|
_makechrootpkg_args_x_opts() { _devtools_completions_inspect; }
|
||||||
_makechrootpkg() { __devtools_complete _makechrootpkg; }
|
_makechrootpkg() { __devtools_complete _makechrootpkg; }
|
||||||
@@ -61,12 +63,14 @@ _mkarchroot_args=(
|
|||||||
-C
|
-C
|
||||||
-M
|
-M
|
||||||
-c
|
-c
|
||||||
|
-f
|
||||||
-h
|
-h
|
||||||
)
|
)
|
||||||
_mkarchroot_args_U_opts() { _filedir '*.pkg.tar.*'; }
|
_mkarchroot_args_U_opts() { _filedir '*.pkg.tar.*'; }
|
||||||
_mkarchroot_args_C_opts() { _filedir '*.conf'; }
|
_mkarchroot_args_C_opts() { _filedir '*.conf'; }
|
||||||
_mkarchroot_args_M_opts() { _filedir '*.conf'; }
|
_mkarchroot_args_M_opts() { _filedir '*.conf'; }
|
||||||
_mkarchroot_args_c_opts() { _filedir -d; }
|
_mkarchroot_args_c_opts() { _filedir -d; }
|
||||||
|
_mkarchroot_args_f_opts() { _filedir -d; }
|
||||||
_mkarchroot_opts() {
|
_mkarchroot_opts() {
|
||||||
local args
|
local args
|
||||||
args=$(__pkgctl_word_count_after_subcommand)
|
args=$(__pkgctl_word_count_after_subcommand)
|
||||||
|
@@ -222,6 +222,7 @@ _makechrootpkg_args=(
|
|||||||
'-c[Clean the chroot before building]'
|
'-c[Clean the chroot before building]'
|
||||||
'*-d[Bind directory into build chroot as read-write]:bind_dir_rw:_files -/'
|
'*-d[Bind directory into build chroot as read-write]:bind_dir_rw:_files -/'
|
||||||
'*-D[Bind directory into build chroot as read-only]:bind_dir_ro:_files -/'
|
'*-D[Bind directory into build chroot as read-only]:bind_dir_ro:_files -/'
|
||||||
|
'*-t[Mount a tmpfs at directory]:tmpfs_dir:_files -/'
|
||||||
'-u[Update the working copy of the chroot before building]'
|
'-u[Update the working copy of the chroot before building]'
|
||||||
'-r[The chroot dir to use]:chroot_dir:_files -/'
|
'-r[The chroot dir to use]:chroot_dir:_files -/'
|
||||||
'*-I[Install a package into the working copy]:target:_files -g "*.pkg.tar.*(.)"'
|
'*-I[Install a package into the working copy]:target:_files -g "*.pkg.tar.*(.)"'
|
||||||
@@ -237,6 +238,7 @@ _mkarchroot_args=(
|
|||||||
'-C[Location of a pacman config file]:pacman_config:_files -g "*.conf(.)"'
|
'-C[Location of a pacman config file]:pacman_config:_files -g "*.conf(.)"'
|
||||||
'-M[Location of a makepkg config file]:makepkg_config:_files -g "*.conf(.)"'
|
'-M[Location of a makepkg config file]:makepkg_config:_files -g "*.conf(.)"'
|
||||||
'-c[Set pacman cache]:pacman_cache:_files -/'
|
'-c[Set pacman cache]:pacman_cache:_files -/'
|
||||||
|
'-f[Copy src file from the host to the chroot]:target:_files -/'
|
||||||
'-h[Display usage]'
|
'-h[Display usage]'
|
||||||
'1:working_dir:_files -/'
|
'1:working_dir:_files -/'
|
||||||
'*:packages:_devtools_completions_all_packages'
|
'*:packages:_devtools_completions_all_packages'
|
||||||
|
@@ -28,8 +28,9 @@ Options
|
|||||||
*-c* <dir>::
|
*-c* <dir>::
|
||||||
Set pacman cache, if no directory is specified the passed pacman.conf's cachedir is used with a fallback to '/etc/pacman.conf'
|
Set pacman cache, if no directory is specified the passed pacman.conf's cachedir is used with a fallback to '/etc/pacman.conf'
|
||||||
|
|
||||||
*-f* <file>::
|
*-f* <src>[:<dst>]::
|
||||||
Copy file from the host to the chroot
|
Copy file from the host to the chroot.
|
||||||
|
If 'dst' is not provided, it defaults to 'src' inside of the chroot.
|
||||||
|
|
||||||
*-s*::
|
*-s*::
|
||||||
Do not run setarch
|
Do not run setarch
|
||||||
|
@@ -45,6 +45,9 @@ Options
|
|||||||
*-D* <dir>::
|
*-D* <dir>::
|
||||||
Bind directory into build chroot as read-only
|
Bind directory into build chroot as read-only
|
||||||
|
|
||||||
|
*-t* <dir>[:opts]::
|
||||||
|
Mount a tmpfs at 'dir'. See the '--tmpfs' argument in systemd-nspawn(1) for more details.
|
||||||
|
|
||||||
*-u*::
|
*-u*::
|
||||||
Update the working copy of the chroot before building
|
Update the working copy of the chroot before building
|
||||||
This is useful for rebuilds without dirtying the pristine
|
This is useful for rebuilds without dirtying the pristine
|
||||||
@@ -76,5 +79,9 @@ Options
|
|||||||
*-x* <when>::
|
*-x* <when>::
|
||||||
Inspect chroot after build, possible modes are 'never' (default), 'always' or 'failure'
|
Inspect chroot after build, possible modes are 'never' (default), 'always' or 'failure'
|
||||||
|
|
||||||
|
See Also
|
||||||
|
--------
|
||||||
|
|
||||||
|
systemd-nspawn(1)
|
||||||
|
|
||||||
include::include/footer.asciidoc[]
|
include::include/footer.asciidoc[]
|
||||||
|
@@ -32,8 +32,9 @@ Options
|
|||||||
*-c* <dir>::
|
*-c* <dir>::
|
||||||
Set pacman cache.
|
Set pacman cache.
|
||||||
|
|
||||||
*-f* <file>::
|
*-f* <src>[:<dst>]::
|
||||||
Copy file from the host to the chroot.
|
Copy file from the host to the chroot.
|
||||||
|
If 'dst' is not provided, it defaults to 'src' inside of the chroot.
|
||||||
|
|
||||||
*-s*::
|
*-s*::
|
||||||
Do not run setarch.
|
Do not run setarch.
|
||||||
|
@@ -12,7 +12,8 @@ pkgctl build [OPTIONS] [PATH...]
|
|||||||
Description
|
Description
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
TODO
|
Build packages in clean chroot environment, offering various options
|
||||||
|
and functionalities to customize the package building process.
|
||||||
|
|
||||||
Build Options
|
Build Options
|
||||||
-------------
|
-------------
|
||||||
|
43
doc/man/pkgctl-db.1.asciidoc
Normal file
43
doc/man/pkgctl-db.1.asciidoc
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
pkgctl-db(1)
|
||||||
|
============
|
||||||
|
|
||||||
|
NAME
|
||||||
|
----
|
||||||
|
pkgctl-db - Pacman database modification utility for package updates, moves, and more.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
--------
|
||||||
|
pkgctl db [OPTIONS] [SUBCOMMAND]
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Managing the Pacman database and facilitate the modification of packages and their metadata
|
||||||
|
within the database
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
-------
|
||||||
|
|
||||||
|
*-h, --help*::
|
||||||
|
Display usage information and available options.
|
||||||
|
|
||||||
|
Subcommands
|
||||||
|
-----------
|
||||||
|
|
||||||
|
pkgctl db update::
|
||||||
|
Update the binary repository as final release step
|
||||||
|
|
||||||
|
pkgctl db move::
|
||||||
|
Move packages between binary repositories
|
||||||
|
|
||||||
|
pkgctl db remove::
|
||||||
|
Remove packages from binary repositories
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
--------
|
||||||
|
|
||||||
|
pkgctl-db-update(1)
|
||||||
|
pkgctl-db-move(1)
|
||||||
|
pkgctl-db-remove(1)
|
||||||
|
|
||||||
|
include::include/footer.asciidoc[]
|
@@ -12,7 +12,12 @@ pkgctl [SUBCOMMAND] [OPTIONS]
|
|||||||
Description
|
Description
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
TODO
|
Command-line utility serving as a unified interface for multiple development tools.
|
||||||
|
This tool aims to simplify and optimize interactions with devtools by offering
|
||||||
|
various subcommands for executing tasks related to package management, repository management,
|
||||||
|
version control, among others.
|
||||||
|
|
||||||
|
Utilizing pkgctl enables users to efficiently administer their development workflows.
|
||||||
|
|
||||||
Options
|
Options
|
||||||
-------
|
-------
|
||||||
|
@@ -25,7 +25,8 @@ usage() {
|
|||||||
echo ' -C <file> Location of a pacman config file'
|
echo ' -C <file> Location of a pacman config file'
|
||||||
echo ' -M <file> Location of a makepkg config file'
|
echo ' -M <file> Location of a makepkg config file'
|
||||||
echo ' -c <dir> Set pacman cache'
|
echo ' -c <dir> Set pacman cache'
|
||||||
echo ' -f <file> Copy file from the host to the chroot'
|
echo ' -f <src>[:<dst>] Copy src file from the host to the chroot.'
|
||||||
|
echo ' If dst file is not provided, it defaults to src'
|
||||||
echo ' -s Do not run setarch'
|
echo ' -s Do not run setarch'
|
||||||
echo ' -h This message'
|
echo ' -h This message'
|
||||||
exit 1
|
exit 1
|
||||||
@@ -114,8 +115,10 @@ copy_hostconf () {
|
|||||||
|
|
||||||
local file
|
local file
|
||||||
for file in "${files[@]}"; do
|
for file in "${files[@]}"; do
|
||||||
mkdir -p "$(dirname "$working_dir$file")"
|
src="${file%%:*}"
|
||||||
cp -T "$file" "$working_dir$file"
|
dst="${file#*:}"
|
||||||
|
mkdir -p "$(dirname "$working_dir$dst")"
|
||||||
|
cp -T "$src" "$working_dir$dst"
|
||||||
done
|
done
|
||||||
|
|
||||||
sed -r "s|^#?\\s*CacheDir.+|CacheDir = ${cache_dirs[*]}|g" -i "$working_dir/etc/pacman.conf"
|
sed -r "s|^#?\\s*CacheDir.+|CacheDir = ${cache_dirs[*]}|g" -i "$working_dir/etc/pacman.conf"
|
||||||
|
@@ -7,6 +7,8 @@ _DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
|
|||||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
||||||
# shellcheck source=src/lib/util/srcinfo.sh
|
# shellcheck source=src/lib/util/srcinfo.sh
|
||||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/srcinfo.sh
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/srcinfo.sh
|
||||||
|
# shellcheck source=src/lib/state.sh
|
||||||
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/state.sh
|
||||||
|
|
||||||
source /usr/share/makepkg/util/util.sh
|
source /usr/share/makepkg/util/util.sh
|
||||||
|
|
||||||
@@ -234,6 +236,9 @@ declare -a uploads
|
|||||||
declare -a commit_arches
|
declare -a commit_arches
|
||||||
declare -a skip_arches
|
declare -a skip_arches
|
||||||
|
|
||||||
|
BUILD_STATE_DIR=$(get_state_folder "build-state")
|
||||||
|
state_file=
|
||||||
|
|
||||||
for _arch in "${arch[@]}"; do
|
for _arch in "${arch[@]}"; do
|
||||||
if [[ -n $commit_arch && ${_arch} != "$commit_arch" ]]; then
|
if [[ -n $commit_arch && ${_arch} != "$commit_arch" ]]; then
|
||||||
skip_arches+=("$_arch")
|
skip_arches+=("$_arch")
|
||||||
@@ -247,6 +252,12 @@ for _arch in "${arch[@]}"; do
|
|||||||
skip_arches+=("$_arch")
|
skip_arches+=("$_arch")
|
||||||
continue 2
|
continue 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
state_file="${BUILD_STATE_DIR}/$(basename "${pkgfile}").txt"
|
||||||
|
if [[ -f "${state_file}" ]] && [[ $(cat "${state_file}") != "${repo}" ]]; then
|
||||||
|
error "%s was not built against '%s', aborting" "${pkgfile}" "${repo}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
uploads+=("$pkgfile")
|
uploads+=("$pkgfile")
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@@ -12,6 +12,8 @@ source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
|||||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/db/update.sh
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/db/update.sh
|
||||||
# shellcheck source=src/lib/release.sh
|
# shellcheck source=src/lib/release.sh
|
||||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/release.sh
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/release.sh
|
||||||
|
# shellcheck source=src/lib/state.sh
|
||||||
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/state.sh
|
||||||
# shellcheck source=src/lib/util/git.sh
|
# shellcheck source=src/lib/util/git.sh
|
||||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/git.sh
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/git.sh
|
||||||
# shellcheck source=src/lib/util/srcinfo.sh
|
# shellcheck source=src/lib/util/srcinfo.sh
|
||||||
@@ -129,6 +131,7 @@ pkgctl_build() {
|
|||||||
local PKGVER=
|
local PKGVER=
|
||||||
local PKGREL=
|
local PKGREL=
|
||||||
local MESSAGE=
|
local MESSAGE=
|
||||||
|
local BUILD_STATE_DIR=
|
||||||
|
|
||||||
local paths=()
|
local paths=()
|
||||||
local BUILD_ARCH=()
|
local BUILD_ARCH=()
|
||||||
@@ -304,6 +307,8 @@ pkgctl_build() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
BUILD_STATE_DIR=$(get_state_folder "build-state")
|
||||||
|
|
||||||
# assign default worker slot
|
# assign default worker slot
|
||||||
if [[ -z ${WORKER_SLOT} ]] && ! WORKER_SLOT="$(tty | sed 's|/dev/pts/||')"; then
|
if [[ -z ${WORKER_SLOT} ]] && ! WORKER_SLOT="$(tty | sed 's|/dev/pts/||')"; then
|
||||||
WORKER_SLOT=$(( RANDOM % $(nproc) + 1 ))
|
WORKER_SLOT=$(( RANDOM % $(nproc) + 1 ))
|
||||||
@@ -481,8 +486,6 @@ pkgctl_build() {
|
|||||||
# shellcheck disable=SC2119
|
# shellcheck disable=SC2119
|
||||||
write_srcinfo_file
|
write_srcinfo_file
|
||||||
|
|
||||||
# test-install (some of) the produced packages
|
|
||||||
if [[ ${INSTALL_TO_HOST} == auto ]] || [[ ${INSTALL_TO_HOST} == all ]]; then
|
|
||||||
# shellcheck disable=2119
|
# shellcheck disable=2119
|
||||||
load_makepkg_config
|
load_makepkg_config
|
||||||
|
|
||||||
@@ -492,14 +495,17 @@ pkgctl_build() {
|
|||||||
|
|
||||||
for pkg in "${pkgname[@]}"; do
|
for pkg in "${pkgname[@]}"; do
|
||||||
pkg_architecture=$(get_pkg_arch "$pkg")
|
pkg_architecture=$(get_pkg_arch "$pkg")
|
||||||
pkgfile=$(realpath "$(printf "%s/%s-%s-%s%s\n" "${PKGDEST:-.}" "$pkg" "$version" "$pkg_architecture" "$PKGEXT")")
|
pkgpath=$(realpath "$(printf "%s\n" "${PKGDEST:-.}")")
|
||||||
|
pkgfile=$(printf "%s-%s-%s%s\n" "$pkg" "$version" "$pkg_architecture" "$PKGEXT")
|
||||||
|
|
||||||
# check if we install all packages or if the (split-)package is already installed
|
# check if we install all packages or if the (split-)package is already installed
|
||||||
if [[ ${INSTALL_TO_HOST} == all ]] || ( [[ ${INSTALL_TO_HOST} == auto ]] && pacman -Qq -- "$pkg" &>/dev/null ); then
|
if [[ ${INSTALL_TO_HOST} == all ]] || ( [[ ${INSTALL_TO_HOST} == auto ]] && pacman -Qq -- "$pkg" &>/dev/null ); then
|
||||||
INSTALL_HOST_PACKAGES+=("$pkgfile")
|
INSTALL_HOST_PACKAGES+=("${pkgpath}/${pkgfile}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# save against which repo we have built the package
|
||||||
|
printf "%s" "${pkgrepo}" > "${BUILD_STATE_DIR}/${pkgfile}.txt"
|
||||||
done
|
done
|
||||||
fi
|
|
||||||
|
|
||||||
# release the build
|
# release the build
|
||||||
if (( RELEASE )); then
|
if (( RELEASE )); then
|
||||||
|
@@ -15,6 +15,9 @@ $DEVTOOLS_INCLUDE_COMMON_SH
|
|||||||
# Avoid any encoding problems
|
# Avoid any encoding problems
|
||||||
export LANG=C.UTF-8
|
export LANG=C.UTF-8
|
||||||
|
|
||||||
|
# Avoid systemd trying to color the terminal on systemd-nspawn
|
||||||
|
export SYSTEMD_TINT_BACKGROUND=no
|
||||||
|
|
||||||
# Set buildtool properties
|
# Set buildtool properties
|
||||||
export BUILDTOOL=devtools
|
export BUILDTOOL=devtools
|
||||||
export BUILDTOOLVER=@buildtoolver@
|
export BUILDTOOLVER=@buildtoolver@
|
||||||
|
18
src/lib/state.sh
Normal file
18
src/lib/state.sh
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/hint/bash
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
[[ -z ${DEVTOOLS_INCLUDE_STATE_SH:-} ]] || return 0
|
||||||
|
DEVTOOLS_INCLUDE_STATE_SH=1
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
readonly XDG_DEVTOOLS_STATE_DIR="${XDG_STATE_HOME:-$HOME/.local/state}/devtools"
|
||||||
|
|
||||||
|
get_state_folder() {
|
||||||
|
local foldername=$1
|
||||||
|
local path="${XDG_DEVTOOLS_STATE_DIR}/${foldername}"
|
||||||
|
|
||||||
|
mkdir --parents -- "$path"
|
||||||
|
printf '%s' "${path}"
|
||||||
|
}
|
@@ -227,7 +227,7 @@ get_upstream_version() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! output=$(GIT_TERMINAL_PROMPT=0 nvchecker --file "${config}" --logger json "${opts[@]}" 2>&1 | \
|
if ! output=$(GIT_TERMINAL_PROMPT=0 nvchecker --file "${config}" --logger json "${opts[@]}" 2>&1 | \
|
||||||
jq --raw-output 'select(.level != "debug")'); then
|
jq --raw-output 'select((.level != "debug") and (.event != "ignoring invalid version"))'); then
|
||||||
printf "failed to run nvchecker: %s" "${output}"
|
printf "failed to run nvchecker: %s" "${output}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -267,13 +267,13 @@ nvchecker_check_config() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# check if the config contains a pkgbase section
|
# check if the config contains a pkgbase section
|
||||||
if [[ -n ${pkgbase} ]] && ! grep --max-count=1 --extended-regexp --quiet "^\\[\"?${pkgbase}\"?\\]" < "${config}"; then
|
if [[ -n ${pkgbase} ]] && ! grep --max-count=1 --extended-regexp --quiet "^\\[\"?${pkgbase//+/\\+}\"?\\]" < "${config}"; then
|
||||||
printf "missing pkgbase section in %s: %s" "${config}" "${pkgbase}"
|
printf "missing pkgbase section in %s: %s" "${config}" "${pkgbase}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if the config contains any section other than pkgbase
|
# check if the config contains any section other than pkgbase
|
||||||
if [[ -n ${pkgbase} ]] && property=$(grep --max-count=1 --perl-regexp "^\\[(?!\"?${pkgbase}\"?\\]).+\\]" < "${config}"); then
|
if [[ -n ${pkgbase} ]] && property=$(grep --max-count=1 --perl-regexp "^\\[(?!\"?${pkgbase//+/\\+}\"?\\]).+\\]" < "${config}"); then
|
||||||
printf "non-pkgbase section not supported in %s: %s" "${config}" "${property}"
|
printf "non-pkgbase section not supported in %s: %s" "${config}" "${property}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
@@ -252,7 +252,7 @@ nvchecker_setup() {
|
|||||||
|
|
||||||
# escape the section if it contains toml subsection chars
|
# escape the section if it contains toml subsection chars
|
||||||
section="${pkgbase}"
|
section="${pkgbase}"
|
||||||
if [[ ${section} == *.* ]]; then
|
if [[ ${section} == *.* ]] || [[ ${section} == *+* ]]; then
|
||||||
section="\"${section}\""
|
section="\"${section}\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@@ -38,6 +38,7 @@ inspect=never
|
|||||||
|
|
||||||
bindmounts_ro=()
|
bindmounts_ro=()
|
||||||
bindmounts_rw=()
|
bindmounts_rw=()
|
||||||
|
bindmounts_tmpfs=()
|
||||||
|
|
||||||
copy=$USER
|
copy=$USER
|
||||||
[[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER
|
[[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER
|
||||||
@@ -69,6 +70,7 @@ usage() {
|
|||||||
echo '-c Clean the chroot before building'
|
echo '-c Clean the chroot before building'
|
||||||
echo '-d <dir> Bind directory into build chroot as read-write'
|
echo '-d <dir> Bind directory into build chroot as read-write'
|
||||||
echo '-D <dir> Bind directory into build chroot as read-only'
|
echo '-D <dir> Bind directory into build chroot as read-only'
|
||||||
|
echo '-t <dir[:opts]> Mount a tmpfs at directory'
|
||||||
echo '-u Update the working copy of the chroot before building'
|
echo '-u Update the working copy of the chroot before building'
|
||||||
echo ' This is useful for rebuilds without dirtying the pristine'
|
echo ' This is useful for rebuilds without dirtying the pristine'
|
||||||
echo ' chroot'
|
echo ' chroot'
|
||||||
@@ -148,7 +150,7 @@ install_packages() {
|
|||||||
pkgnames=("${install_pkgs[@]##*/}")
|
pkgnames=("${install_pkgs[@]##*/}")
|
||||||
|
|
||||||
cp -- "${install_pkgs[@]}" "$copydir/root/"
|
cp -- "${install_pkgs[@]}" "$copydir/root/"
|
||||||
arch-nspawn "$copydir" "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
arch-nspawn "$copydir" "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" "${bindmounts_tmpfs[@]}" \
|
||||||
pacman -U --noconfirm --ask=4 -- "${pkgnames[@]/#//root/}"
|
pacman -U --noconfirm --ask=4 -- "${pkgnames[@]/#//root/}"
|
||||||
ret=$?
|
ret=$?
|
||||||
rm -- "${pkgnames[@]/#/$copydir/root/}"
|
rm -- "${pkgnames[@]/#/$copydir/root/}"
|
||||||
@@ -188,6 +190,11 @@ builduser ALL = NOPASSWD: /usr/bin/pacman
|
|||||||
EOF
|
EOF
|
||||||
chmod 440 "$copydir/etc/sudoers.d/builduser-pacman"
|
chmod 440 "$copydir/etc/sudoers.d/builduser-pacman"
|
||||||
|
|
||||||
|
cat > "$copydir/etc/gitconfig" <<EOF
|
||||||
|
[safe]
|
||||||
|
directory = *
|
||||||
|
EOF
|
||||||
|
|
||||||
# This is a little gross, but this way the script is recreated every time in the
|
# This is a little gross, but this way the script is recreated every time in the
|
||||||
# working copy
|
# working copy
|
||||||
{
|
{
|
||||||
@@ -286,11 +293,12 @@ move_products() {
|
|||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
while getopts 'hcur:I:l:nCTD:d:U:x:' arg; do
|
while getopts 'hcur:I:l:nCTD:d:U:x:t:' arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
c) clean_first=1 ;;
|
c) clean_first=1 ;;
|
||||||
D) bindmounts_ro+=("--bind-ro=$OPTARG") ;;
|
D) bindmounts_ro+=("--bind-ro=$OPTARG") ;;
|
||||||
d) bindmounts_rw+=("--bind=$OPTARG") ;;
|
d) bindmounts_rw+=("--bind=$OPTARG") ;;
|
||||||
|
t) bindmounts_tmpfs+=("--tmpfs=$OPTARG") ;;
|
||||||
u) update_first=1 ;;
|
u) update_first=1 ;;
|
||||||
r) passeddir="$OPTARG" ;;
|
r) passeddir="$OPTARG" ;;
|
||||||
I) install_pkgs+=("$OPTARG") ;;
|
I) install_pkgs+=("$OPTARG") ;;
|
||||||
@@ -360,7 +368,7 @@ if [[ ! -d $copydir ]] || (( clean_first )); then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
(( update_first )) && arch-nspawn "$copydir" \
|
(( update_first )) && arch-nspawn "$copydir" \
|
||||||
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" "${bindmounts_tmpfs[@]}" \
|
||||||
pacman -Syuu --noconfirm
|
pacman -Syuu --noconfirm
|
||||||
|
|
||||||
if [[ -n ${install_pkgs[*]:-} ]]; then
|
if [[ -n ${install_pkgs[*]:-} ]]; then
|
||||||
@@ -385,6 +393,7 @@ nspawn_build_args=(
|
|||||||
--tmpfs="/tmp:${tmp_opts}"
|
--tmpfs="/tmp:${tmp_opts}"
|
||||||
"${bindmounts_ro[@]}"
|
"${bindmounts_ro[@]}"
|
||||||
"${bindmounts_rw[@]}"
|
"${bindmounts_rw[@]}"
|
||||||
|
"${bindmounts_tmpfs[@]}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if arch-nspawn "$copydir" \
|
if arch-nspawn "$copydir" \
|
||||||
|
@@ -26,7 +26,8 @@ usage() {
|
|||||||
echo ' -C <file> Location of a pacman config file'
|
echo ' -C <file> Location of a pacman config file'
|
||||||
echo ' -M <file> Location of a makepkg config file'
|
echo ' -M <file> Location of a makepkg config file'
|
||||||
echo ' -c <dir> Set pacman cache'
|
echo ' -c <dir> Set pacman cache'
|
||||||
echo ' -f <file> Copy file from the host to the chroot'
|
echo ' -f <src>[:<dst>] Copy src file from the host to the chroot.'
|
||||||
|
echo ' If dst file is not provided, it defaults to src'
|
||||||
echo ' -s Do not run setarch'
|
echo ' -s Do not run setarch'
|
||||||
echo ' -h This message'
|
echo ' -h This message'
|
||||||
exit 1
|
exit 1
|
||||||
@@ -84,8 +85,10 @@ if is_btrfs "$working_dir"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
for file in "${files[@]}"; do
|
for file in "${files[@]}"; do
|
||||||
mkdir -p "$(dirname "$working_dir$file")"
|
src="${file%%:*}"
|
||||||
cp "$file" "$working_dir$file"
|
dst="${file#*:}"
|
||||||
|
mkdir -p "$(dirname "$working_dir$dst")"
|
||||||
|
cp "$src" "$working_dir$dst"
|
||||||
done
|
done
|
||||||
|
|
||||||
unshare --mount pacstrap -${umode}Mc ${pac_conf:+-C "$pac_conf"} "$working_dir" \
|
unshare --mount pacstrap -${umode}Mc ${pac_conf:+-C "$pac_conf"} "$working_dir" \
|
||||||
|
@@ -2,3 +2,4 @@
|
|||||||
source = "github"
|
source = "github"
|
||||||
github = "anthraxx/git-smash"
|
github = "anthraxx/git-smash"
|
||||||
use_max_tag = true
|
use_max_tag = true
|
||||||
|
prefix = "v"
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
[git-smash]
|
[git-smash]
|
||||||
source = "git"
|
source = "git"
|
||||||
git = "https://github.com/anthraxx/git-smash.git"
|
git = "https://github.com/anthraxx/git-smash.git"
|
||||||
|
prefix = "v"
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
["git.smash"]
|
["git.smash"]
|
||||||
source = "git"
|
source = "git"
|
||||||
git = "https://github.com/anthraxx/git-smash.git"
|
git = "https://github.com/anthraxx/git-smash.git"
|
||||||
|
prefix = "v"
|
||||||
|
Reference in New Issue
Block a user