forked from artix/artools
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
98ad5abd88 | |||
660a7025a7 | |||
f5daac0d67 | |||
2484ea39a4 | |||
9b222bdb83 | |||
a3e6b17c5f | |||
21a37f6b00 | |||
80416b76d5 | |||
2113ffe4c6 | |||
438473c878 | |||
86c5c2f47b | |||
d333c245c0 | |||
4a650f00d7 | |||
08b73032a2 | |||
1a250c2167 | |||
46431619f2 | |||
12d2159c12 | |||
3865ceab58 | |||
890e631e1b | |||
273e928905 | |||
f5c328f8e5 | |||
4089151791 | |||
211579f9d7 | |||
2a85209e1e | |||
40d691bc85 |
18
Makefile
18
Makefile
@@ -1,4 +1,4 @@
|
||||
VERSION=0.17
|
||||
VERSION=0.19
|
||||
|
||||
CHROOT_VERSION=0.10
|
||||
|
||||
@@ -14,7 +14,6 @@ BASE_CONF = \
|
||||
data/conf/artools-base.conf
|
||||
|
||||
BASE_BIN = \
|
||||
bin/base/signfile \
|
||||
bin/base/chroot-run \
|
||||
bin/base/mkchroot \
|
||||
bin/base/basestrap \
|
||||
@@ -45,7 +44,8 @@ PKG_BIN = \
|
||||
bin/pkg/checkpkg \
|
||||
bin/pkg/finddeps \
|
||||
bin/pkg/find-libdeps \
|
||||
bin/pkg/batchpkg
|
||||
bin/pkg/batchpkg \
|
||||
bin/pkg/signpkg
|
||||
|
||||
LN_COMMITPKG = \
|
||||
extrapkg \
|
||||
@@ -116,6 +116,11 @@ ISO_LIBS = \
|
||||
|
||||
ISO_UTIL = lib/util-iso.sh
|
||||
|
||||
DOCKER_DATA = \
|
||||
data/docker/pacman-docker.conf
|
||||
|
||||
DOCKER_ALPM = \
|
||||
data/docker/package-cleanup.hook
|
||||
|
||||
DIRMODE = -dm0755
|
||||
FILEMODE = -m0644
|
||||
@@ -154,6 +159,13 @@ $(BIN): %: %.in Makefile
|
||||
clean:
|
||||
$(RM) $(BIN) $(UTIL)
|
||||
|
||||
install_docker:
|
||||
install $(DIRMODE) $(DESTDIR)$(DATADIR)/$(TOOLS)
|
||||
install $(FILEMODE) $(DOCKER_DATA) $(DESTDIR)$(DATADIR)/$(TOOLS)
|
||||
|
||||
install $(DIRMODE) $(DESTDIR)$(DATADIR)/libalpm/hooks
|
||||
install $(FILEMODE) $(DOCKER_ALPM) $(DESTDIR)$(DATADIR)/libalpm/hooks
|
||||
|
||||
install_base:
|
||||
install $(DIRMODE) $(DESTDIR)$(SYSCONFDIR)/$(TOOLS)
|
||||
install $(FILEMODE) $(BASE_CONF) $(DESTDIR)$(SYSCONFDIR)/$(TOOLS)
|
||||
|
@@ -147,7 +147,7 @@ elif [[ $(cat "$working_dir/.artools") != ${CHROOTVERSION} ]]; then
|
||||
die "chroot '%s' is not at version %s. Please rebuild." "$working_dir" "${CHROOTVERSION}"
|
||||
fi
|
||||
|
||||
sync_host_localtime
|
||||
#sync_host_localtime
|
||||
|
||||
chroot_api_mount "${working_dir}" || die "failed to setup API filesystems in chroot %s" "${working_dir}"
|
||||
|
||||
|
@@ -1,32 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2018-19 artoo@artixlinux.org
|
||||
# Copyright (C) 2018 Artix Linux Developers
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
. @libdir@/artools/util-base.sh
|
||||
|
||||
load_makepkg_config
|
||||
|
||||
file_to_sign="$1"
|
||||
|
||||
if [ ! -e "$1" ]; then
|
||||
error "%s does not exist!" "$file_to_sign"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "${BUILDBOT_GPGP}" ]]; then
|
||||
msg2 "Signing [%s]" "${file_to_sign##*/}"
|
||||
gpg --batch --passphrase "${BUILDBOT_GPGP}" --detach-sign "$file_to_sign"
|
||||
else
|
||||
msg2 "Signing [%s] with key %s" "${file_to_sign##*/}" "${GPGKEY}..."
|
||||
gpg --detach-sign --use-agent -u "${GPGKEY}" "$file_to_sign"
|
||||
fi
|
@@ -30,6 +30,7 @@ base_devel=('base-devel')
|
||||
usage() {
|
||||
echo "Usage: ${0##*/} [options] -- [mkchrootpkg_args]"
|
||||
echo " -r <dir> Create chroots in this directory"
|
||||
echo " -d <dir> Destination repo chroot"
|
||||
echo ' -c Recreate the chroot before building'
|
||||
echo ' -m Major rebuild'
|
||||
echo ' -N Disable check() function'
|
||||
@@ -43,11 +44,12 @@ usage() {
|
||||
|
||||
orig_argv=("$0" "$@")
|
||||
|
||||
opts='hcCNmr:'
|
||||
opts='hcCNmr:d:'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
r) CHROOTS_PKG="$OPTARG" ;;
|
||||
d) repo="$OPTARG" ;;
|
||||
c) create_first=true ;;
|
||||
m) rebuild=true ;;
|
||||
C) is_checkpkg=true; mkchrootpkg_args+=(-C) ;;
|
||||
|
@@ -17,32 +17,38 @@
|
||||
prepare_artools
|
||||
|
||||
patch_pkg(){
|
||||
local pkg="$1"
|
||||
local pkgpath="$1"
|
||||
local pkg=${pkgpath%/*}
|
||||
pkg=${pkg##*/}
|
||||
case $pkg in
|
||||
glibc)
|
||||
msg2 "Patching %s" "$pkg"
|
||||
sed -e 's|{locale,systemd/system,tmpfiles.d}|{locale,tmpfiles.d}|' \
|
||||
-e '/nscd.service/d' \
|
||||
-i $pkg/PKGBUILD
|
||||
-i $pkgpath/PKGBUILD
|
||||
;;
|
||||
linux|linux-lts)
|
||||
sed -e 's|KBUILD_BUILD_HOST=.*|KBUILD_BUILD_HOST=artixlinux|' -i $pkg/PKGBUILD
|
||||
msg2 "Patching %s" "$pkg"
|
||||
sed -e 's|KBUILD_BUILD_HOST=.*|KBUILD_BUILD_HOST=artixlinux|' -i $pkgpath/PKGBUILD
|
||||
sed -e 's|CONFIG_DEFAULT_HOSTNAME=.*|CONFIG_DEFAULT_HOSTNAME="artixlinux"|' \
|
||||
-i $pkg/config
|
||||
-i $pkgpath/config
|
||||
;;
|
||||
bash)
|
||||
msg2 "Patching %s" "$pkg"
|
||||
sed -e 's|system.bash_logout)|system.bash_logout artix.bashrc)|' \
|
||||
-e "s|etc/bash.|etc/bash/|g" \
|
||||
-e 's|"$pkgdir/etc/skel/.bash_logout"|"$pkgdir/etc/skel/.bash_logout"\n install -Dm644 artix.bashrc $pkgdir/etc/bash/bashrc.d/artix.bashrc|' \
|
||||
-i $pkg/PKGBUILD
|
||||
cd $pkg
|
||||
-i $pkgpath/PKGBUILD
|
||||
cd $pkgpath
|
||||
patch -Np 1 -i ${DATADIR}/patches/artix-bash.patch
|
||||
updpkgsums
|
||||
cd ../..
|
||||
;;
|
||||
gstreamer|gst-plugins-*|licenses)
|
||||
msg2 "Patching %s" "$pkg"
|
||||
sed -e 's|https://www.archlinux.org/|https://www.artixlinux.org/|' \
|
||||
-e 's|(Arch Linux)|(Artix Linux)|' \
|
||||
-i $pkg/PKGBUILD
|
||||
-i $pkgpath/PKGBUILD
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -79,7 +85,7 @@ pull_tree_artix(){
|
||||
sync_pkg(){
|
||||
local rsync_args=(-aWxvci --progress --delete-before --no-R --no-implied-dirs)
|
||||
local src="$1" dest="$2"
|
||||
|
||||
msg "Sync from Arch [%s] to Artix [%s]" "${src##*archlinux/}" "${dest##*artixlinux/}"
|
||||
rsync "${rsync_args[@]}" $src/ $dest/
|
||||
}
|
||||
|
||||
@@ -105,23 +111,17 @@ show_deps(){
|
||||
}
|
||||
|
||||
subrepo_new(){
|
||||
local group="${1:-$GROUP}" team="${2:-$TEAM}"
|
||||
local dest=${TREE_DIR_ARTIX}/$group/${PACKAGE}/trunk
|
||||
|
||||
cd ${TREE_DIR_ARTIX}/$group
|
||||
|
||||
msg2 "team: %s" "$team"
|
||||
msg2 "group: %s" "$group"
|
||||
cd ${TREE_DIR_ARTIX}/${GROUP}
|
||||
|
||||
local org=$(get_pkg_org "${PACKAGE}")
|
||||
|
||||
create_repo "${PACKAGE}" "$org"
|
||||
|
||||
add_repo_to_team "${PACKAGE}" "$org" "$team"
|
||||
add_repo_to_team "${PACKAGE}" "$org" "${TEAM}"
|
||||
|
||||
subrepo_clone "${PACKAGE}" "$org"
|
||||
|
||||
prepare_dir "$dest"
|
||||
prepare_dir "${TREE_DIR_ARTIX}/${GROUP}/${PACKAGE}/trunk"
|
||||
|
||||
commit_jenkins_files "${PACKAGE}"
|
||||
}
|
||||
@@ -132,40 +132,30 @@ from_arch(){
|
||||
local srcpath=$(find_pkg "${TREE_DIR_ARCH}" "${PACKAGE}")
|
||||
[[ -z $srcpath ]] && die "Package '%s' does not exist!" "${PACKAGE}"
|
||||
|
||||
local repo=$(find_repo "$srcpath" "${testing}" "${staging}" "${unstable}")
|
||||
|
||||
archpath=$srcpath/repos/$repo
|
||||
local artixpath=$(find_pkg ${TREE_DIR_ARTIX} ${PACKAGE})
|
||||
local tree=${srcpath%/*}
|
||||
local tree=${tree##*/}
|
||||
local group=$(get_group "${PACKAGE}" "$tree")
|
||||
|
||||
local repo=$(find_repo "$srcpath")
|
||||
msg "repo: %s" "$repo"
|
||||
artixpath=$artixpath/trunk
|
||||
|
||||
local archpath=$srcpath/repos/$repo
|
||||
local artixpath=$(find_pkg "${TREE_DIR_ARTIX}" "${PACKAGE}")
|
||||
|
||||
show_deps "$archpath"
|
||||
|
||||
if [[ -f $artixpath/PKGBUILD ]];then
|
||||
if [[ -f "$artixpath"/.gitrepo ]]; then
|
||||
artixpath="$artixpath"/trunk
|
||||
|
||||
. $artixpath/PKGBUILD 2>/dev/null
|
||||
local artixver=$(get_full_version)
|
||||
|
||||
msg2 "Artix Version: %s" "$artixver"
|
||||
if [[ -d "$artixpath" ]];then
|
||||
sync_pkg "$archpath" "$artixpath"
|
||||
patch_pkg "$artixpath"
|
||||
fi
|
||||
else
|
||||
artixpath=${TREE_DIR_ARTIX}/$group/${PACKAGE}/trunk
|
||||
subrepo_new "${group}" "${repo%-*}"
|
||||
die "Package '%s' does not exist!" "${PACKAGE}"
|
||||
fi
|
||||
|
||||
msg "Sync (%s) from Arch [%s] to Artix [%s]" "${PACKAGE}" "${archpath##*archlinux/}" "${artixpath##*artixlinux/}"
|
||||
|
||||
sync_pkg "$archpath" "$artixpath"
|
||||
patch_pkg "$artixpath"
|
||||
}
|
||||
|
||||
view_build(){
|
||||
local archpath=$(find_pkg "${TREE_DIR_ARCH}" "${PACKAGE}")
|
||||
[[ -z $archpath ]] && die "Package '%s' does not exist!" "${PACKAGE}"
|
||||
local repo=$(find_repo "${archpath}" "${testing}" "${staging}" "${unstable}")
|
||||
local repo=$(find_repo "${archpath}")
|
||||
archpath=$archpath/repos/$repo
|
||||
msg2 "repo: %s" "$repo"
|
||||
show_deps "$archpath"
|
||||
@@ -174,7 +164,7 @@ view_build(){
|
||||
check_tree(){
|
||||
local archpath=$(find_pkg "${TREE_DIR_ARCH}" "${PACKAGE}")
|
||||
[[ -z $archpath ]] && die "Package '%s' does not exist!" "${PACKAGE}"
|
||||
local artixpath=$(find_pkg "${TREE_DIR_ARTIX}" ${PACKAGE})
|
||||
local artixpath=$(find_pkg "${TREE_DIR_ARTIX}" "${PACKAGE}")
|
||||
local group=${artixpath%/*}
|
||||
msg "group: %s" "${group##*/}"
|
||||
|
||||
@@ -195,16 +185,16 @@ sync_repos(){
|
||||
|
||||
load_makepkg_config
|
||||
|
||||
testing=true
|
||||
staging=true
|
||||
unstable=false
|
||||
|
||||
sync=false
|
||||
sync_arch=true
|
||||
sync_artix=true
|
||||
import=false
|
||||
view=false
|
||||
createnew=false
|
||||
conf=false
|
||||
unstable=false
|
||||
staging=true
|
||||
testing=true
|
||||
sync_group=false
|
||||
check=false
|
||||
|
||||
@@ -222,15 +212,15 @@ usage() {
|
||||
echo ' -g <group> Group name, the superrepo (only with -n or -s)'
|
||||
echo " [default: ${GROUP}]"
|
||||
echo " -s Clone or pull repos"
|
||||
echo " -z Don't clone or pull arch repos"
|
||||
echo " -y Don't clone or pull artix repos"
|
||||
echo " -a Don't clone or pull arch repos"
|
||||
echo " -b Don't clone or pull artix repos"
|
||||
echo ' -i Import a package from arch repos'
|
||||
echo ' -n Make new remote subrepo and clone it'
|
||||
echo ' -u Include kde & gnome unstable (only with -i)'
|
||||
echo ' -w Exclude staging (only with -i)'
|
||||
echo ' -x Exclude testing (only with -i)'
|
||||
echo ' -n New remote subrepo and clone it'
|
||||
echo ' -v Check if a package is in the artix tree(s)'
|
||||
echo ' -c View package depends'
|
||||
echo ' -x Exclude testing (only with -i)'
|
||||
echo ' -y Exclude staging (only with -i)'
|
||||
echo ' -z Include kde & gnome unstable (only with -i)'
|
||||
echo ' -h This help'
|
||||
echo ''
|
||||
echo ''
|
||||
@@ -239,7 +229,7 @@ usage() {
|
||||
|
||||
orig_argv=("$0" "$@")
|
||||
|
||||
opts='p:t:g:uwsinxzycvh'
|
||||
opts='p:t:g:sinabcvxyzh'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
@@ -247,15 +237,15 @@ while getopts "${opts}" arg; do
|
||||
t) TEAM="$OPTARG" ;;
|
||||
g) GROUP="$OPTARG"; sync_group=true ;;
|
||||
s) sync=true ;;
|
||||
z) sync_arch=false ;;
|
||||
y) sync_artix=false ;;
|
||||
a) sync_arch=false ;;
|
||||
b) sync_artix=false ;;
|
||||
i) import=true ;;
|
||||
n) createnew=true ;;
|
||||
w) staging=false ;;
|
||||
x) testing=false ;;
|
||||
u) unstable=true ;;
|
||||
c) check=true ;;
|
||||
v) view=true ;;
|
||||
x) testing=false ;;
|
||||
y) staging=false ;;
|
||||
z) unstable=true ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||
esac
|
||||
@@ -266,6 +256,8 @@ shift $(($OPTIND - 1))
|
||||
prepare_dir "${TREE_DIR_ARTIX}"
|
||||
prepare_dir "${TREE_DIR_ARCH}"
|
||||
|
||||
set_arch_repos "$testing" "$staging" "$unstable"
|
||||
|
||||
${sync} && sync_repos
|
||||
|
||||
${view} && view_build
|
||||
|
@@ -18,6 +18,68 @@ shopt -s extglob
|
||||
|
||||
load_makepkg_config
|
||||
|
||||
pkgver_equal() {
|
||||
if [[ $1 = *-* && $2 = *-* ]]; then
|
||||
# if both versions have a pkgrel, then they must be an exact match
|
||||
[[ $1 = "$2" ]]
|
||||
else
|
||||
# otherwise, trim any pkgrel and compare the bare version.
|
||||
[[ ${1%%-*} = "${2%%-*}" ]]
|
||||
fi
|
||||
}
|
||||
|
||||
find_cached_package() {
|
||||
local searchdirs=("$PKGDEST" "$PWD") results=()
|
||||
local targetname=$1 targetver=$2 targetarch=$3
|
||||
local dir pkg pkgbasename name ver rel arch r results
|
||||
|
||||
for dir in "${searchdirs[@]}"; do
|
||||
[[ -d $dir ]] || continue
|
||||
|
||||
for pkg in "$dir"/*.pkg.tar?(.!(sig|*.*)); do
|
||||
[[ -f $pkg ]] || continue
|
||||
|
||||
# avoid adding duplicates of the same inode
|
||||
for r in "${results[@]}"; do
|
||||
[[ $r -ef $pkg ]] && continue 2
|
||||
done
|
||||
|
||||
# split apart package filename into parts
|
||||
pkgbasename=${pkg##*/}
|
||||
pkgbasename=${pkgbasename%.pkg.tar*}
|
||||
|
||||
arch=${pkgbasename##*-}
|
||||
pkgbasename=${pkgbasename%-"$arch"}
|
||||
|
||||
rel=${pkgbasename##*-}
|
||||
pkgbasename=${pkgbasename%-"$rel"}
|
||||
|
||||
ver=${pkgbasename##*-}
|
||||
name=${pkgbasename%-"$ver"}
|
||||
|
||||
if [[ $targetname = "$name" && $targetarch = "$arch" ]] &&
|
||||
pkgver_equal "$targetver" "$ver-$rel"; then
|
||||
results+=("$pkg")
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
case ${#results[*]} in
|
||||
0)
|
||||
return 1
|
||||
;;
|
||||
1)
|
||||
printf '%s\n' "${results[0]}"
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
error 'Multiple packages found:'
|
||||
printf '\t%s\n' "${results[@]}" >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<- _EOF_
|
||||
Usage: ${BASH_SOURCE[0]##*/} [OPTIONS]
|
||||
|
@@ -26,7 +26,11 @@ get_path(){
|
||||
}
|
||||
|
||||
prepare_commit(){
|
||||
local dest="$1"
|
||||
local dest="$1" to_rm="${2:-none}"
|
||||
if [[ -d repos/$to_rm ]]; then
|
||||
git rm -r repos/$to_rm
|
||||
git commit -m "change of package arch"
|
||||
fi
|
||||
[[ -d repos/$dest ]] && git rm -r repos/$dest
|
||||
[[ ! -d repos ]] && mkdir repos
|
||||
[[ ! -d repos/$dest ]] && mkdir repos/$dest
|
||||
@@ -101,6 +105,15 @@ commit_pkg(){
|
||||
fi
|
||||
}
|
||||
|
||||
get_rm_arch(){
|
||||
local rm_arch='none'
|
||||
case "$CARCH" in
|
||||
'any') rm_arch="${REPO_DEST}-x86_64" ;;
|
||||
'x86_64') rm_arch="${REPO_DEST}-any" ;;
|
||||
esac
|
||||
echo $rm_arch
|
||||
}
|
||||
|
||||
repo_commit_pkg(){
|
||||
local artixpath=$(find_pkg "${TREE_DIR_ARTIX}" "${PACKAGE}")
|
||||
if [[ -n ${artixpath} ]];then
|
||||
@@ -124,7 +137,7 @@ repo_commit_pkg(){
|
||||
local action='add'
|
||||
local dest="${REPO_DEST}-$CARCH"
|
||||
|
||||
prepare_commit "$dest"
|
||||
prepare_commit "$dest" "$(get_rm_arch)"
|
||||
|
||||
cp trunk/* repos/$dest/
|
||||
else
|
||||
@@ -132,7 +145,7 @@ repo_commit_pkg(){
|
||||
local src="${REPO_SRC}-$CARCH" dest="${REPO_DEST}-$CARCH"
|
||||
|
||||
[[ ! -f repos/$src/PKGBUILD ]] && die "%s does not exist!" "repos/$src/PKGBUILD"
|
||||
prepare_commit "$dest"
|
||||
prepare_commit "$dest" "$(get_rm_arch)"
|
||||
|
||||
cp repos/$src/* repos/$dest/
|
||||
git rm -r repos/$src
|
||||
@@ -161,6 +174,18 @@ repo_commit_pkg(){
|
||||
fi
|
||||
}
|
||||
|
||||
is_valid_repo(){
|
||||
local src="$1" cases=
|
||||
set_arch_repos true true true
|
||||
for r in ${ARCH_REPOS[@]};do
|
||||
cases=${cases:-}${cases:+|}${r}
|
||||
done
|
||||
eval "case $src in
|
||||
${cases}|trunk) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac"
|
||||
}
|
||||
|
||||
load_makepkg_config
|
||||
|
||||
REPO_SRC='trunk'
|
||||
|
@@ -26,8 +26,9 @@ get_import_path(){
|
||||
}
|
||||
|
||||
compare_m(){
|
||||
local result=$(vercmp "$artixver" "$archver")
|
||||
local artixver="$1" artixrepo="$2" archver="$3" archrepo="$4"
|
||||
|
||||
local result=$(vercmp "$artixver" "$archver")
|
||||
if [[ $artixrepo == *testing* ]] || [[ $artixrepo == *staging* ]]; then
|
||||
if [[ "$archrepo" == "$artixrepo" ]]; then
|
||||
msg_row "${table}" "${archrepo%-*}" "${artixrepo%-*}" "$pkg" "$archver" "$artixver" "${group#*-}"
|
||||
@@ -42,8 +43,9 @@ compare_m(){
|
||||
}
|
||||
|
||||
compare_u(){
|
||||
local result=$(vercmp "$artixver" "$archver")
|
||||
local artixver="$1" artixrepo="$2" archver="$3" archrepo="$4"
|
||||
|
||||
local result=$(vercmp "$artixver" "$archver")
|
||||
if [ $result -eq -1 ];then
|
||||
msg_row_upgrade "${table}" "${archrepo%-*}" "${artixrepo%-*}" "$pkg" "$archver" "$artixver" "${group#*-}"
|
||||
printf "%s\n" "${archrepo%-*}:$pkg" >> ${TREE_DIR_ARTIX}/pkg_upgrades.list
|
||||
@@ -51,8 +53,9 @@ compare_u(){
|
||||
}
|
||||
|
||||
compare_d(){
|
||||
local result=$(vercmp "$artixver" "$archver")
|
||||
local artixver="$1" artixrepo="$2" archver="$3" archrepo="$4"
|
||||
|
||||
local result=$(vercmp "$artixver" "$archver")
|
||||
if [ $result -eq 1 ];then
|
||||
if [[ -n "$archver" ]] && [[ -n "$archrepo" ]];then
|
||||
msg_row_downgrade "${table}" "${archrepo%-*}" "${artixrepo%-*}" "$pkg" "$archver" "$artixver" "${group#*-}"
|
||||
@@ -65,7 +68,7 @@ pre_compare(){
|
||||
local group="${pkgpath%/*}"
|
||||
group=${group##*/}
|
||||
local pkg=${pkgpath##*/}
|
||||
local artixrepo=$(find_repo "$pkgpath" "${testing}" "${staging}" "${unstable}")
|
||||
local artixrepo=$(find_repo "$pkgpath")
|
||||
local pkgbuild=$pkgpath/repos/$artixrepo/PKGBUILD
|
||||
|
||||
if [[ -f $pkgbuild ]];then
|
||||
@@ -73,7 +76,7 @@ pre_compare(){
|
||||
local artixver=$(get_full_version)
|
||||
|
||||
local archpath=$(get_import_path $pkg)
|
||||
local archrepo=$(find_repo "${archpath}" "${testing}" "${staging}" "${unstable}")
|
||||
local archrepo=$(find_repo "${archpath}")
|
||||
pkgbuild=$archpath/repos/$archrepo/PKGBUILD
|
||||
|
||||
if [[ -f "$pkgbuild" ]];then
|
||||
@@ -155,7 +158,6 @@ query_db() {
|
||||
read -r match
|
||||
pkg=${pkg#${db}}
|
||||
pkg="${pkg%/*}"
|
||||
|
||||
msg_row "${tableQ}" "${repo}" "${pkg}" "${match}"
|
||||
done < <(grep -rZ "${library}" "${db}") | sort -u
|
||||
fi
|
||||
@@ -182,9 +184,7 @@ check_db(){
|
||||
local pkg=${pkgpath##*/}
|
||||
local sarch=(any ${ARCH})
|
||||
|
||||
local repos=$(arch_repos "${testing}" "${staging}" "${unstable}")
|
||||
|
||||
for repo in ${repos[@]};do
|
||||
for repo in ${ARCH_REPOS[@]};do
|
||||
for a in ${sarch[@]};do
|
||||
|
||||
local pkgbuild=$pkgpath/repos/$repo-$a/PKGBUILD
|
||||
@@ -221,21 +221,40 @@ db_cache_dir="${XDG_CACHE_HOME:-$USER_HOME/.cache}/artools"
|
||||
|
||||
load_makepkg_config
|
||||
|
||||
unstable=false
|
||||
testing=true
|
||||
staging=true
|
||||
unstable=false
|
||||
|
||||
upgrades=false
|
||||
downgrades=false
|
||||
move=false
|
||||
check=false
|
||||
|
||||
sync=false
|
||||
check=false
|
||||
query=false
|
||||
testing=true
|
||||
|
||||
readonly table="%-18s %-18s %-25s %-27s %-27s %-10s"
|
||||
readonly tableU="%-20s %-35s %-30s %-10s"
|
||||
readonly tableQ="%-20s %-45s %s"
|
||||
|
||||
declare -A REPOS=(
|
||||
[core]=system
|
||||
[extra]=world
|
||||
[community]=galaxy
|
||||
[multilib]=lib32
|
||||
[testing]=gremlins
|
||||
[staging]=goblins
|
||||
[community-testing]=galaxy-gremlins
|
||||
[community-staging]=galaxy-goblins
|
||||
[multilib-testing]=lib32-gremlins
|
||||
[multilib-staging]=lib32-goblins
|
||||
[kde-unstable]=kde-wobble
|
||||
[gnome-unstable]=gnome-wobble
|
||||
)
|
||||
|
||||
searchrepos=(
|
||||
${REPOS[kde-unstable]}
|
||||
${REPOS[gnome-unstable]}
|
||||
${REPOS[staging]}
|
||||
${REPOS[testing]}
|
||||
${REPOS[core]}
|
||||
@@ -246,8 +265,6 @@ searchrepos=(
|
||||
${REPOS[multilib-staging]}
|
||||
${REPOS[multilib-testing]}
|
||||
${REPOS[multilib]}
|
||||
${REPOS[kde-unstable]}
|
||||
${REPOS[gnome-unstable]}
|
||||
)
|
||||
|
||||
usage() {
|
||||
@@ -255,11 +272,11 @@ usage() {
|
||||
echo ' -u Show upgrade packages'
|
||||
echo ' -d Show downgrade packages'
|
||||
echo ' -m Show packages to move'
|
||||
echo " -z Don't inlcude testing packages"
|
||||
echo " -x Don't inlcude staging packages"
|
||||
echo ' -y Include unstable kde and gnome'
|
||||
echo ' -c Check repos'
|
||||
echo " -x Don't inlcude testing packages"
|
||||
echo " -y Don't inlcude staging packages"
|
||||
echo ' -z Include unstable kde and gnome'
|
||||
echo " -s Sync repo databases"
|
||||
echo ' -c Check repos'
|
||||
echo " -q Query repo databases for so libs"
|
||||
echo ' -r <repo> Repo name to query'
|
||||
echo ' [default: all]'
|
||||
@@ -271,20 +288,20 @@ usage() {
|
||||
|
||||
orig_argv=("$0" "$@")
|
||||
|
||||
opts='r:qcsudmzxyh'
|
||||
opts='r:qcsudmxyzh'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
u) upgrades=true ;;
|
||||
d) downgrades=true ;;
|
||||
m) move=true ;;
|
||||
x) staging=false ;;
|
||||
y) unstable=true ;;
|
||||
z) testing=false ;;
|
||||
c) check=true ;;
|
||||
s) sync=true ;;
|
||||
c) check=true ;;
|
||||
q) query=true ;;
|
||||
r) searchrepos=("$OPTARG") ;;
|
||||
x) testing=false ;;
|
||||
y) staging=false ;;
|
||||
z) unstable=true ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||
esac
|
||||
@@ -294,6 +311,8 @@ shift $(($OPTIND - 1))
|
||||
|
||||
library="$1"; shift
|
||||
|
||||
set_arch_repos "$testing" "$staging" "$unstable"
|
||||
|
||||
${move} && show_move_table
|
||||
|
||||
${upgrades} && show_upgrades_table
|
||||
|
@@ -16,35 +16,11 @@
|
||||
|
||||
prepare_artools
|
||||
|
||||
find_cached_pkgfile() {
|
||||
local searchdirs=("$PKGDEST" "$PWD") results=()
|
||||
local pkg="$1"
|
||||
local search=${pkg%.*}
|
||||
for dir in "${searchdirs[@]}"; do
|
||||
[[ -d $dir ]] || continue
|
||||
results+=$(find "$dir" -type f -name "$search.*" ! -path '*.sig')
|
||||
done
|
||||
case ${#results[*]} in
|
||||
0)
|
||||
return 1
|
||||
;;
|
||||
1)
|
||||
printf '%s\n' "${results[0]}"
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
error 'Multiple packages found:'
|
||||
printf '\t%s\n' "${results[@]}" >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_pkgbasename(){
|
||||
local pkg="$1"
|
||||
local pkgbasename name ver rel arch
|
||||
|
||||
pkgbasename=${pkg%.pkg.tar.?z}
|
||||
pkgbasename=${pkg%.pkg.tar*}
|
||||
arch=${pkgbasename##*-}
|
||||
pkgbasename=${pkgbasename%-"$arch"}
|
||||
|
||||
@@ -57,86 +33,41 @@ get_pkgbasename(){
|
||||
echo $name
|
||||
}
|
||||
|
||||
update_repo2(){
|
||||
local repo="$1"
|
||||
local repo_path=${REPOS_ROOT}/$repo/os/${ARCH} packages=()
|
||||
|
||||
for name in ${passfiles[@]}; do
|
||||
if pkgfile=$(find_cached_pkgfile "$name");then
|
||||
info "Found: %s" "$name"
|
||||
if ${add_pkg};then
|
||||
local action='add'
|
||||
packages+=("$name")
|
||||
if ${sign_pkg};then
|
||||
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
||||
signfile ${pkgfile}
|
||||
fi
|
||||
ln -sf ${pkgfile}{,.sig} $repo_path/
|
||||
elif ${del_pkg};then
|
||||
local action='remove'
|
||||
packages+=("$(get_pkgbasename "$name")")
|
||||
[[ -e $repo_path/$name ]] && rm $repo_path/$name
|
||||
[[ -e $repo_path/$name.sig ]] && rm $repo_path/$name.sig
|
||||
fi
|
||||
fi
|
||||
done
|
||||
cd $repo_path
|
||||
if [[ -n $action ]]; then
|
||||
repo-$action -R $repo.${PKGDBEXT} ${packages[@]}
|
||||
${linksdb} && links-$action $repo.${LINKSDBEXT} ${packages[@]}
|
||||
fi
|
||||
|
||||
return 0
|
||||
add(){
|
||||
packages+=("$pkg.$ext")
|
||||
action='add'
|
||||
ln -sf "${pkgfile}"{,.sig} "$repo_path"/
|
||||
}
|
||||
|
||||
update_repo(){
|
||||
local repo="$1" pkgfile ver
|
||||
local repo_path=${REPOS_ROOT}/$repo/os/${ARCH} packages=()
|
||||
remove(){
|
||||
local to_remove=$(get_pkgbasename "$pkg.$ext")
|
||||
packages+=("$to_remove")
|
||||
action='remove'
|
||||
rm "$repo_path"/"$to_remove"*pkg.tar*
|
||||
}
|
||||
|
||||
. PKGBUILD
|
||||
|
||||
local pkgsearch=(${pkgname[@]})
|
||||
if check_option "debug" "y"; then
|
||||
pkgbase=${pkgbase:-${pkgname[@]}}
|
||||
pkgsearch+=("${pkgbase}-debug")
|
||||
fi
|
||||
|
||||
for name in ${pkgsearch[@]}; do
|
||||
pkgarch=$(get_pkg_arch "$name")
|
||||
ver=$(get_full_version)
|
||||
if pkgfile=$(find_cached_package "$name" "$ver" "$pkgarch");then
|
||||
local pkg=${pkgfile##*/}
|
||||
info "Found: %s" "$pkg"
|
||||
if ${add_pkg};then
|
||||
local action='add'
|
||||
packages+=("$pkg")
|
||||
if ${sign_pkg};then
|
||||
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
||||
signfile ${pkgfile}
|
||||
fi
|
||||
ln -sf ${pkgfile}{,.sig} $repo_path/
|
||||
elif ${del_pkg};then
|
||||
local action='remove'
|
||||
packages+=("$name")
|
||||
[[ -e $repo_path/$pkg ]] && rm $repo_path/$pkg
|
||||
[[ -e $repo_path/$pkg.sig ]] && rm $repo_path/$pkg.sig
|
||||
repo_action(){
|
||||
local packages=() action= func="$1"
|
||||
for pkgname in ${passfiles[@]}; do
|
||||
pkg=${pkgname%.*}
|
||||
for ext in zst xz;do
|
||||
if pkgfile=$(find_cached_pkgfile "$pkg.$ext");then
|
||||
msg "Found: %s" "${pkgfile}"
|
||||
"$func"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
cd $repo_path
|
||||
if [[ -n $action ]]; then
|
||||
repo-$action -R $repo.${PKGDBEXT} ${packages[@]}
|
||||
${linksdb} && links-$action $repo.${LINKSDBEXT} ${packages[@]}
|
||||
if [[ -n "$action" ]]; then
|
||||
repo-"$action" -R "${dest_repo}"."${PKGDBEXT}" "${packages[@]}"
|
||||
${linksdb} && links-"$action" "${dest_repo}"."${LINKSDBEXT}" "${packages[@]}"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
load_makepkg_config
|
||||
|
||||
add_pkg=false
|
||||
del_pkg=false
|
||||
sign_pkg=false
|
||||
rm_pkg=false
|
||||
linksdb=false
|
||||
|
||||
cmd=${0##*/}
|
||||
@@ -144,24 +75,24 @@ dest_repo=${cmd#*-}
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${cmd} [options]"
|
||||
echo ' -d <dest> Destination repository'
|
||||
echo ' -a Add package(s) to repository'
|
||||
echo ' -r Remove package(s) from repository'
|
||||
echo ' -l Use links db'
|
||||
echo ' -s Sign package(s)'
|
||||
echo ' -h This help'
|
||||
echo ''
|
||||
echo ''
|
||||
exit $1
|
||||
}
|
||||
|
||||
opts='arlsh'
|
||||
opts='arlhd:'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
a) add_pkg=true; del_pkg=false ;;
|
||||
r) del_pkg=true; add_pkg=false ;;
|
||||
d) dest_repo="$OPTARG" ;;
|
||||
a) add_pkg=true; rm_pkg=false ;;
|
||||
r) rm_pkg=true; add_pkg=false ;;
|
||||
l) linksdb=true ;;
|
||||
s) sign_pkg=true ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||
esac
|
||||
@@ -173,8 +104,13 @@ passfiles="$@"
|
||||
|
||||
prepare_dir "${REPOS_ROOT}"
|
||||
|
||||
repo_path=${REPOS_ROOT}/${dest_repo}/os/${ARCH}
|
||||
|
||||
if [[ -n ${passfiles[@]} ]]; then
|
||||
update_repo2 "${dest_repo}"
|
||||
else
|
||||
update_repo "${dest_repo}"
|
||||
if ${add_pkg}; then
|
||||
repo_action add
|
||||
fi
|
||||
if ${rm_pkg}; then
|
||||
repo_action remove
|
||||
fi
|
||||
fi
|
||||
|
@@ -377,11 +377,7 @@ if chroot-run \
|
||||
"$copydir" \
|
||||
/chrootbuild "${makepkg_args[@]}"
|
||||
then
|
||||
pkgnames=()
|
||||
for pkgfile in "$copydir"/pkgdest/*; do
|
||||
pkgfile=${pkgfile##*/};
|
||||
pkgnames+=("${pkgfile%-*-*-*}");
|
||||
done
|
||||
mapfile -t pkgnames < <(sudo -u "$makepkg_user" bash -c 'source PKGBUILD; printf "%s\n" "${pkgname[@]}"')
|
||||
move_products
|
||||
else
|
||||
(( ret += 1 ))
|
||||
@@ -398,27 +394,28 @@ if (( ret != 0 )); then
|
||||
else
|
||||
if (( run_checkpkg )); then
|
||||
msg "Running checkpkg"
|
||||
# sync off-site databases for up-to-date queries
|
||||
trap 'rm -rf $dbpath; cleanup' EXIT INT TERM QUIT
|
||||
dbpath=$(mktemp -d --tmpdir makechrootpkg-database.XXXXXXXXXX)
|
||||
mkdir -p "$dbpath"
|
||||
pacman -Sy --dbpath "$dbpath" --logfile /dev/null
|
||||
|
||||
# query current package locations
|
||||
remotepkgs=($(pacman -Sddp --dbpath "$dbpath" --logfile /dev/null "${pkgnames[@]}"))
|
||||
if (( $? )); then
|
||||
mapfile -t remotepkgs < <(pacman --config "$copydir"/etc/pacman.conf \
|
||||
--dbpath "$copydir"/var/lib/pacman \
|
||||
-Sddp "${pkgnames[@]}")
|
||||
|
||||
if ! wait $!; then
|
||||
warning "Skipped checkpkg due to missing repo packages"
|
||||
exit 0
|
||||
fi
|
||||
# download package files if any non-local location exists
|
||||
for remotepkg in "${remotepkgs[@]}"; do
|
||||
[[ $remotepkg == file://* ]] && continue
|
||||
msg2 "Downloading current versions"
|
||||
pacman --noconfirm -Swdd --dbpath "$dbpath" --logfile /dev/null "${pkgnames[@]}"
|
||||
break
|
||||
if [[ $remotepkg != file://* ]]; then
|
||||
msg2 "Downloading current versions"
|
||||
chroot-run "$copydir" pacman --noconfirm -Swdd "${pkgnames[@]}"
|
||||
mapfile -t remotepkgs < <(pacman --config "$copydir"/etc/pacman.conf \
|
||||
--dbpath "$copydir"/var/lib/pacman \
|
||||
-Sddp "${pkgnames[@]}")
|
||||
break
|
||||
fi
|
||||
done
|
||||
msg2 "Checking packages"
|
||||
sudo -u "$makepkg_user" checkpkg --rmdir --warn
|
||||
sudo -u "$makepkg_user" checkpkg --rmdir --warn "${remotepkgs[@]/#file:\/\//}"
|
||||
fi
|
||||
true
|
||||
fi
|
||||
|
46
bin/pkg/signpkg.in
Normal file
46
bin/pkg/signpkg.in
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2018-19 artoo@artixlinux.org
|
||||
# Copyright (C) 2018 Artix Linux Developers
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
. @libdir@/artools/util-pkg.sh
|
||||
|
||||
prepare_artools
|
||||
|
||||
load_makepkg_config
|
||||
|
||||
passfiles="$@"
|
||||
|
||||
sign_pkg(){
|
||||
local file_to_sign="$1"
|
||||
|
||||
if [ ! -e "$file_to_sign" ]; then
|
||||
error "%s does not exist!" "$file_to_sign"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "${BUILDBOT_GPGP}" ]]; then
|
||||
msg "Signing [%s]" "${file_to_sign##*/}"
|
||||
gpg --batch --passphrase "${BUILDBOT_GPGP}" --detach-sign "$file_to_sign"
|
||||
else
|
||||
msg2 "Signing [%s] with key %s" "${file_to_sign##*/}" "${GPGKEY}..."
|
||||
gpg --detach-sign --use-agent -u "${GPGKEY}" "$file_to_sign"
|
||||
fi
|
||||
}
|
||||
|
||||
for pkg in ${passfiles[@]}; do
|
||||
if pkgfile=$(find_cached_pkgfile "$pkg");then
|
||||
msg2 "Found: %s" "${pkgfile}"
|
||||
[[ -e "${pkgfile}".sig ]] && rm "${pkgfile}".sig
|
||||
sign_pkg "${pkgfile}"
|
||||
fi
|
||||
done
|
@@ -14,6 +14,8 @@
|
||||
# packages
|
||||
# community
|
||||
# packages-kernel
|
||||
# packages-net
|
||||
# packages-gfx
|
||||
# packages-openrc
|
||||
# packages-runit
|
||||
# packages-s6
|
||||
@@ -32,6 +34,7 @@
|
||||
# packages-mate
|
||||
# packages-kde
|
||||
# packages-xfce
|
||||
# packages-wm
|
||||
# )
|
||||
|
||||
# HOST_TREE_ARCH=git://git.archlinux.org/svntogit
|
||||
|
11
data/docker/package-cleanup.hook
Normal file
11
data/docker/package-cleanup.hook
Normal file
@@ -0,0 +1,11 @@
|
||||
[Trigger]
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Type = Package
|
||||
Target = *
|
||||
|
||||
[Action]
|
||||
Description = Cleaning up package cache...
|
||||
Depends = coreutils
|
||||
When = PostTransaction
|
||||
Exec = /usr/bin/find /var/cache/pacman/pkg/ -type f -delete
|
111
data/docker/pacman-docker.conf
Normal file
111
data/docker/pacman-docker.conf
Normal file
@@ -0,0 +1,111 @@
|
||||
#
|
||||
# /etc/pacman.conf
|
||||
#
|
||||
# See the pacman.conf(5) manpage for option and repository directives
|
||||
|
||||
#
|
||||
# GENERAL OPTIONS
|
||||
#
|
||||
[options]
|
||||
# The following paths are commented out with their default values listed.
|
||||
# If you wish to use different paths, uncomment and update the paths.
|
||||
#RootDir = /
|
||||
#DBPath = /var/lib/pacman/
|
||||
#CacheDir = /var/cache/pacman/pkg/
|
||||
#LogFile = /var/log/pacman.log
|
||||
#GPGDir = /etc/pacman.d/gnupg/
|
||||
#HookDir = /etc/pacman.d/hooks/
|
||||
HoldPkg = pacman glibc
|
||||
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#CleanMethod = KeepInstalled
|
||||
Architecture = auto
|
||||
|
||||
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||
#IgnorePkg =
|
||||
#IgnoreGroup =
|
||||
|
||||
#NoUpgrade =
|
||||
NoExtract = usr/share/help/* !usr/share/help/en*
|
||||
NoExtract = usr/share/gtk-doc/html/* usr/share/doc/*
|
||||
NoExtract = usr/share/locale/* usr/share/X11/locale/* usr/share/i18n/*
|
||||
NoExtract = !*locale*/en*/* !usr/share/i18n/charmaps/UTF-8.gz !usr/share/*locale*/locale.*
|
||||
NoExtract = !usr/share/*locales/en_?? !usr/share/*locales/i18n* !usr/share/*locales/iso*
|
||||
NoExtract = !usr/share/*locales/trans*
|
||||
NoExtract = usr/share/man/* usr/share/info/*
|
||||
NoExtract = usr/share/vim/vim*/lang/*
|
||||
|
||||
# Misc options
|
||||
#UseSyslog
|
||||
#Color
|
||||
#TotalDownload
|
||||
CheckSpace
|
||||
VerbosePkgLists
|
||||
|
||||
|
||||
# By default, pacman accepts packages signed by keys that its local keyring
|
||||
# trusts (see pacman-key and its man page), as well as unsigned packages.
|
||||
SigLevel = Required DatabaseOptional
|
||||
LocalFileSigLevel = Optional
|
||||
#RemoteFileSigLevel = Required
|
||||
|
||||
# NOTE: You must run `pacman-key --init` before first using pacman; the local
|
||||
# keyring can then be populated with the keys of all official Artix Linux
|
||||
# packagers with `pacman-key --populate archlinux artix`.
|
||||
|
||||
#
|
||||
# REPOSITORIES
|
||||
# - can be defined here or included from another file
|
||||
# - pacman will search repositories in the order defined here
|
||||
# - local/custom mirrors can be added here or in separate files
|
||||
# - repositories listed first will take precedence when packages
|
||||
# have identical names, regardless of version number
|
||||
# - URLs will have $repo replaced by the name of the current repo
|
||||
# - URLs will have $arch replaced by the name of the architecture
|
||||
#
|
||||
# Repository entries are of the format:
|
||||
# [repo-name]
|
||||
# Server = ServerName
|
||||
# Include = IncludePath
|
||||
#
|
||||
# The header [repo-name] is crucial - it must be present and
|
||||
# uncommented to enable the repo.
|
||||
#
|
||||
|
||||
# The gremlins repositories are disabled by default. To enable, uncomment the
|
||||
# repo name header and Include lines. You can add preferred servers immediately
|
||||
# after the header, and they will be used before the default mirrors.
|
||||
|
||||
[system]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
[world]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
[galaxy]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
# If you want to run 32 bit applications on your x86_64 system,
|
||||
# enable the lib32 repositories as required here.
|
||||
|
||||
#[lib32]
|
||||
#Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
# An example of a custom package repository. See the pacman manpage for
|
||||
# tips on creating your own repositories.
|
||||
#[custom]
|
||||
#SigLevel = Optional TrustAll
|
||||
#Server = file:///home/custompkgs
|
||||
|
||||
#
|
||||
# ARCHLINUX
|
||||
#
|
||||
|
||||
#[extra]
|
||||
#Include = /etc/pacman.d/mirrorlist-arch
|
||||
|
||||
#[community]
|
||||
#Include = /etc/pacman.d/mirrorlist-arch
|
||||
|
||||
#[multilib]
|
||||
#Include = /etc/pacman.d/mirrorlist-arch
|
@@ -36,7 +36,9 @@ add_svc_runit(){
|
||||
add_svc_s6(){
|
||||
local mnt="$1" names="$2" valid="" rlvl="${3:-default}"
|
||||
for svc in $names; do
|
||||
if [[ -d $mnt/etc/s6/sv/$svc ]]; then
|
||||
error=false
|
||||
chroot $mnt s6-rc-db -c /etc/s6/rc/compiled type $svc &> /dev/null || error=true
|
||||
if [ $? == 0 ] && [[ $error == false ]]; then
|
||||
msg2 "Setting %s ..." "$svc"
|
||||
valid=${valid:-}${valid:+' '}${svc}
|
||||
fi
|
||||
|
@@ -27,16 +27,6 @@ create_repo() {
|
||||
echo
|
||||
}
|
||||
|
||||
delete_repo() {
|
||||
local pkg="$1" org="$2"
|
||||
local gitname=$(get_compliant_name "$pkg")
|
||||
|
||||
msg2 "Delete package repo [%s] in org (%s)" "${pkg}" "${org}"
|
||||
|
||||
curl -s -X DELETE "${GIT_URL}/api/v1/repos/$org/$gitname?access_token=${GIT_TOKEN}" \
|
||||
-H "accept: application/json"
|
||||
}
|
||||
|
||||
get_team_id() {
|
||||
local org="$1" team="$2"
|
||||
local id=$(curl -s -X GET "${GIT_URL}/api/v1/orgs/$org/teams/search?q=$team&access_token=${GIT_TOKEN}" \
|
||||
@@ -44,13 +34,6 @@ get_team_id() {
|
||||
echo $id
|
||||
}
|
||||
|
||||
list_team_repos() {
|
||||
local id="$1"
|
||||
local result=$(curl -X GET "${GIT_URL}/api/v1/teams/$id/repos?access_token=${GIT_TOKEN}" \
|
||||
-H "accept: application/json" | jq '.[]' | jq -r '.name')
|
||||
echo ${result[@]}
|
||||
}
|
||||
|
||||
add_repo_to_team() {
|
||||
local pkg="$1" org="$2" team="$3"
|
||||
local id=$(get_team_id "$org" "$team")
|
||||
@@ -72,40 +55,3 @@ remove_repo_from_team() {
|
||||
curl -s -X DELETE "${GIT_URL}/api/v1/teams/$id/repos/$org/$gitname?access_token=${GIT_TOKEN}" \
|
||||
-H "accept: application/json"
|
||||
}
|
||||
|
||||
add_user_to_team() {
|
||||
local org="$1" team="$2" user="$3"
|
||||
local id=$(get_team_id "$org" "$team")
|
||||
|
||||
msg2 "Adding [%s] to team (%s) in org (%s)" "$user" "$team" "$org"
|
||||
|
||||
curl -X PUT "${GIT_URL}/api/v1/teams/$id/members/$user?access_token=${GIT_TOKEN}" \
|
||||
-H "accept: application/json"
|
||||
}
|
||||
|
||||
remove_user_from_team() {
|
||||
local org="$1" team="$2" user="$3"
|
||||
local id=$(get_team_id "$org" "$team")
|
||||
|
||||
msg2 "Removing [%s] from team (%s) in org (%s)" "$user" "$team" "$org"
|
||||
|
||||
curl -X DELETE "${GIT_URL}/api/v1/teams/$id/members/$user?access_token=${GIT_TOKEN}" \
|
||||
-H "accept: application/json"
|
||||
}
|
||||
|
||||
create_team() {
|
||||
local org="$1" name="$2"
|
||||
local json="{ \"can_create_org_repo\": true, \"description\": \"\", \"includes_all_repositories\": false, \"name\": \"$name\", \"permission\": \"write\", \"units\": [ \"repo.code\", \"repo.issues\", \"repo.ext_issues\", \"repo.wiki\", \"repo.pulls\", \"repo.releases\", \"repo.ext_wiki\" ]}"
|
||||
|
||||
curl -X POST "${GIT_URL}/api/v1/orgs/$org/teams?access_token=${GIT_TOKEN}" \
|
||||
-H "accept: application/json" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$json"
|
||||
}
|
||||
|
||||
delete_team() {
|
||||
local org="$1" team="$2"
|
||||
local id=$(get_team_id "$org" "$team")
|
||||
curl -X DELETE "${GIT_URL}/api/v1/teams/$id?access_token=${GIT_TOKEN}" \
|
||||
-H "accept: application/json"
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ subrepo_init() {
|
||||
subrepo_push(){
|
||||
local pkg="$1"
|
||||
msg2 "Subrepo push (%s)" "$pkg"
|
||||
git subrepo push "$pkg"
|
||||
git subrepo push "$pkg" || die "%s push failed" "$pkg"
|
||||
}
|
||||
|
||||
subrepo_clean(){
|
||||
|
142
lib/pkg/util.sh
142
lib/pkg/util.sh
@@ -14,86 +14,26 @@
|
||||
|
||||
shopt -s extglob
|
||||
|
||||
declare -A REPOS=(
|
||||
[core]=system
|
||||
[extra]=world
|
||||
[community]=galaxy
|
||||
[multilib]=lib32
|
||||
[testing]=gremlins
|
||||
[staging]=goblins
|
||||
[community-testing]=galaxy-gremlins
|
||||
[community-staging]=galaxy-goblins
|
||||
[multilib-testing]=lib32-gremlins
|
||||
[multilib-staging]=lib32-goblins
|
||||
[kde-unstable]=kde-wobble
|
||||
[gnome-unstable]=gnome-wobble
|
||||
)
|
||||
|
||||
get_compliant_name(){
|
||||
local gitname="$1"
|
||||
case $gitname in
|
||||
case "$gitname" in
|
||||
*+) gitname=${gitname//+/plus}
|
||||
esac
|
||||
echo $gitname
|
||||
echo "$gitname"
|
||||
}
|
||||
|
||||
get_group_packages(){
|
||||
local pkglist="${SYSCONFDIR}/pkglist.d/$1.list"
|
||||
set_arch_repos(){
|
||||
local x="$1" y="$2" z="$3"
|
||||
ARCH_REPOS=(core extra community multilib)
|
||||
|
||||
local _space="s| ||g" _clean=':a;N;$!ba;s/\n/ /g' _com_rm="s|#.*||g"
|
||||
|
||||
local pkgs=($(sed "$_com_rm" "$pkglist" | sed "$_space" | sed "$_clean"))
|
||||
|
||||
local cases=
|
||||
for p in ${pkgs[@]};do
|
||||
cases=${cases:-}${cases:+|}${p}
|
||||
done
|
||||
echo $cases
|
||||
}
|
||||
|
||||
get_group(){
|
||||
local pkg="$1" fallback="${2##*/}" tree=
|
||||
eval "case $pkg in
|
||||
$(get_group_packages kernel)) tree=packages-kernel ;;
|
||||
$(get_group_packages python)) tree=packages-python ;;
|
||||
$(get_group_packages perl)) tree=packages-perl ;;
|
||||
$(get_group_packages ruby)) tree=packages-ruby ;;
|
||||
$(get_group_packages openrc)) tree=packages-openrc ;;
|
||||
$(get_group_packages runit)) tree=packages-runit ;;
|
||||
$(get_group_packages s6)) tree=packages-s6 ;;
|
||||
$(get_group_packages media)) tree=packages-media ;;
|
||||
$(get_group_packages xorg)) tree=packages-xorg ;;
|
||||
$(get_group_packages qt5)) tree=packages-qt5 ;;
|
||||
$(get_group_packages gtk)) tree=packages-gtk ;;
|
||||
$(get_group_packages java)) tree=packages-java ;;
|
||||
$(get_group_packages haskell)) tree=packages-haskell ;;
|
||||
$(get_group_packages devel)) tree=packages-devel ;;
|
||||
$(get_group_packages lxqt)) tree=packages-lxqt ;;
|
||||
$(get_group_packages cinnamon)) tree=packages-cinnamon ;;
|
||||
$(get_group_packages kde)) tree=packages-kde ;;
|
||||
$(get_group_packages gnome)) tree=packages-gnome ;;
|
||||
$(get_group_packages mate)) tree=packages-mate ;;
|
||||
$(get_group_packages xfce)) tree=packages-xfce ;;
|
||||
*) tree=$fallback ;;
|
||||
esac"
|
||||
echo $tree
|
||||
}
|
||||
|
||||
arch_repos(){
|
||||
local testing="$1" staging="$2" unstable="$3"
|
||||
local repos=(core extra community multilib)
|
||||
|
||||
$testing && repos=(core extra testing community community-testing multilib multilib-testing)
|
||||
$staging && repos+=(staging community-staging multilib-staging)
|
||||
$unstable && repos+=(gnome-unstable kde-unstable)
|
||||
|
||||
echo ${repos[@]}
|
||||
$x && ARCH_REPOS+=(testing community-testing multilib-testing)
|
||||
$y && ARCH_REPOS+=(staging community-staging multilib-staging)
|
||||
$z && ARCH_REPOS+=(gnome-unstable kde-unstable)
|
||||
}
|
||||
|
||||
find_repo(){
|
||||
local pkg="$1" testing="$2" staging="$3" unstable="$4" repo=
|
||||
|
||||
for r in $(arch_repos "$testing" "$staging" "$unstable");do
|
||||
local pkg="$1" repo=
|
||||
for r in ${ARCH_REPOS[@]};do
|
||||
[[ -f $pkg/repos/$r-${ARCH}/PKGBUILD ]] && repo=$r-${ARCH}
|
||||
[[ -f $pkg/repos/$r-any/PKGBUILD ]] && repo=$r-any
|
||||
done
|
||||
@@ -102,67 +42,17 @@ find_repo(){
|
||||
|
||||
find_pkg(){
|
||||
local searchdir="$1" pkg="$2"
|
||||
local result=$(find $searchdir -mindepth 2 -maxdepth 2 -type d -name "$pkg")
|
||||
echo $result
|
||||
local result=$(find "$searchdir" -mindepth 2 -maxdepth 2 -type d -name "$pkg")
|
||||
echo "$result"
|
||||
}
|
||||
|
||||
is_valid_repo(){
|
||||
local src="$1" cases=
|
||||
for r in $(arch_repos true true true);do
|
||||
cases=${cases:-}${cases:+|}${r}
|
||||
done
|
||||
eval "case $src in
|
||||
${cases}|trunk) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac"
|
||||
}
|
||||
|
||||
pkgver_equal() {
|
||||
if [[ $1 = *-* && $2 = *-* ]]; then
|
||||
# if both versions have a pkgrel, then they must be an exact match
|
||||
[[ $1 = "$2" ]]
|
||||
else
|
||||
# otherwise, trim any pkgrel and compare the bare version.
|
||||
[[ ${1%%-*} = "${2%%-*}" ]]
|
||||
fi
|
||||
}
|
||||
|
||||
find_cached_package() {
|
||||
find_cached_pkgfile() {
|
||||
local searchdirs=("$PKGDEST" "$PWD") results=()
|
||||
local targetname=$1 targetver=$2 targetarch=$3
|
||||
local dir pkg pkgbasename name ver rel arch r results
|
||||
|
||||
local pkg="$1"
|
||||
for dir in "${searchdirs[@]}"; do
|
||||
[[ -d $dir ]] || continue
|
||||
|
||||
for pkg in "$dir"/*.pkg.tar?(.!(sig|*.*)); do
|
||||
[[ -f $pkg ]] || continue
|
||||
|
||||
# avoid adding duplicates of the same inode
|
||||
for r in "${results[@]}"; do
|
||||
[[ $r -ef $pkg ]] && continue 2
|
||||
done
|
||||
|
||||
# split apart package filename into parts
|
||||
pkgbasename=${pkg##*/}
|
||||
pkgbasename=${pkgbasename%.pkg.tar*}
|
||||
|
||||
arch=${pkgbasename##*-}
|
||||
pkgbasename=${pkgbasename%-"$arch"}
|
||||
|
||||
rel=${pkgbasename##*-}
|
||||
pkgbasename=${pkgbasename%-"$rel"}
|
||||
|
||||
ver=${pkgbasename##*-}
|
||||
name=${pkgbasename%-"$ver"}
|
||||
|
||||
if [[ $targetname = "$name" && $targetarch = "$arch" ]] &&
|
||||
pkgver_equal "$targetver" "$ver-$rel"; then
|
||||
results+=("$pkg")
|
||||
fi
|
||||
done
|
||||
[[ -d "$dir" ]] || continue
|
||||
[[ -e "$dir/$pkg" ]] && results+=("$dir/$pkg")
|
||||
done
|
||||
|
||||
case ${#results[*]} in
|
||||
0)
|
||||
return 1
|
||||
|
@@ -41,6 +41,8 @@ load_pkg_config(){
|
||||
packages
|
||||
community
|
||||
packages-kernel
|
||||
packages-net
|
||||
packages-gfx
|
||||
packages-openrc
|
||||
packages-runit
|
||||
packages-s6
|
||||
@@ -58,6 +60,7 @@ load_pkg_config(){
|
||||
packages-mate
|
||||
packages-kde
|
||||
packages-xfce
|
||||
packages-wm
|
||||
# packages-haskell
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user