mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-15 02:46:19 +02:00
Compare commits
21 Commits
v1.2.0
...
support-of
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a0c0c63a85 | ||
![]() |
e1401ce41c | ||
![]() |
8612b41a20 | ||
![]() |
fbb661645b | ||
![]() |
f1dc2e18f7 | ||
![]() |
c9d821448b | ||
![]() |
a620250535 | ||
![]() |
27eebe383d | ||
![]() |
d6d416b653 | ||
![]() |
9ff63503b9 | ||
![]() |
3f02a1a24c | ||
![]() |
1df0979da6 | ||
![]() |
c1a3ed224b | ||
![]() |
144f9a871e | ||
![]() |
44328cd9a3 | ||
![]() |
0e2b16b0ac | ||
![]() |
6f0a8c345d | ||
![]() |
5f19853414 | ||
![]() |
2b62ac660d | ||
![]() |
7cb72699f6 | ||
![]() |
d1790c295a |
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# EditorConfig configuration for devtools
|
||||||
|
# https://editorconfig.org
|
||||||
|
|
||||||
|
# Top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
# Unix-style newlines without trailing whitespaces, but with a newline
|
||||||
|
# ending every file, utf-8 charset, set indent to tabs
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = tab
|
||||||
|
tab_width = 4
|
2
Makefile
2
Makefile
@@ -1,6 +1,6 @@
|
|||||||
SHELL=/bin/bash -o pipefail
|
SHELL=/bin/bash -o pipefail
|
||||||
|
|
||||||
V=1.2.0
|
V=1.2.1
|
||||||
BUILDTOOLVER ?= $(V)
|
BUILDTOOLVER ?= $(V)
|
||||||
|
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
|
@@ -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,10 @@ pkgctl build [OPTIONS] [PATH...]
|
|||||||
Description
|
Description
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
TODO
|
Build packages in clean chroot environment, offering various options
|
||||||
|
and functionalities to customize the package building process.
|
||||||
|
|
||||||
|
By default, chroot environments are located in '/var/lib/archbuild/'.
|
||||||
|
|
||||||
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
|
||||||
-------
|
-------
|
||||||
|
@@ -22,12 +22,13 @@ usage() {
|
|||||||
echo "A wrapper around systemd-nspawn. Provides support for pacman."
|
echo "A wrapper around systemd-nspawn. Provides support for pacman."
|
||||||
echo
|
echo
|
||||||
echo ' options:'
|
echo ' options:'
|
||||||
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 ' -s Do not run setarch'
|
echo ' If dst file is not provided, it defaults to src'
|
||||||
echo ' -h This message'
|
echo ' -s Do not run setarch'
|
||||||
|
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"
|
||||||
|
@@ -140,7 +140,7 @@ for _pkgname in "${pkgname[@]}"; do
|
|||||||
bsdtar tf "$TEMPDIR/$oldpkg" | sort > "$TEMPDIR/filelist-$_pkgname-old"
|
bsdtar tf "$TEMPDIR/$oldpkg" | sort > "$TEMPDIR/filelist-$_pkgname-old"
|
||||||
bsdtar tf "$pkgfile" | sort > "$TEMPDIR/filelist-$_pkgname"
|
bsdtar tf "$pkgfile" | sort > "$TEMPDIR/filelist-$_pkgname"
|
||||||
|
|
||||||
sdiff -s "$TEMPDIR/filelist-$_pkgname-old" "$TEMPDIR/filelist-$_pkgname"
|
diff --side-by-side --suppress-common-lines --width="$COLUMNS" --color=auto "$TEMPDIR/filelist-$_pkgname-old" "$TEMPDIR/filelist-$_pkgname"
|
||||||
|
|
||||||
find-libprovides "$TEMPDIR/$oldpkg" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname-old"
|
find-libprovides "$TEMPDIR/$oldpkg" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname-old"
|
||||||
find-libprovides "$pkgfile" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname"
|
find-libprovides "$pkgfile" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname"
|
||||||
|
@@ -165,7 +165,7 @@ pkgctl_aur_drop_from_repo() {
|
|||||||
warning 'Did not find %s in any repository, please delete manually' "${pkgbase}"
|
warning 'Did not find %s in any repository, please delete manually' "${pkgbase}"
|
||||||
else
|
else
|
||||||
msg2 " repo: ${pkgrepo}"
|
msg2 " repo: ${pkgrepo}"
|
||||||
pkgctl_db_remove "${pkgrepo}" "${pkgbase}"
|
pkgctl_db_remove --noconfirm "${pkgrepo}" "${pkgbase}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
@@ -63,7 +63,7 @@ pkgctl_auth_login() {
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
personal_access_token_url="https://${GITLAB_HOST}/-/profile/personal_access_tokens?name=pkgctl+token&scopes=api,write_repository"
|
personal_access_token_url="https://${GITLAB_HOST}/-/user_settings/personal_access_tokens?name=pkgctl+token&scopes=api,write_repository"
|
||||||
|
|
||||||
cat <<- _EOF_
|
cat <<- _EOF_
|
||||||
Logging into ${BOLD}${GITLAB_HOST}${ALL_OFF}
|
Logging into ${BOLD}${GITLAB_HOST}${ALL_OFF}
|
||||||
|
@@ -55,6 +55,7 @@ pkgctl_build_usage() {
|
|||||||
-o, --offload Build on a remote server and transfer artifacts afterwards
|
-o, --offload Build on a remote server and transfer artifacts afterwards
|
||||||
-c, --clean Recreate the chroot before building
|
-c, --clean Recreate the chroot before building
|
||||||
--inspect WHEN Spawn an interactive shell to inspect the chroot (never, always, failure)
|
--inspect WHEN Spawn an interactive shell to inspect the chroot (never, always, failure)
|
||||||
|
--offline MODE Run a part of the build process offline (build, check)
|
||||||
-w, --worker SLOT Name of the worker slot, useful for concurrent builds (disables automatic names)
|
-w, --worker SLOT Name of the worker slot, useful for concurrent builds (disables automatic names)
|
||||||
--nocheck Do not run the check() function in the PKGBUILD
|
--nocheck Do not run the check() function in the PKGBUILD
|
||||||
|
|
||||||
@@ -79,8 +80,8 @@ pkgctl_build_usage() {
|
|||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
$ ${COMMAND}
|
$ ${COMMAND}
|
||||||
$ ${COMMAND} --rebuild --staging --message 'libyay 0.42 rebuild' libfoo libbar
|
$ ${COMMAND} --rebuild --staging --release --message 'libyay 0.42 rebuild' libfoo libbar
|
||||||
$ ${COMMAND} --pkgver 1.42 --release --db-update
|
$ ${COMMAND} --pkgver=1.42 --release --db-update
|
||||||
_EOF_
|
_EOF_
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,6 +199,10 @@ pkgctl_build() {
|
|||||||
EDIT=1
|
EDIT=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--offline)
|
||||||
|
MAKECHROOT_OPTIONS+=("-o" "$2")
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
-o|--offload)
|
-o|--offload)
|
||||||
OFFLOAD=1
|
OFFLOAD=1
|
||||||
shift
|
shift
|
||||||
|
@@ -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@
|
||||||
@@ -117,6 +120,8 @@ print_workdir_error() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_setup_workdir=false
|
_setup_workdir=false
|
||||||
|
# Ensure that there is no outside value for WORKDIR leaking in
|
||||||
|
unset WORKDIR
|
||||||
setup_workdir() {
|
setup_workdir() {
|
||||||
[[ -z ${WORKDIR:-} ]] && WORKDIR=$(mktemp -d --tmpdir "${0##*/}.XXXXXXXXXX")
|
[[ -z ${WORKDIR:-} ]] && WORKDIR=$(mktemp -d --tmpdir "${0##*/}.XXXXXXXXXX")
|
||||||
_setup_workdir=true
|
_setup_workdir=true
|
||||||
|
@@ -271,6 +271,7 @@ pkgctl_repo_configure() {
|
|||||||
if [[ -n $GPGKEY ]]; then
|
if [[ -n $GPGKEY ]]; then
|
||||||
git config commit.gpgsign true
|
git config commit.gpgsign true
|
||||||
git config user.signingKey "${GPGKEY}"
|
git config user.signingKey "${GPGKEY}"
|
||||||
|
git config gpg.format openpgp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set default git exclude
|
# set default git exclude
|
||||||
|
@@ -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
|
||||||
@@ -284,7 +284,7 @@ nvchecker_check_error() {
|
|||||||
local errors
|
local errors
|
||||||
|
|
||||||
if ! errors=$(jq --raw-output --exit-status \
|
if ! errors=$(jq --raw-output --exit-status \
|
||||||
'select(.level == "error") | "\(.event)" + if .error then ": \(.error)" else "" end' \
|
'select((.level == "error") and (.error != null)) | "\(.event)" + if .error then ": \(.error)" else "" end' \
|
||||||
<<< "${result}"); then
|
<<< "${result}"); then
|
||||||
return 0
|
return 0
|
||||||
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,9 @@ inspect=never
|
|||||||
|
|
||||||
bindmounts_ro=()
|
bindmounts_ro=()
|
||||||
bindmounts_rw=()
|
bindmounts_rw=()
|
||||||
|
bindmounts_tmpfs=()
|
||||||
|
|
||||||
|
offline_options=()
|
||||||
|
|
||||||
copy=$USER
|
copy=$USER
|
||||||
[[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER
|
[[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER
|
||||||
@@ -65,23 +68,25 @@ usage() {
|
|||||||
echo "Default makepkg args: ${default_makepkg_args[*]}"
|
echo "Default makepkg args: ${default_makepkg_args[*]}"
|
||||||
echo ''
|
echo ''
|
||||||
echo 'Flags:'
|
echo 'Flags:'
|
||||||
echo '-h This help'
|
echo '-h This help'
|
||||||
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 '-u Update the working copy of the chroot before building'
|
echo '-t <dir[:opts]> Mount a tmpfs at directory'
|
||||||
echo ' This is useful for rebuilds without dirtying the pristine'
|
echo '-u Update the working copy of the chroot before building'
|
||||||
echo ' chroot'
|
echo ' This is useful for rebuilds without dirtying the pristine'
|
||||||
echo '-r <dir> The chroot dir to use'
|
echo ' chroot'
|
||||||
echo '-I <pkg> Install a package into the working copy of the chroot'
|
echo '-r <dir> The chroot dir to use'
|
||||||
echo '-l <copy> The directory to use as the working copy of the chroot'
|
echo '-I <pkg> Install a package into the working copy of the chroot'
|
||||||
echo ' Useful for maintaining multiple copies'
|
echo '-l <copy> The directory to use as the working copy of the chroot'
|
||||||
echo " Default: $copy"
|
echo ' Useful for maintaining multiple copies'
|
||||||
echo '-n Run namcap on the package'
|
echo " Default: $copy"
|
||||||
echo '-C Run checkpkg on the package'
|
echo '-n Run namcap on the package'
|
||||||
echo '-T Build in a temporary directory'
|
echo '-o Run given step offline'
|
||||||
echo '-U Run makepkg as a specified user'
|
echo '-C Run checkpkg on the package'
|
||||||
echo '-x <when> Inspect chroot after build (never, always, failure)'
|
echo '-T Build in a temporary directory'
|
||||||
|
echo '-U Run makepkg as a specified user'
|
||||||
|
echo '-x <when> Inspect chroot after build (never, always, failure)'
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +108,7 @@ sync_chroot() {
|
|||||||
"Locking clean chroot [%s]" "$chrootdir/root"
|
"Locking clean chroot [%s]" "$chrootdir/root"
|
||||||
|
|
||||||
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$chrootdir/root" "$copy"
|
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$chrootdir/root" "$copy"
|
||||||
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
|
if is_btrfs "$chrootdir" && is_subvolume "$chrootdir/root" && ! mountpoint -q "$copydir"; then
|
||||||
subvolume_delete_recursive "$copydir" ||
|
subvolume_delete_recursive "$copydir" ||
|
||||||
die "Unable to delete subvolume %s" "$copydir"
|
die "Unable to delete subvolume %s" "$copydir"
|
||||||
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
|
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
|
||||||
@@ -148,7 +153,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 +193,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
|
||||||
{
|
{
|
||||||
@@ -196,6 +206,7 @@ EOF
|
|||||||
declare -p SOURCE_DATE_EPOCH 2>/dev/null || true
|
declare -p SOURCE_DATE_EPOCH 2>/dev/null || true
|
||||||
declare -p BUILDTOOL 2>/dev/null
|
declare -p BUILDTOOL 2>/dev/null
|
||||||
declare -p BUILDTOOLVER 2>/dev/null
|
declare -p BUILDTOOLVER 2>/dev/null
|
||||||
|
declare -p offline_options
|
||||||
printf '_chrootbuild "$@" || exit\n'
|
printf '_chrootbuild "$@" || exit\n'
|
||||||
|
|
||||||
if (( run_namcap )); then
|
if (( run_namcap )); then
|
||||||
@@ -215,14 +226,52 @@ _chrootbuild() {
|
|||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
. /etc/profile
|
. /etc/profile
|
||||||
|
|
||||||
|
# for in_array
|
||||||
|
. /usr/share/makepkg/util.sh
|
||||||
|
|
||||||
# Beware, there are some stupid arbitrary rules on how you can
|
# Beware, there are some stupid arbitrary rules on how you can
|
||||||
# use "$" in arguments to commands with "sudo -i". ${foo} or
|
# use "$" in arguments to commands with "sudo -i". ${foo} or
|
||||||
# ${1} is OK, but $foo or $1 isn't.
|
# ${1} is OK, but $foo or $1 isn't.
|
||||||
# https://bugzilla.sudo.ws/show_bug.cgi?id=765
|
# https://bugzilla.sudo.ws/show_bug.cgi?id=765
|
||||||
|
|
||||||
|
# Run prepare
|
||||||
sudo --preserve-env=SOURCE_DATE_EPOCH \
|
sudo --preserve-env=SOURCE_DATE_EPOCH \
|
||||||
--preserve-env=BUILDTOOL \
|
--preserve-env=BUILDTOOL \
|
||||||
--preserve-env=BUILDTOOLVER \
|
--preserve-env=BUILDTOOLVER \
|
||||||
-iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
|
-iu builduser bash -c 'cd /startdir; makepkg --nobuild "$@"' -bash "$@"
|
||||||
|
|
||||||
|
if in_array "build" "${offline_options[@]}"; then
|
||||||
|
msg "building offline"
|
||||||
|
# Build offline
|
||||||
|
unshare -n -- sudo --preserve-env=SOURCE_DATE_EPOCH \
|
||||||
|
--preserve-env=BUILDTOOL \
|
||||||
|
--preserve-env=BUILDTOOLVER \
|
||||||
|
-iu builduser \
|
||||||
|
bash -c 'cd /startdir; makepkg --noprepare --noextract --nocheck "$@"' -bash "$@"
|
||||||
|
else
|
||||||
|
sudo --preserve-env=SOURCE_DATE_EPOCH \
|
||||||
|
--preserve-env=BUILDTOOL \
|
||||||
|
--preserve-env=BUILDTOOLVER \
|
||||||
|
-iu builduser \
|
||||||
|
bash -c 'cd /startdir; makepkg --noprepare --noextract --nocheck "$@"' -bash "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if in_array "check" "${offline_options[@]}"; then
|
||||||
|
msg "check offline"
|
||||||
|
# Run tests online
|
||||||
|
unshare -n -- sudo --preserve-env=SOURCE_DATE_EPOCH \
|
||||||
|
--preserve-env=BUILDTOOL \
|
||||||
|
--preserve-env=BUILDTOOLVER \
|
||||||
|
-iu builduser \
|
||||||
|
bash -c 'cd /startdir; makepkg --noprepare --noextract --nobuild "$@"' -bash "$@"
|
||||||
|
else
|
||||||
|
sudo --preserve-env=SOURCE_DATE_EPOCH \
|
||||||
|
--preserve-env=BUILDTOOL \
|
||||||
|
--preserve-env=BUILDTOOLVER \
|
||||||
|
-iu builduser \
|
||||||
|
bash -c 'cd /startdir; makepkg --noprepare --noextract --nobuild "$@"' -bash "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
ret=$?
|
ret=$?
|
||||||
case $ret in
|
case $ret in
|
||||||
0|14)
|
0|14)
|
||||||
@@ -286,16 +335,18 @@ move_products() {
|
|||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
while getopts 'hcur:I:l:nCTD:d:U:x:' arg; do
|
while getopts 'hcur:I:l:nCTD:o: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") ;;
|
||||||
l) copy="$OPTARG" ;;
|
l) copy="$OPTARG" ;;
|
||||||
n) run_namcap=1; makepkg_args+=(--install) ;;
|
n) run_namcap=1; makepkg_args+=(--install) ;;
|
||||||
|
o) offline_options+=("$OPTARG") ;;
|
||||||
C) run_checkpkg=1 ;;
|
C) run_checkpkg=1 ;;
|
||||||
T) temp_chroot=1; copy+="-$$" ;;
|
T) temp_chroot=1; copy+="-$$" ;;
|
||||||
U) makepkg_user="$OPTARG" ;;
|
U) makepkg_user="$OPTARG" ;;
|
||||||
@@ -360,7 +411,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 +436,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" \
|
||||||
|
@@ -22,13 +22,14 @@ nspawn_args=()
|
|||||||
usage() {
|
usage() {
|
||||||
echo "Usage: ${0##*/} [options] working-dir package-list..."
|
echo "Usage: ${0##*/} [options] working-dir package-list..."
|
||||||
echo ' options:'
|
echo ' options:'
|
||||||
echo ' -U Use pacman -U to install packages'
|
echo ' -U Use pacman -U to install packages'
|
||||||
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 ' -s Do not run setarch'
|
echo ' If dst file is not provided, it defaults to src'
|
||||||
echo ' -h This message'
|
echo ' -s Do not run setarch'
|
||||||
|
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