Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
65a29f73cc | |||
d72df66e99
|
|||
221cc796c0 | |||
3ed0c310a3 | |||
b1213d5c2c | |||
26dffde972
|
|||
915eca6c2e | |||
a52e32d740
|
@@ -19,8 +19,8 @@ artixpkg_admin_query_usage() {
|
||||
-h, --help Show this help text
|
||||
|
||||
EXAMPLES
|
||||
$ ${COMMAND} --maintainer maintainer-mynickname
|
||||
$ ${COMMAND} --topic myopic
|
||||
$ ${COMMAND} --maintainer tux
|
||||
$ ${COMMAND} --topic mytopic
|
||||
_EOF_
|
||||
}
|
||||
|
||||
|
@@ -137,7 +137,6 @@ update_yaml_base() {
|
||||
local name
|
||||
local pkgnames
|
||||
local arches
|
||||
local pkgbase
|
||||
|
||||
pkgbase="${pkgbase:-${pkgname}}"
|
||||
version="$(get_full_version)"
|
||||
|
@@ -20,6 +20,8 @@ artixpkg_git_clone_usage() {
|
||||
-m, --maintainer=NAME Clone all packages of the named maintainer
|
||||
--protocol https Clone the repository over https
|
||||
-t, --topic=NAME Clone all packages of the named topic
|
||||
-a, --agent=NAME Set the CI agent (default: official)
|
||||
Possible values: [official, galaxy]
|
||||
-j, --jobs N Run up to N jobs in parallel (default: $(nproc))
|
||||
--all Clone all existing packages, useful for cache warming
|
||||
-h, --help Show this help text
|
||||
@@ -27,8 +29,9 @@ artixpkg_git_clone_usage() {
|
||||
EXAMPLES
|
||||
$ ${COMMAND} libfoo linux libbar
|
||||
$ ${COMMAND} --maintainer tux
|
||||
$ ${COMMAND} --topic myopic
|
||||
$ ${COMMAND} -j 8 --topic myopic
|
||||
$ ${COMMAND} --topic mytopic
|
||||
$ ${COMMAND} -j 8 --topic mytopic
|
||||
$ ${COMMAND} --agent galaxy libfoo
|
||||
_EOF_
|
||||
}
|
||||
|
||||
@@ -90,6 +93,15 @@ artixpkg_git_clone() {
|
||||
TOPIC="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
-a|--agent)
|
||||
(( $# <= 1 )) && die "missing argument for %s" "$1"
|
||||
CONFIGURE_OPTIONS+=("$1" "$2")
|
||||
shift 2
|
||||
;;
|
||||
--agent=*)
|
||||
CONFIGURE_OPTIONS+=("${1}")
|
||||
shift
|
||||
;;
|
||||
--all)
|
||||
CLONE_ALL=1
|
||||
shift
|
||||
|
@@ -13,10 +13,14 @@ set -e
|
||||
|
||||
commit_ci(){
|
||||
[[ -d .artixlinux ]] || mkdir .artixlinux
|
||||
printf "@Library('artix-ci') import org.artixlinux.RepoPackage\n" > "${REPO_CI}"
|
||||
if [[ ${AGENT} == ${ARTIX_DB[11]} ]]; then
|
||||
printf "@Library('artix-ci@${AGENT}') import org.artixlinux.RepoPackage\n" > "${REPO_CI}"
|
||||
else
|
||||
printf "@Library('artix-ci') import org.artixlinux.RepoPackage\n" > "${REPO_CI}"
|
||||
fi
|
||||
{
|
||||
printf '\n'
|
||||
printf 'PackagePipeline(new RepoPackage(this))\n'
|
||||
printf '\n'
|
||||
printf 'PackagePipeline(new RepoPackage(this))\n'
|
||||
} >> "${REPO_CI}"
|
||||
|
||||
git add "${REPO_CI}"
|
||||
@@ -30,14 +34,17 @@ artixpkg_git_config_usage() {
|
||||
|
||||
OPTIONS
|
||||
-m, --maintainer Set the maintainer topic via gitea api
|
||||
-u, --upstream Add upstream arch remote
|
||||
-d, --drop Drop the maintainer topic via gitea api
|
||||
-a, --agent=NAME Set the CI agent (default: official)
|
||||
Possible values: [official, galaxy]
|
||||
--protocol https Configure remote url to use https
|
||||
-j, --jobs N Run up to N jobs in parallel (default: $(nproc))
|
||||
-h, --help Show this help text
|
||||
|
||||
EXAMPLES
|
||||
$ ${COMMAND} --maintainer tux
|
||||
$ ${COMMAND} --upstream libfoo
|
||||
$ ${COMMAND} --maintainer libfoo
|
||||
$ ${COMMAND} --agent galaxy libfoo
|
||||
$ ${COMMAND} --drop libfoo
|
||||
$ ${COMMAND} *
|
||||
_EOF_
|
||||
}
|
||||
@@ -101,10 +108,12 @@ artixpkg_git_config() {
|
||||
local paths=()
|
||||
|
||||
local SET_TOPIC=0
|
||||
local UPSTREAM=0
|
||||
local DROP_TOPIC=0
|
||||
local AGENT=
|
||||
local CI_ADDED=0
|
||||
|
||||
# variables
|
||||
local -r command=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
|
||||
local RUNCMD=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
|
||||
local path realpath pkgbase
|
||||
local PACKAGER GPGKEY packager_name packager_email
|
||||
|
||||
@@ -116,10 +125,21 @@ artixpkg_git_config() {
|
||||
;;
|
||||
-m|--maintainer)
|
||||
SET_TOPIC=1
|
||||
RUNCMD+=" -m"
|
||||
shift
|
||||
;;
|
||||
-u|--upstream)
|
||||
UPSTREAM=1
|
||||
-d|--drop)
|
||||
DROP_TOPIC=1
|
||||
RUNCMD+=" -d"
|
||||
shift
|
||||
;;
|
||||
-a|--agent)
|
||||
(( $# <= 1 )) && die "missing argument for %s" "$1"
|
||||
AGENT="$2"
|
||||
shift 2
|
||||
;;
|
||||
--agent=*)
|
||||
AGENT="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--protocol=https)
|
||||
@@ -199,7 +219,7 @@ artixpkg_git_config() {
|
||||
if [[ -n ${BOLD} ]]; then
|
||||
export ARTOOLS_COLOR=always
|
||||
fi
|
||||
if ! parallel --bar --jobs "${jobs}" "${command}" ::: "${paths[@]}"; then
|
||||
if ! parallel --bar --jobs "${jobs}" "${RUNCMD}" ::: "${paths[@]}"; then
|
||||
die 'Failed to configure some packages, please check the output'
|
||||
exit 1
|
||||
fi
|
||||
@@ -253,17 +273,27 @@ artixpkg_git_config() {
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if (( UPSTREAM )); then
|
||||
local remote_url
|
||||
remote_url="${GIT_UPSTREAM_URL}/${pkgbase}".git
|
||||
if ! git remote add upstream "${remote_url}"; then
|
||||
warning "failed to set the upstream: ${remote_url}"
|
||||
|
||||
if (( DROP_TOPIC )); then
|
||||
if [[ -n ${GIT_TOKEN} ]]; then
|
||||
local topic gitname
|
||||
topic="maintainer-${packager_name}"
|
||||
gitname=$(get_compliant_name "${pkgbase}")
|
||||
if ! remove_topic "${gitname}" "${topic}"; then
|
||||
warning "failed to drop the maintainer topic: ${topic}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -f ${REPO_CI} ]]; then
|
||||
msg "Adding ci support ..."
|
||||
commit_ci
|
||||
CI_ADDED=1
|
||||
fi
|
||||
|
||||
if [[ -n ${AGENT} ]] && (( ! CI_ADDED )); then
|
||||
msg "Switching ci support for [%s] ..." "${AGENT}"
|
||||
commit_ci
|
||||
fi
|
||||
|
||||
if [[ ! -f ${REPO_DB} ]]; then
|
||||
|
@@ -20,7 +20,8 @@ artixpkg_git_create_usage() {
|
||||
|
||||
OPTIONS
|
||||
-c, --clone Clone the Git repository after creation
|
||||
-t, --team=NAME Assign team name [default: world]
|
||||
-t, --team=NAME Assign team name (default: world)
|
||||
Possible values: [system, world, lib32, galaxy]
|
||||
-h, --help Show this help text
|
||||
|
||||
EXAMPLES
|
||||
@@ -34,9 +35,15 @@ artixpkg_git_create() {
|
||||
local pkgbase
|
||||
local clone=0
|
||||
local config=0
|
||||
local TEAM='world'
|
||||
local TEAM="${ARTIX_DB[5]}"
|
||||
local AGENT=()
|
||||
|
||||
local TEAMS=(system world lib32)
|
||||
local TEAMS=(
|
||||
"${ARTIX_DB[2]}"
|
||||
"${ARTIX_DB[5]}"
|
||||
"${ARTIX_DB[8]}"
|
||||
"${ARTIX_DB[11]}"
|
||||
)
|
||||
# variables
|
||||
local path
|
||||
|
||||
@@ -101,10 +108,13 @@ artixpkg_git_create() {
|
||||
fi
|
||||
msg_success "Successfully created ${pkgbase}"
|
||||
fi
|
||||
if [[ ${TEAM} == ${ARTIX_DB[11]} ]]; then
|
||||
AGENT+=(--agent="${TEAM}")
|
||||
fi
|
||||
if (( clone )); then
|
||||
artixpkg_git_clone "${pkgbase}"
|
||||
artixpkg_git_clone "${AGENT[@]}" "${pkgbase}"
|
||||
elif (( config )); then
|
||||
artixpkg_git_config
|
||||
artixpkg_git_config "${AGENT[@]}"
|
||||
fi
|
||||
|
||||
done
|
||||
|
@@ -38,6 +38,18 @@ check_pkgbuild_validity() {
|
||||
fi
|
||||
}
|
||||
|
||||
has_changeset(){
|
||||
git fetch origin &>/dev/null
|
||||
|
||||
if [[ $(git rev-parse HEAD) != $(git rev-parse @{u}) ]]; then
|
||||
msg2 "changes: yes"
|
||||
git status -sb
|
||||
return 0
|
||||
fi
|
||||
msg2 "changes: no"
|
||||
return 1
|
||||
}
|
||||
|
||||
artixpkg_repo_usage() {
|
||||
local -r COMMAND=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
|
||||
cat <<- _EOF_
|
||||
|
@@ -10,28 +10,20 @@ set -e
|
||||
|
||||
patch_pkgbase(){
|
||||
local name="$1"
|
||||
local pkgbuild
|
||||
pkgbuild=PKGBUILD
|
||||
|
||||
sed -e 's|arch-meson|artix-meson|' -i "${pkgbuild}"
|
||||
|
||||
case "${name}" in
|
||||
glibc)
|
||||
sed -e 's|{locale,systemd/system,tmpfiles.d}|{locale,tmpfiles.d}|' \
|
||||
-e '/nscd.service/d' \
|
||||
-i "${pkgbuild}"
|
||||
;;
|
||||
linux|linux-lts|linux-zen|linux-hardened|linux-rt|linux-rt-lts)
|
||||
sed -e 's|KBUILD_BUILD_HOST=.*|KBUILD_BUILD_HOST=artixlinux|' -i "${pkgbuild}"
|
||||
linux|linux-lts|linux-zen|linux-hardened|linux-rt*)
|
||||
sed -e 's|KBUILD_BUILD_HOST=.*|KBUILD_BUILD_HOST=artixlinux|' -i PKGBUILD
|
||||
sed -e 's|CONFIG_DEFAULT_HOSTNAME=.*|CONFIG_DEFAULT_HOSTNAME="artixlinux"|' \
|
||||
-i config
|
||||
;;
|
||||
gstreamer|gst-plugins-*|licenses)
|
||||
*)
|
||||
sed -e 's|https://www.archlinux.org/|https://www.artixlinux.org/|' \
|
||||
-e 's|(Arch Linux)|(Artix Linux)|' \
|
||||
-i "${pkgbuild}"
|
||||
-e 's|arch-meson|artix-meson|' \
|
||||
-i PKGBUILD
|
||||
;;
|
||||
esac
|
||||
git diff PKGBUILD
|
||||
}
|
||||
|
||||
|
||||
@@ -41,12 +33,14 @@ artixpkg_repo_import_usage() {
|
||||
Usage: ${COMMAND} [OPTIONS] [PKGBASE]...
|
||||
|
||||
OPTIONS
|
||||
--tag TAG Switch the current workspace to a specified version tag
|
||||
--tag TAG Switch the current workspace to a specified version tag
|
||||
--del Delete files before rsync import
|
||||
-h, --help Show this help text
|
||||
|
||||
EXAMPLES
|
||||
$ ${COMMAND} libfoo
|
||||
$ ${COMMAND} libfoo --tag TAG
|
||||
$ ${COMMAND} --tag TAG libfoo
|
||||
$ ${COMMAND} --tag TAG --del libfoo
|
||||
_EOF_
|
||||
}
|
||||
|
||||
@@ -76,20 +70,29 @@ artixpkg_repo_import() {
|
||||
|
||||
while (( $# )); do
|
||||
case $1 in
|
||||
--tag=*)
|
||||
TAG="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
artixpkg_repo_import_usage
|
||||
exit 0
|
||||
;;
|
||||
-*)
|
||||
die "invalid argument: %s" "$1"
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
--tag)
|
||||
(( $# <= 1 )) && die "missing argument for %s" "$1"
|
||||
TAG="$2"
|
||||
shift 2
|
||||
;;
|
||||
--tag=*)
|
||||
TAG="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--del)
|
||||
rsync_args+=(--delete-before)
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
artixpkg_repo_import_usage
|
||||
exit 0
|
||||
;;
|
||||
-*)
|
||||
die "invalid argument: %s" "$1"
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -111,9 +114,8 @@ artixpkg_repo_import() {
|
||||
fi
|
||||
stat_done
|
||||
|
||||
stat_busy "Fetching upstream tags"
|
||||
msg2 "Fetching upstream tags"
|
||||
git fetch --tags upstream main
|
||||
stat_done
|
||||
|
||||
local latest version
|
||||
latest=$(git describe --tags FETCH_HEAD)
|
||||
@@ -122,7 +124,15 @@ artixpkg_repo_import() {
|
||||
version="${TAG}"
|
||||
fi
|
||||
|
||||
stat_busy "Importing upstream changeset for ${version}"
|
||||
msg "Checking origin for changes"
|
||||
if has_changeset; then
|
||||
error "Remote changes detected! Please update (%s)" "${pkgbase}"
|
||||
fi
|
||||
|
||||
msg "Querying ${pkgbase} ..."
|
||||
if ! show_db; then
|
||||
warning "Could not query ${REPO_DB}"
|
||||
fi
|
||||
|
||||
git checkout "${version}" -b "${version}" &>/dev/null
|
||||
local temp
|
||||
@@ -132,10 +142,10 @@ artixpkg_repo_import() {
|
||||
git checkout master &>/dev/null
|
||||
git branch -D "${version}" &>/dev/null
|
||||
|
||||
stat_done
|
||||
|
||||
msg "Importing upstream changeset for ${version}"
|
||||
rsync "${rsync_args[@]}" "${temp}"/ "$(pwd)"/ #&>/dev/null
|
||||
|
||||
msg2 "Patching ${pkgbase} ..."
|
||||
patch_pkgbase "${pkgbase}"
|
||||
)
|
||||
fi
|
||||
|
@@ -84,34 +84,59 @@ artixpkg_repo_move() {
|
||||
die "No PKGBUILD found in (%s)" "${pkgbase}"
|
||||
fi
|
||||
|
||||
local commit_msg
|
||||
local commit_msg src_version dest_version
|
||||
commit_msg=$(get_commit_msg 'move' "${DEST}" "${SRC}")
|
||||
|
||||
update_yaml_move "${SRC}" "${DEST}"
|
||||
src_version=$(version_from_yaml "${SRC}")
|
||||
dest_version=$(version_from_yaml "${DEST}")
|
||||
|
||||
if [[ -n $(git status --porcelain --untracked-files=no) ]]; then
|
||||
if [[ "$src_version" != null ]]; then
|
||||
|
||||
local ret
|
||||
ret=$(vercmp "$src_version" "$dest_version")
|
||||
|
||||
if (( ret > 0 )); then
|
||||
|
||||
update_yaml_move "${SRC}" "${DEST}"
|
||||
|
||||
if [[ -n $(git status --porcelain --untracked-files=no) ]]; then
|
||||
|
||||
stat_busy 'Staging files'
|
||||
for f in $(git ls-files --modified); do
|
||||
if [[ "$f" == "${REPO_DB}" ]]; then
|
||||
git add "$f"
|
||||
fi
|
||||
done
|
||||
stat_done
|
||||
|
||||
msg 'Commit'
|
||||
git commit -m "${commit_msg}"
|
||||
|
||||
if (( PUSH )); then
|
||||
msg "Push (${pkgbase})"
|
||||
git push origin master
|
||||
fi
|
||||
|
||||
msg "Querying ${pkgbase} ..."
|
||||
if ! show_db; then
|
||||
warning "Could not query ${REPO_DB}"
|
||||
fi
|
||||
|
||||
stat_busy 'Staging files'
|
||||
for f in $(git ls-files --modified); do
|
||||
if [[ "$f" == "${REPO_DB}" ]]; then
|
||||
git add "$f"
|
||||
fi
|
||||
done
|
||||
stat_done
|
||||
|
||||
msg 'Commit'
|
||||
git commit -m "${commit_msg}"
|
||||
elif (( ret < 0 )); then
|
||||
|
||||
error "invalid move: version $src_version < $dest_version!"
|
||||
|
||||
else
|
||||
error "invalid move: version $src_version = $dest_version!"
|
||||
|
||||
if (( PUSH )); then
|
||||
msg "Push (${pkgbase})"
|
||||
git push origin master
|
||||
fi
|
||||
|
||||
msg "Querying ${pkgbase} ..."
|
||||
if ! show_db; then
|
||||
warning "Could not query ${REPO_DB}"
|
||||
fi
|
||||
else
|
||||
error "invalid move: version $src_version!"
|
||||
fi
|
||||
|
||||
)
|
||||
fi
|
||||
|
||||
|
@@ -8,18 +8,6 @@ ARTOOLS_INCLUDE_REPO_SHOW_SH=1
|
||||
set -e
|
||||
|
||||
|
||||
has_changeset(){
|
||||
git fetch origin &>/dev/null
|
||||
|
||||
if [[ $(git rev-parse HEAD) != $(git rev-parse @{u}) ]]; then
|
||||
msg2 "changes: yes"
|
||||
git status -sb
|
||||
return 0
|
||||
fi
|
||||
msg2 "changes: no"
|
||||
return 1
|
||||
}
|
||||
|
||||
artixpkg_repo_show_usage() {
|
||||
local -r COMMAND=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
|
||||
cat <<- _EOF_
|
||||
|
@@ -97,6 +97,8 @@ STARTDIR=$(pwd)
|
||||
(( RMDIR )) && trap 'rm -rf $TEMPDIR' EXIT INT TERM QUIT
|
||||
TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
||||
|
||||
changed=0
|
||||
|
||||
for _pkgname in "${pkgname[@]}"; do
|
||||
comparepkg=$_pkgname
|
||||
pkgurl=
|
||||
@@ -151,10 +153,16 @@ for _pkgname in "${pkgname[@]}"; do
|
||||
if ! diff_output="$(sdiff -s "$TEMPDIR/libraries-$_pkgname-old" "$TEMPDIR/libraries-$_pkgname")"; then
|
||||
message="Sonames differ in $_pkgname!"
|
||||
(( WARN )) && warning "$message" || msg "$message"
|
||||
printf "%s\n" "$diff_output"
|
||||
printf "%s\n" "$diff_output" 2>&1 | tee "${pkgfile##*/}-checkpkg.log"
|
||||
changed=1
|
||||
else
|
||||
msg "No soname differences for %s." "$_pkgname"
|
||||
fi
|
||||
done
|
||||
|
||||
(( RMDIR )) || msg "Files saved to %s" "$TEMPDIR"
|
||||
if ! (( RMDIR )); then
|
||||
msg "Files saved to %s" "$TEMPDIR"
|
||||
fi
|
||||
|
||||
exit "$changed"
|
||||
|
||||
|
@@ -79,14 +79,13 @@ IFS=: read -r _ _ _ _ _ HOME _ < <(getent passwd "${SUDO_USER:-$USER}")
|
||||
load_makepkg_config
|
||||
HOME=$ORIG_HOME
|
||||
|
||||
msg "Running checkpkg"
|
||||
[[ -d $PKGDEST ]] || PKGDEST=$PWD
|
||||
[[ -d $SRCDEST ]] || SRCDEST=$PWD
|
||||
[[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD
|
||||
[[ -d $LOGDEST ]] || LOGDEST=$PWD
|
||||
|
||||
if chroot-run \
|
||||
-b "-B:${PWD}:/startdir -B:${SRCDEST}:/srcdest" \
|
||||
"$copydir" true
|
||||
then
|
||||
mapfile -t pkgnames < <(sudo -u "$makepkg_user" bash -c 'source PKGBUILD; printf "%s\n" "${pkgname[@]}"')
|
||||
fi
|
||||
msg "Running checkpkg"
|
||||
mapfile -t pkgnames < <(bash -c 'source PKGBUILD; printf "%s\n" "${pkgname[@]}"')
|
||||
|
||||
mapfile -t remotepkgs < <(pacman --config "$copydir"/etc/pacman.conf \
|
||||
--dbpath "$copydir"/var/lib/pacman \
|
||||
@@ -109,15 +108,4 @@ for remotepkg in "${remotepkgs[@]}"; do
|
||||
fi
|
||||
done
|
||||
|
||||
pkgfiles="${remotepkgs[@]/#file:\/\//}"
|
||||
|
||||
sudo -u "$makepkg_user" checkpkg --rmdir --warn --makepkg-config "$copydir/etc/makepkg.conf" "${pkgfiles[@]}"
|
||||
|
||||
msg "Running namcap"
|
||||
#msg2 "Checking %s\n" "PKGBUILD"
|
||||
sudo -u "$makepkg_user" namcap PKGBUILD 2>&1 | tee "PKGBUILD-namcap.log"
|
||||
|
||||
for pkgfile in "${pkgfiles[@]}"; do
|
||||
#msg2 "Checking %s\n" "${pkgfile##*/}"
|
||||
sudo -u "$makepkg_user" namcap "$pkgfile" 2>&1 | tee "${pkgfile##*/}-namcap.log"
|
||||
done
|
||||
sudo -u "$makepkg_user" checkpkg --rmdir --warn --makepkg-config "$copydir/etc/makepkg.conf" "${remotepkgs[@]/#file:\/\//}"
|
||||
|
@@ -36,5 +36,10 @@ for pkg in "${passfiles[@]}"; do
|
||||
msg2 "Found: %s" "${pkgfile}"
|
||||
[[ -e "${pkgfile}".sig ]] && rm "${pkgfile}".sig
|
||||
sign_pkg "${pkgfile}"
|
||||
ret=0
|
||||
else
|
||||
ret=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit "$ret"
|
||||
|
Reference in New Issue
Block a user