Compare commits

...

13 Commits

21 changed files with 791 additions and 436 deletions

View File

@@ -1,6 +1,6 @@
VERSION=0.10 VERSION=0.11
CHROOT_VERSION=0.8 CHROOT_VERSION=0.9
TOOLS = artools TOOLS = artools
PREFIX ?= /usr/local PREFIX ?= /usr/local
@@ -40,7 +40,9 @@ BIN_PKG = \
bin/buildpkg \ bin/buildpkg \
bin/buildtree \ bin/buildtree \
bin/deploypkg \ bin/deploypkg \
bin/commitpkg bin/commitpkg \
bin/comparepkg \
bin/pkg2yaml
LIBS_PKG = \ LIBS_PKG = \
$(wildcard lib/util-pkg*.sh) $(wildcard lib/util-pkg*.sh)
@@ -61,13 +63,43 @@ COMMITPKG_SYMS = \
community-stagingpkg \ community-stagingpkg \
multilibpkg \ multilibpkg \
multilib-testingpkg \ multilib-testingpkg \
multilib-stagingpkg multilib-stagingpkg \
kde-unstablepkg \
gnome-unstablepkg
BUILDPKG_SYMS = \
buildpkg-system \
buildpkg-world \
buildpkg-gremlins \
buildpkg-goblins \
buildpkg-galaxy \
buildpkg-galaxy-gremlins \
buildpkg-galaxy-goblins \
buildpkg-lib32 \
buildpkg-lib32-gremlins \
buildpkg-lib32-goblins \
buildpkg-kde-wobble \
buildpkg-gnome-wobble
DEPLOYPKG_SYMS = \
deploypkg-system \
deploypkg-world \
deploypkg-gremlins \
deploypkg-goblins \
deploypkg-galaxy \
deploypkg-galaxy-gremlins \
deploypkg-galaxy-goblins \
deploypkg-lib32 \
deploypkg-lib32-gremlins \
deploypkg-lib32-goblins \
deploypkg-kde-wobble \
deploypkg-gnome-wobble
BIN_ISO = \ BIN_ISO = \
bin/buildiso \ bin/buildiso \
bin/deployiso bin/deployiso
BIN_ISO_SYMS = \ BUILDISO_SYMS = \
buildiso-gremlins \ buildiso-gremlins \
buildiso-goblins buildiso-goblins
@@ -125,6 +157,8 @@ install_pkg:
$(LN) find-libdeps $(DESTDIR)$(BINDIR)/find-libprovides $(LN) find-libdeps $(DESTDIR)$(BINDIR)/find-libprovides
for l in $(COMMITPKG_SYMS); do $(LN) commitpkg $(DESTDIR)$(BINDIR)/$$l; done for l in $(COMMITPKG_SYMS); do $(LN) commitpkg $(DESTDIR)$(BINDIR)/$$l; done
for l in $(BUILDPKG_SYMS); do $(LN) buildpkg $(DESTDIR)$(BINDIR)/$$l; done
for l in $(DEPLOYPKG_SYMS); do $(LN) deploypkg $(DESTDIR)$(BINDIR)/$$l; done
install $(DIRMODE) $(DESTDIR)$(LIBDIR)/$(TOOLS) install $(DIRMODE) $(DESTDIR)$(LIBDIR)/$(TOOLS)
install $(FILEMODE) $(LIBS_PKG) $(DESTDIR)$(LIBDIR)/$(TOOLS) install $(FILEMODE) $(LIBS_PKG) $(DESTDIR)$(LIBDIR)/$(TOOLS)
@@ -141,7 +175,7 @@ install_iso: install_cpio
install $(DIRMODE) $(DESTDIR)$(BINDIR) install $(DIRMODE) $(DESTDIR)$(BINDIR)
install $(MODE) $(BIN_ISO) $(DESTDIR)$(BINDIR) install $(MODE) $(BIN_ISO) $(DESTDIR)$(BINDIR)
for l in $(BIN_ISO_SYMS); do $(LN) buildiso $(DESTDIR)$(BINDIR)/$$l; done for l in $(BUILDISO_SYMS); do $(LN) buildiso $(DESTDIR)$(BINDIR)/$$l; done
install $(DIRMODE) $(DESTDIR)$(LIBDIR)/$(TOOLS) install $(DIRMODE) $(DESTDIR)$(LIBDIR)/$(TOOLS)
install $(FILEMODE) $(LIBS_ISO) $(DESTDIR)$(LIBDIR)/$(TOOLS) install $(FILEMODE) $(LIBS_ISO) $(DESTDIR)$(LIBDIR)/$(TOOLS)

View File

@@ -50,29 +50,15 @@ select_os(){
fi fi
} }
display_settings(){
show_version
show_config
msg "ARGS:"
msg2 "automount: %s" "${automount}"
msg2 "run_args: %s" "${run_args[*]}"
msg "PATHS:"
msg2 "chrootdir: %s" "${chrootdir}"
}
load_user_info load_user_info
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf" load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
automount=false automount=false
pretend=false
usage() { usage() {
echo "usage: ${0##*/} -a [or] ${0##*/} chroot-dir [command]" echo "usage: ${0##*/} -a [or] ${0##*/} chroot-dir [command]"
echo ' -a Automount detected linux system' echo ' -a Automount detected linux system'
echo ' -q Query settings and pretend'
echo ' -h Print this help message' echo ' -h Print this help message'
echo '' echo ''
echo " If 'command' is unspecified, ${0##*/} will launch /bin/sh." echo " If 'command' is unspecified, ${0##*/} will launch /bin/sh."
@@ -86,12 +72,11 @@ usage() {
orig_argv=("$0" "$@") orig_argv=("$0" "$@")
opts=':haq' opts=':ha'
while getopts ${opts} arg; do while getopts ${opts} arg; do
case "${arg}" in case "${arg}" in
a) automount=true ;; a) automount=true ;;
q) pretend=true ;;
h|?) usage 0 ;; h|?) usage 0 ;;
*) echo "invalid argument ${arg}"; usage 1 ;; *) echo "invalid argument ${arg}"; usage 1 ;;
esac esac
@@ -104,8 +89,6 @@ if ${automount};then
chrootdir=/mnt chrootdir=/mnt
run_args=/bin/bash run_args=/bin/bash
${pretend} && display_settings && exit 1
select_os "${chrootdir}" select_os "${chrootdir}"
else else
chrootdir=$1 chrootdir=$1
@@ -114,8 +97,6 @@ else
[[ -d ${chrootdir} ]] || die "Can't create chroot on non-directory %s" "${chrootdir}" [[ -d ${chrootdir} ]] || die "Can't create chroot on non-directory %s" "${chrootdir}"
${pretend} && display_settings && exit 1
chroot_api_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}" chroot_api_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}"
chroot_add_resolv_conf "${chrootdir}" chroot_add_resolv_conf "${chrootdir}"
fi fi

View File

@@ -35,9 +35,6 @@ create_min_fs(){
mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/pacman,log} $1/{dev,etc} mkdir -m 0755 -p $1/var/{cache/pacman/pkg,lib/pacman,log} $1/{dev,etc}
mkdir -m 1777 -p $1/{tmp,run} mkdir -m 1777 -p $1/{tmp,run}
mkdir -m 0555 -p $1/{sys,proc} mkdir -m 0555 -p $1/{sys,proc}
# if [[ ! -f $1/etc/machine-id ]];then
# touch $1/etc/machine-id
# fi
} }
newroot=/mnt newroot=/mnt

View File

@@ -49,34 +49,11 @@ prepare_build(){
prepare_dir "${iso_root}" prepare_dir "${iso_root}"
} }
show_profile(){
msg2 "iso_file: %s" "${iso_file}"
if ${verbose};then
msg2 "AUTOLOGIN: %s" "${AUTOLOGIN}"
msg2 "HOST_NAME: %s" "${HOST_NAME}"
msg2 "USER_NAME: %s" "${USER_NAME}"
msg2 "PASSWORD: %s" "${PASSWORD}"
msg2 "ADDGROUPS: %s" "${ADDGROUPS}"
msg2 "SERVICES_LIVE: %s" "${SERVICES_LIVE[*]}"
msg2 "SERVICES: %s" "${SERVICES[*]}"
fi
}
display_settings(){ display_settings(){
show_version
show_config
msg "OPTIONS:" msg "OPTIONS:"
msg2 "PROFILE: %s" "${PROFILE}" msg2 "PROFILE: %s" "${PROFILE}"
msg2 "INITSYS: %s" "${INITSYS}" msg2 "INITSYS: %s" "${INITSYS}"
[[ -n ${GPG_KEY} ]] && msg2 "GPG_KEY: %s" "${GPG_KEY}" [[ -n ${GPG_KEY} ]] && msg2 "GPG_KEY: %s" "${GPG_KEY}"
msg2 "REPOSITORY: %s" "${REPOSITORY}"
msg "ARGS:"
msg2 "clean_first: %s" "${clean_first}"
msg2 "images_only: %s" "${images_only}"
msg2 "iso_only: %s" "${iso_only}"
msg2 "persist: %s" "${persist}"
msg "ISO SETTINGS:" msg "ISO SETTINGS:"
msg2 "ISO_VERSION: %s" "${ISO_VERSION}" msg2 "ISO_VERSION: %s" "${ISO_VERSION}"
@@ -104,13 +81,13 @@ build(){
fi fi
if ${iso_only}; then if ${iso_only}; then
[[ ! -d ${work_dir} ]] && die "Create images: buildiso -p %s -x" "${PROFILE}" [[ ! -d ${work_dir} ]] && die "Create images: %s -p %s -x" "${cmd}" "${PROFILE}"
compress_images compress_images
exit 1 exit 1
fi fi
if ${images_only}; then if ${images_only}; then
prepare_images prepare_images
warning "Continue compress: buildiso -p %s -zc ..." "${PROFILE}" warning "Continue compress: %s -p %s -zc ..." "${cmd}" "${PROFILE}"
exit 1 exit 1
else else
prepare_images prepare_images
@@ -128,7 +105,7 @@ clean_first=true
pretend=false pretend=false
images_only=false images_only=false
iso_only=false iso_only=false
verbose=false log=false
persist=false persist=false
mkchroot_args=() mkchroot_args=()
@@ -137,7 +114,7 @@ cmd=${0##*/}
REPOSITORY=${cmd##*-} REPOSITORY=${cmd##*-}
usage() { usage() {
echo "Usage: ${0##*/} [options]" echo "Usage: ${cmd} [options]"
echo " -p <profile> Profile [default: ${PROFILE}]" echo " -p <profile> Profile [default: ${PROFILE}]"
echo ' -r <dir> Chroots directory' echo ' -r <dir> Chroots directory'
echo " [default: ${CHROOTS_ISO}]" echo " [default: ${CHROOTS_ISO}]"
@@ -152,7 +129,7 @@ usage() {
echo ' -x Build images only' echo ' -x Build images only'
echo ' -z Generate iso only' echo ' -z Generate iso only'
echo ' Requires pre built images (-x)' echo ' Requires pre built images (-x)'
echo ' -v Verbose output to log file, show profile detail (-q)' echo ' -l Log to file'
echo ' -q Query settings and pretend build' echo ' -q Query settings and pretend build'
echo ' -h This help' echo ' -h This help'
echo '' echo ''
@@ -162,7 +139,7 @@ usage() {
orig_argv=("$0" "$@") orig_argv=("$0" "$@")
opts='p:r:t:i:g:czxmvqh' opts='p:r:t:i:g:czxmlqh'
while getopts "${opts}" arg; do while getopts "${opts}" arg; do
case "${arg}" in case "${arg}" in
@@ -175,7 +152,7 @@ while getopts "${opts}" arg; do
x) images_only=true ;; x) images_only=true ;;
z) iso_only=true ;; z) iso_only=true ;;
m) persist=true ;; m) persist=true ;;
v) verbose=true ;; l) log=true ;;
q) pretend=true ;; q) pretend=true ;;
h|?) usage 0 ;; h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;; *) echo "invalid argument '${arg}'"; usage 1 ;;

View File

@@ -11,122 +11,70 @@
VERSION=@version@ VERSION=@version@
shopt -s nullglob
LIBDIR='@libdir@' LIBDIR='@libdir@'
DATADIR='@datadir@'
SYSCONFDIR='@sysconfdir@' SYSCONFDIR='@sysconfdir@'
DATADIR='@datadir@'
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh [[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util.sh import ${LIBDIR}/util.sh
import ${LIBDIR}/util-chroot.sh import ${LIBDIR}/util-chroot.sh
show_pkg(){
source PKGBUILD
for n in ${pkgname[@]}; do
msg2 "%s" "$n"
done
}
display_settings(){
show_version
show_config
msg "OPTIONS:"
msg2 "CHROOTS_PKG: %s" "${CHROOTS_PKG}"
msg2 "REPOSITORY: %s" "${REPOSITORY}"
msg "ARGS:"
msg2 "create_first: %s" "${create_first}"
msg2 "makepkg_args: %s" "${makepkg_args[*]}"
msg2 "mkchrootpkg_args: %s" "${mkchrootpkg_args[*]}"
msg "BUILD:"
show_pkg
}
load_user_info load_user_info
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf" load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
create_first=false create_first=false
pretend=false
mkchroot_args=()
mkchrootpkg_args=(-c -n) mkchrootpkg_args=(-c -n)
REPOSITORY='default' cmd=${0##*/}
repo=${cmd#*-}
prepare_build(){
local pac_file= mp_file='makepkg.conf'
base_devel=('base-devel') base_devel=('base-devel')
case ${REPOSITORY} in case ${repo} in
'system'|'world'|'galaxy') REPOSITORY='default' ;; system|world|galaxy) repo='default' ;;
lib32*) base_devel+=('multilib-devel') ;; lib32*) base_devel+=('multilib-devel') ;;
galaxy-gremlins|galaxy-goblins) REPOSITORY=${REPOSITORY#*-} ;; galaxy-gremlins|galaxy-goblins) repo=${repo#*-} ;;
esac esac
local pac_file="pacman-${REPOSITORY}.conf"
local pacman_conf="${DATADIR}/$pac_file" pacman_conf="${DATADIR}/pacman-${repo}.conf"
[[ -f $AT_USERCONFDIR/$pac_file ]] && pacman_conf="$AT_USERCONFDIR/$pac_file" [[ -f $AT_USERCONFDIR/pacman-${repo}.conf ]] && pacman_conf="$AT_USERCONFDIR/pacman-${repo}.conf"
work_dir="${CHROOTS_PKG}/${REPOSITORY}-${ARCH}" makepkg_conf="${DATADIR}/makepkg.conf"
[[ -f $AT_USERCONFDIR/makepkg.conf ]] && makepkg_conf="$AT_USERCONFDIR/makepkg.conf"
local makepkg_conf="${DATADIR}/$mp_file"
[[ -f $AT_USERCONFDIR/$mp_file ]] && makepkg_conf="$AT_USERCONFDIR/$mp_file"
mkchroot_args+=(-C "${pacman_conf}" -M "${makepkg_conf}" "${work_dir}/root")
mkchrootpkg_args+=(-r "${work_dir}" "${makepkg_args[@]}")
}
build(){
local timer_start=$(get_timer)
exec mkchrootpkg "${mkchrootpkg_args[@]}"
show_elapsed_time "${FUNCNAME}" "${timer_start}"
}
usage() { usage() {
echo "Usage: ${0##*/} [options] -- [makepkg_args]" echo "Usage: ${0##*/} [options] -- [mkchrootpkg_args]"
echo " -r <dir> Repository [default: ${REPOSITORY}]" echo " -r <dir> Create chroots in this directory"
echo ' -c Create root chroot' echo ' -c Recreate the chroot before building'
echo ' -q Query settings and pretend build'
echo ' -h This help' echo ' -h This help'
echo '' echo ''
echo "Default makepkg_args args: ${makepkg_args[*]}" echo "Default mkchrootpkg_args args: ${mkchrootpkg_args[*]}"
echo '' echo ''
exit $1 exit $1
} }
orig_argv=("$0" "$@") orig_argv=("$0" "$@")
opts='r:cqh' opts='hcr:'
while getopts "${opts}" arg; do while getopts "${opts}" arg; do
case "${arg}" in case "${arg}" in
r) REPOSITORY="$OPTARG" ;; r) CHROOTS_PKG="$OPTARG" ;;
c) create_first=true ;; c) create_first=true ;;
q) pretend=true ;;
h|?) usage 0 ;; h|?) usage 0 ;;
*) echo "invalid argument '%s'" "${arg}"; usage 1 ;; *) echo "invalid argument '%s'" "${arg}"; usage 1 ;;
esac esac
done done
makepkg_args+=("${@:$OPTIND}") check_root SOURCE_DATE_EPOCH
check_root mkchrootpkg_args+=("${@:$OPTIND}")
prepare_build if ${create_first} || [[ ! -d "${CHROOTS_PKG}/${repo}-${ARCH}" ]];then
msg "Creating chroot for [%s] (%s)..." "${repo}" "${ARCH}"
${pretend} && display_settings && exit for copy in "${CHROOTS_PKG}/${repo}-${ARCH}"/*; do
if ${create_first} || [[ ! -d ${work_dir}/root ]];then
msg "Creating chroot for [%s] (%s)..." "${REPOSITORY}" "${ARCH}"
for copy in "${work_dir}"/*; do
[[ -d $copy ]] || continue [[ -d $copy ]] || continue
msg2 "Deleting chroot copy '%s'..." "$(basename "${copy}")" msg2 "Deleting chroot copy '%s'..." "$(basename "${copy}")"
@@ -137,14 +85,30 @@ if ${create_first} || [[ ! -d ${work_dir}/root ]];then
done done
lock_close 9 lock_close 9
rm -rf --one-file-system "${work_dir}" rm -rf --one-file-system "${CHROOTS_PKG}/${repo}-${ARCH}"
mkdir -p "${work_dir}" mkdir -p "${CHROOTS_PKG}/${repo}-${ARCH}"
setarch "${ARCH}" mkchroot \ setarch "${ARCH}" mkchroot \
"${mkchroot_args[@]}" "${base_devel[@]}" || abort -C "${pacman_conf}" \
-M "${makepkg_conf}" \
"${CHROOTS_PKG}/${repo}-${ARCH}/root" \
"${base_devel[@]}" || abort
else else
lock 9 "${work_dir}/root.lock" "Locking clean chroot" lock 9 "${CHROOTS_PKG}/${repo}-${ARCH}/root.lock" "Locking clean chroot"
chroot-run "${mkchroot_args[@]}" \ chroot-run \
-C "${pacman_conf}" \
-M "${makepkg_conf}" \
"${CHROOTS_PKG}/${repo}-${ARCH}/root" \
pacman -Syu --noconfirm || abort pacman -Syu --noconfirm || abort
fi fi
build # Always build official packages reproducibly
if [[ ! -v SOURCE_DATE_EPOCH ]]; then
export SOURCE_DATE_EPOCH=$(date +%s)
fi
timer_start=$(get_timer)
msg "Building in chroot for [%s] (%s)..." "${repo}" "${ARCH}"
exec mkchrootpkg -r "${CHROOTS_PKG}/${repo}-${ARCH}" "${mkchrootpkg_args[@]}"
show_elapsed_time "${FUNCNAME}" "${timer_start}"

View File

@@ -66,74 +66,23 @@ pull_tree_artix(){
done done
} }
show_version_table(){ mkrepo(){
msg_table_header "%-20s %-20s %-25s %-30s %-30s" "Arch Repo" "Artix Repo" "Package" "Arch version" "Artix version" local pkg="$1" team="$2"
local pkg_path=${TREE_DIR_ARTIX}/$team/$pkg
for tree in ${tree_names[@]};do cd ${TREE_DIR_ARTIX}/$team
local git=$(find ${TREE_DIR_ARTIX}/$tree/ -mindepth 1 -maxdepth 1 -type d) local org=$(get_pkg_org "$pkg")
for package in ${git[@]}; do create_repo "$pkg" "$org"
local pkg=${package##*/} add_repo_to_team "$pkg" "$org" "$team"
local artixrepo=$(find_repo "$package" "${unstable}" "${staging}")
local artixshow=${artixrepo%-*}
local pkgbuild=$package/repos/$artixrepo/PKGBUILD
if [[ -f $pkgbuild ]];then subrepo_clone "$pkg" "$org"
source $pkgbuild 2>/dev/null prepare_dir "$pkg_path/trunk"
local artixver=$(get_full_version $pkg)
local archpath=${TREE_DIR_ARCH}/$tree/$pkg commit_jenkins_files "$pkg"
local archrepo=$(find_repo "$archpath" "${unstable}" "${staging}")
local archshow=${archrepo%-*}
pkgbuild=$archpath/repos/$archrepo/PKGBUILD
if [[ -f $pkgbuild ]];then
source $pkgbuild 2>/dev/null
local archver=$(get_full_version $pkg)
fi
if ${artix};then
if [ $(vercmp "$artixver" "$archver") -eq 0 ] || [ $(vercmp "$artixver" "$archver") -gt 0 ];then
case $artixrepo in
*staging*)
if [[ "$archrepo" == "$artixrepo" ]];then
msg_row "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
else
msg_row_notify "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
fi
;;
*testing*)
if [[ "$archrepo" == "$artixrepo" ]];then
msg_row "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
else
msg_row_notify "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
fi
;;
esac
fi
else
if [ $(vercmp "$artixver" "$archver") -lt 0 ];then
${upgrades} && msg_row_upgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
fi
if [ $(vercmp "$artixver" "$archver") -gt 0 ];then
if [[ -n $archver ]] && [[ -n $archrepo ]];then
${downgrades} && msg_row_downgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
fi
fi
fi
unset pkgver epoch pkgrel artixver archver
fi
done
done
} }
sync_pkg(){ sync_pkg(){
@@ -207,10 +156,9 @@ from_arch(){
subrepo_clone "$pkg" "$org" subrepo_clone "$pkg" "$org"
cd $pkg_path commit_jenkins_files "$pkg"
commit_jenkins_files
dest=$pkg_path/trunk # dest=$pkg_path/trunk
sync_pkg "$src" "$dest" "$git_tree_arch" sync_pkg "$src" "$dest" "$git_tree_arch"
fi fi
@@ -234,66 +182,37 @@ sync_repos(){
pull_tree_artix pull_tree_artix
} }
display_settings(){
show_version
show_config
msg "OPTIONS:"
msg2 "PACKAGE: %s" "${PACKAGE}"
msg "ARGS:"
msg2 "sync: %s" "${sync}"
msg2 "sync_arch: %s" "${sync_arch}"
msg2 "compare: %s" "${compare}"
msg2 "upgrades: %s" "${upgrades}"
msg2 "downgrades: %s" "${downgrades}"
msg2 "artix: %s" "${artix}"
msg2 "staging: %s" "${staging}"
msg2 "unstable: %s" "${unstable}"
msg2 "import: %s" "${import}"
msg2 "view: %s" "${view}"
msg "PATHS:"
msg2 "TREE_DIR_ARTIX: %s" "${TREE_DIR_ARTIX}"
msg2 "TREE_DIR_ARCH: %s" "${TREE_DIR_ARCH}"
}
load_user_info load_user_info
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf" load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf" load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
load_vars /etc/makepkg.conf load_vars /etc/makepkg.conf
pretend=false
sync=false sync=false
sync_arch=true sync_arch=true
compare=false
unstable=false
staging=true
upgrades=false
downgrades=false
artix=false
import=false import=false
view=false view=false
createnew=false
conf=false
PACKAGE='' PACKAGE=''
tree_names=(packages community) tree_names=(packages community)
TEAM=${tree_names[0]}
SUBORG=''
usage() { usage() {
echo "Usage: ${0##*/} [options]" echo "Usage: ${0##*/} [options]"
echo ' -p <pkg> Package name' echo ' -p <pkg> Package name'
echo ' -t <team> Team name (only with -n)'
echo " [default: ${TEAM}]"
echo ' -o <org> Org of subrepo (only with -c)'
echo " -s Clone or pull repos" echo " -s Clone or pull repos"
echo " -z Don't clone or pull arch repos" echo " -z Don't clone or pull arch repos"
echo ' -c Compare packages'
echo ' -u Show upgrade packages'
echo ' -d Show downgrade packages'
echo ' -a Show testing packages'
echo " -y Don't inlcude staging packages"
echo ' -x Include unstable kde and gnome'
echo ' -i Import a package from arch repos' echo ' -i Import a package from arch repos'
echo " -w Don't write Jenkinsfile and agent.yaml on import" echo ' -m Make new remote subrepo and clone it'
echo ' -C Configure subrepo url'
echo ' -v View package depends' echo ' -v View package depends'
echo ' -q Query settings'
echo ' -h This help' echo ' -h This help'
echo '' echo ''
echo '' echo ''
@@ -302,22 +221,19 @@ usage() {
orig_argv=("$0" "$@") orig_argv=("$0" "$@")
opts='p:csudayizxvqh' opts='p:t:o:csinzvh'
while getopts "${opts}" arg; do while getopts "${opts}" arg; do
case "${arg}" in case "${arg}" in
p) PACKAGE="$OPTARG" ;; p) PACKAGE="$OPTARG" ;;
t) TEAM="$OPTARG" ;;
o) SUBORG="$OPTARG" ;;
s) sync=true ;; s) sync=true ;;
z) sync_arch=false ;; z) sync_arch=false ;;
c) compare=true ;;
u) upgrades=true ;;
d) downgrades=true ;;
a) artix=true ;;
y) staging=false ;;
i) import=true ;; i) import=true ;;
n) createnew=true ;;
v) view=true ;; v) view=true ;;
x) unstable=true ;; c) conf=true ;;
q) pretend=true ;;
h|?) usage 0 ;; h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;; *) echo "invalid argument '${arg}'"; usage 1 ;;
esac esac
@@ -328,12 +244,12 @@ shift $(($OPTIND - 1))
prepare_dir "${TREE_DIR_ARTIX}" prepare_dir "${TREE_DIR_ARTIX}"
prepare_dir "${TREE_DIR_ARCH}" prepare_dir "${TREE_DIR_ARCH}"
${pretend} && display_settings && exit 1
${sync} && sync_repos ${sync} && sync_repos
${view} && view_build "${PACKAGE}" ${view} && view_build "${PACKAGE}"
${compare} && show_version_table
${import} && from_arch "${PACKAGE}" ${import} && from_arch "${PACKAGE}"
${createnew} && mkrepo "${PACKAGE}" "${TEAM}"
${conf} && subrepo_config "${PACKAGE}" "${SUBORG}"

View File

@@ -61,14 +61,12 @@ commit_pkg(){
cd ${TREE_DIR_ARTIX}/${git_tree} cd ${TREE_DIR_ARTIX}/${git_tree}
if ${push};then if ${push};then
msg2 "Check (%s)" "${git_tree}" mainrepo_pull "${git_tree}"
git pull origin master
msg2 "Update (%s)" "${PACKAGE}"
subrepo_push "${PACKAGE}" subrepo_push "${PACKAGE}"
subrepo_clean "${PACKAGE}"
# sleep 1 # sleep 1
msg2 "Update (%s)" "${git_tree}" mainrepo_push "${git_tree}"
git push origin master
fi fi
git prune git prune
else else
@@ -114,14 +112,12 @@ symlink_commit_pkg(){
cd ${TREE_DIR_ARTIX}/${git_tree} cd ${TREE_DIR_ARTIX}/${git_tree}
if ${push};then if ${push};then
msg2 "Check (%s)" "${git_tree}" mainrepo_pull "${git_tree}"
git pull origin master
msg2 "Update (%s)" "${PACKAGE}"
subrepo_push "${PACKAGE}" subrepo_push "${PACKAGE}"
subrepo_clean "${PACKAGE}"
# sleep 1 # sleep 1
msg2 "Update (%s)" "${git_tree}" mainrepo_push "${git_tree}"
git push origin master
fi fi
git prune git prune
else else
@@ -129,20 +125,6 @@ symlink_commit_pkg(){
fi fi
} }
display_settings(){
show_version
show_config
msg "OPTIONS:"
msg2 "REPO_SRC: %s" "${REPO_SRC}"
msg2 "REPO_DEST: %s" "${REPO_DEST}"
msg2 "PACKAGE: %s" "${PACKAGE}"
msg "ARGS:"
msg2 "remove: %s" "${remove}"
msg2 "push: %s" "${push}"
}
load_user_info load_user_info
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf" load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
@@ -153,7 +135,6 @@ REPO_SRC='trunk'
PACKAGE='' PACKAGE=''
remove=false remove=false
push=false push=false
pretend=false
cmd=${0##*/} cmd=${0##*/}
REPO_DEST=${cmd%pkg} REPO_DEST=${cmd%pkg}
@@ -164,7 +145,6 @@ usage() {
echo ' -p <pkg> Package name' echo ' -p <pkg> Package name'
echo ' -r Delete from repo (commitpkg only)' echo ' -r Delete from repo (commitpkg only)'
echo ' -u Push' echo ' -u Push'
echo ' -q Query settings and pretend'
echo ' -h This help' echo ' -h This help'
echo '' echo ''
echo '' echo ''
@@ -173,7 +153,7 @@ usage() {
orig_argv=("$0" "$@") orig_argv=("$0" "$@")
opts='p:s:urqh' opts='p:s:urh'
while getopts "${opts}" arg; do while getopts "${opts}" arg; do
case "${arg}" in case "${arg}" in
@@ -181,7 +161,6 @@ while getopts "${opts}" arg; do
p) PACKAGE="$OPTARG" ;; p) PACKAGE="$OPTARG" ;;
r) remove=true ;; r) remove=true ;;
u) push=true ;; u) push=true ;;
q) pretend=true ;;
h|?) usage 0 ;; h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;; *) echo "invalid argument '${arg}'"; usage 1 ;;
esac esac
@@ -189,8 +168,6 @@ done
shift $(($OPTIND - 1)) shift $(($OPTIND - 1))
${pretend} && display_settings && exit 1
if $(is_valid_repo "${REPO_SRC}");then if $(is_valid_repo "${REPO_SRC}");then
if [[ "${cmd}" == 'commitpkg' ]];then if [[ "${cmd}" == 'commitpkg' ]];then
commit_pkg commit_pkg

138
bin/comparepkg.in Normal file
View File

@@ -0,0 +1,138 @@
#!/bin/bash
#
# 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.
VERSION=@version@
LIBDIR='@libdir@'
SYSCONFDIR='@sysconfdir@'
DATADIR='@datadir@'
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util.sh
import ${LIBDIR}/util-pkg.sh
show_version_table(){
msg_table_header "%-20s %-20s %-25s %-30s %-30s" "Arch Repo" "Artix Repo" "Package" "Arch version" "Artix version"
for tree in ${tree_names[@]};do
local git=$(find ${TREE_DIR_ARTIX}/$tree/ -mindepth 1 -maxdepth 1 -type d)
for package in ${git[@]}; do
local pkg=${package##*/}
local artixrepo=$(find_repo "$package" "${unstable}" "${staging}")
local artixshow=${artixrepo%-*}
local pkgbuild=$package/repos/$artixrepo/PKGBUILD
if [[ -f $pkgbuild ]];then
source $pkgbuild 2>/dev/null
local artixver=$(get_full_version $pkg)
local archpath=$(get_import_path "$pkg")
local archrepo=$(find_repo "$archpath" "${unstable}" "${staging}")
local archshow=${archrepo%-*}
pkgbuild=$archpath/repos/$archrepo/PKGBUILD
if [[ -f $pkgbuild ]];then
source $pkgbuild 2>/dev/null
local archver=$(get_full_version $pkg)
fi
if ${move};then
if [ $(vercmp "$artixver" "$archver") -eq 0 ] || [ $(vercmp "$artixver" "$archver") -gt 0 ];then
case $artixrepo in
*staging*)
if [[ "$archrepo" == "$artixrepo" ]];then
msg_row "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
else
msg_row_notify "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
fi
;;
*testing*)
if [[ "$archrepo" == "$artixrepo" ]];then
msg_row "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
else
msg_row_notify "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
fi
;;
esac
fi
else
if [ $(vercmp "$artixver" "$archver") -lt 0 ];then
${upgrades} && msg_row_upgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
fi
if [ $(vercmp "$artixver" "$archver") -gt 0 ];then
if [[ -n $archver ]] && [[ -n $archrepo ]];then
${downgrades} && msg_row_downgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
fi
fi
fi
unset pkgver epoch pkgrel artixver archver
fi
done
done
}
load_user_info
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
load_vars /etc/makepkg.conf
unstable=false
staging=true
upgrades=false
downgrades=false
move=false
tree_names=(packages community)
usage() {
echo "Usage: ${0##*/} [options]"
echo ' -c Compare packages'
echo ' -u Show upgrade packages'
echo ' -d Show downgrade packages'
echo ' -a Show testing packages'
echo " -y Don't inlcude staging packages"
echo ' -x Include unstable kde and gnome'
echo ' -h This help'
echo ''
echo ''
exit $1
}
orig_argv=("$0" "$@")
opts='udmyxh'
while getopts "${opts}" arg; do
case "${arg}" in
u) upgrades=true ;;
d) downgrades=true ;;
m) move=true ;;
y) staging=false ;;
x) unstable=true ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac
done
shift $(($OPTIND - 1))
show_version_table

View File

@@ -33,31 +33,10 @@ sync_dir(){
show_elapsed_time "${FUNCNAME}" "${timer_start}" show_elapsed_time "${FUNCNAME}" "${timer_start}"
} }
display_settings(){
show_version
show_config
msg "OPTIONS:"
msg2 "PROFILE: %s" "${PROFILE}"
msg2 "UPLIMIT: %s kB/s" "${UPLIMIT}"
msg "ARGS:"
msg2 "update: %s" "${update}"
msg2 "verbose: %s" "${verbose}"
msg "REMOTE:"
msg2 "ACCOUNT: %s" "${ACCOUNT}"
msg "UPLOAD:"
msg2 "SRC_DIR: ${SRC_DIR}"
msg2 "DEST_DIR: ${DEST_DIR}"
}
load_user_info load_user_info
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf" load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
pretend=false
update=false update=false
verbose=false verbose=false
@@ -68,7 +47,6 @@ usage() {
echo " -p Source folder to upload [default: ${PROFILE}]" echo " -p Source folder to upload [default: ${PROFILE}]"
echo " -l Limit bandwidth in kB/s [default:${UPLIMIT}]" echo " -l Limit bandwidth in kB/s [default:${UPLIMIT}]"
echo ' -u Update remote directory' echo ' -u Update remote directory'
echo ' -q Query settings and pretend upload'
echo ' -v Verbose output' echo ' -v Verbose output'
echo ' -h This help' echo ' -h This help'
echo '' echo ''
@@ -76,7 +54,7 @@ usage() {
exit $1 exit $1
} }
opts='p:l:uvqh' opts='p:l:uvh'
while getopts "${opts}" arg; do while getopts "${opts}" arg; do
case "${arg}" in case "${arg}" in
@@ -84,7 +62,6 @@ while getopts "${opts}" arg; do
l) UPLIMIT="$OPTARG" ;; l) UPLIMIT="$OPTARG" ;;
u) update=true; rsync_args+=(-u) ;; u) update=true; rsync_args+=(-u) ;;
v) verbose=true; rsync_args+=(-v --stats) ;; v) verbose=true; rsync_args+=(-v --stats) ;;
q) pretend=true; rsync_args+=(-n) ;;
h|?) usage 0 ;; h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;; *) echo "invalid argument '${arg}'"; usage 1 ;;
esac esac
@@ -98,6 +75,4 @@ rsync_args+=(--bwlimit=${UPLIMIT})
prepare_transfer prepare_transfer
${pretend} && display_settings #&& exit 1
sync_dir sync_dir

View File

@@ -13,6 +13,7 @@ VERSION=@version@
LIBDIR='@libdir@' LIBDIR='@libdir@'
SYSCONFDIR='@sysconfdir@' SYSCONFDIR='@sysconfdir@'
DATADIR='@datadir@'
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh [[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util.sh import ${LIBDIR}/util.sh
@@ -21,17 +22,19 @@ import ${LIBDIR}/util-pkg.sh
update_repo(){ update_repo(){
local repo="$1" pkgfile ver ext=db.tar.xz local repo="$1" pkgfile ver ext=db.tar.xz
local repo_path=${REPOS_ROOT}/$repo/os/${ARCH} packages=() local repo_path=${REPOS_ROOT}/$repo/os/${ARCH} packages=()
source PKGBUILD source PKGBUILD
for name in ${pkgname[@]};do for name in ${pkgname[@]};do
[[ $arch == any ]] && CARCH=any pkgarch=$(get_pkg_arch "$name")
ver=$(get_full_version "$name") ver=$(get_full_version "$name")
if pkgfile=$(find_cached_package "$name" "$ver" "$CARCH");then if pkgfile=$(find_cached_package "$name" "$ver" "$pkgarch");then
local pkg=${pkgfile##*/} local pkg=${pkgfile##*/}
info "Found: %s" "$pkg" info "Found: %s" "$pkg"
if ${add_pkg};then if ${add_pkg};then
local action='add' local action='add'
packages+=("$pkg") packages+=("$pkg")
checkpkg "${pkgfile}" # checkpkg "${pkgfile}" || return 2
if ${sign_pkg};then if ${sign_pkg};then
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig [[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
signfile ${pkgfile} signfile ${pkgfile}
@@ -50,55 +53,37 @@ update_repo(){
return 0 return 0
} }
display_settings(){
show_version
show_config
msg "OPTIONS:"
msg2 "REPOSITORY: %s" "${REPOSITORY}"
msg "ARGS:"
msg2 "add_pkg: %s" "${add_pkg}"
msg2 "del_pkg: %s" "${del_pkg}"
msg2 "sign_pkg: %s" "${sign_pkg}"
}
load_user_info load_user_info
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf" load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf" load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
load_vars /etc/makepkg.conf load_vars /etc/makepkg.conf
pretend=false
add_pkg=false add_pkg=false
del_pkg=false del_pkg=false
REPOSITORY=
sign_pkg=false sign_pkg=false
cmd=${0##*/}
dest_repo=${cmd#*-}
usage() { usage() {
echo "Usage: ${0##*/} [options]" echo "Usage: ${cmd} [options]"
echo " -d Destination repository [default:${REPOSITORY}]"
echo ' -a Add package(s) to repository' echo ' -a Add package(s) to repository'
echo ' -r Remove package(s) from repository' echo ' -r Remove package(s) from repository'
echo ' -s Sign package(s)' echo ' -s Sign package(s)'
echo ' -q Query settings and pretend upload'
echo ' -h This help' echo ' -h This help'
echo '' echo ''
echo '' echo ''
exit $1 exit $1
} }
orig_argv=("$0" "$@") opts='arsh'
opts='d:arsqh'
while getopts "${opts}" arg; do while getopts "${opts}" arg; do
case "${arg}" in case "${arg}" in
d) REPOSITORY="$OPTARG" ;;
a) add_pkg=true; del_pkg=false ;; a) add_pkg=true; del_pkg=false ;;
r) del_pkg=true; add_pkg=false ;; r) del_pkg=true; add_pkg=false ;;
s) sign_pkg=true ;; s) sign_pkg=true ;;
q) pretend=true ;;
h|?) usage 0 ;; h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;; *) echo "invalid argument '${arg}'"; usage 1 ;;
esac esac
@@ -108,6 +93,4 @@ shift $(($OPTIND - 1))
prepare_dir "${REPOS_ROOT}" prepare_dir "${REPOS_ROOT}"
${pretend} && display_settings && exit 1 update_repo "${dest_repo}"
update_repo "${REPOSITORY}"

View File

@@ -58,35 +58,39 @@ usage() {
exit 1 exit 1
} }
sync_chroot() { # {{{ functions
local chrootdir=$1
local copy=$2
local copydir=''
if [[ ${copy:0:1} = / ]]; then
copydir=$copy
else
copydir="$chrootdir/$copy"
fi
if [[ "$chrootdir/root" -ef "$copydir" ]]; then # Usage: sync_chroot $rootdir $copydir [$copy]
sync_chroot() {
local rootdir=$1
local copydir=$2
local copy=${3:-$2}
if [[ "$rootdir" -ef "$copydir" ]]; then
error 'Cannot sync copy with itself: %s' "$copydir" error 'Cannot sync copy with itself: %s' "$copydir"
return 1 return 1
fi fi
# Get a read lock on the root chroot to make # Get a read lock on the root chroot to make
# sure we don't clone a half-updated chroot # sure we don't clone a half-updated chroot
slock 8 "$chrootdir/root.lock" \ slock 8 "$rootdir.lock" \
"Locking clean chroot [%s]" "$chrootdir/root" "Locking clean chroot [%s]" "$rootdir"
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$chrootdir/root" "$copydir" stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$rootdir" "$copy"
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then if is_subvolume "$rootdir" && is_same_fs "$rootdir" "$(dirname -- "$copydir")" && ! mountpoint -q "$copydir"; then
if is_subvolume "$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 || else
# avoid change of filesystem in case of an umount failure
rm --recursive --force --one-file-system "$copydir" ||
die "Unable to delete %s" "$copydir"
fi
btrfs subvolume snapshot "$rootdir" "$copydir" >/dev/null ||
die "Unable to create subvolume %s" "$copydir" die "Unable to create subvolume %s" "$copydir"
else else
mkdir -p "$copydir" mkdir -p "$copydir"
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir" rsync -a --delete -q -W -x "$rootdir/" "$copydir"
fi fi
stat_done stat_done
@@ -103,7 +107,7 @@ delete_chroot() {
local copy=${1:-$2} local copy=${1:-$2}
stat_busy "Removing chroot copy [%s]" "$copy" stat_busy "Removing chroot copy [%s]" "$copy"
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then if is_subvolume "$copydir" && ! 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"
else else
@@ -128,7 +132,10 @@ install_packages() {
pkgnames=("${install_pkgs[@]##*/}") pkgnames=("${install_pkgs[@]##*/}")
cp -- "${install_pkgs[@]}" "$copydir/root/" cp -- "${install_pkgs[@]}" "$copydir/root/"
chroot-run -r "${bindmounts_ro[*]}" -w "${bindmounts_rw[*]}" "$copydir" \ chroot-run \
-r "${bindmounts_ro[@]}" \
-r "${bindmounts_rw[@]}" \
"$copydir" \
pacman -U --noconfirm -- "${pkgnames[@]/#//root/}" pacman -U --noconfirm -- "${pkgnames[@]/#//root/}"
ret=$? ret=$?
rm -- "${pkgnames[@]/#/$copydir/root/}" rm -- "${pkgnames[@]/#/$copydir/root/}"
@@ -148,8 +155,9 @@ prepare_chroot() {
[[ $keepbuilddir = true ]] || rm -rf "$copydir/build" [[ $keepbuilddir = true ]] || rm -rf "$copydir/build"
local builduser_uid="${SUDO_UID:-$UID}" local builduser_uid builduser_gid
local builduser_gid="$(id -g "$builduser_uid")" builduser_uid="${SUDO_UID:-$UID}"
builduser_gid="$(id -g "$builduser_uid")"
local install="install -o $builduser_uid -g $builduser_gid" local install="install -o $builduser_uid -g $builduser_gid"
local x local x
@@ -157,16 +165,11 @@ prepare_chroot() {
# which we might not be able to load (i.e. when building i686 packages on # which we might not be able to load (i.e. when building i686 packages on
# an x86_64 host). # an x86_64 host).
sed -e '/^builduser:/d' -i "$copydir"/etc/{passwd,shadow,group} sed -e '/^builduser:/d' -i "$copydir"/etc/{passwd,shadow,group}
printf >>"$copydir/etc/group" 'builduser:x:%d:\n' $builduser_gid printf >>"$copydir/etc/group" 'builduser:x:%d:\n' "$builduser_gid"
printf >>"$copydir/etc/passwd" 'builduser:x:%d:%d:builduser:/build:/bin/bash\n' $builduser_uid $builduser_gid printf >>"$copydir/etc/passwd" 'builduser:x:%d:%d:builduser:/build:/bin/bash\n' "$builduser_uid" "$builduser_gid"
printf >>"$copydir/etc/shadow" 'builduser:!!:%d::::::\n' "$(( $(date -u +%s) / 86400 ))" printf >>"$copydir/etc/shadow" 'builduser:!!:%d::::::\n' "$(( $(date -u +%s) / 86400 ))"
$install -d "$copydir"/{build,build/.gnupg,startdir,{pkg,srcpkg,src,log}dest} $install -d "$copydir"/{build,startdir,{pkg,srcpkg,src,log}dest}
# for x in .gnupg/pubring.{kbx,gpg}; do
# [[ -r $USER_HOME/$x ]] || continue
# $install -m 644 "$USER_HOME/$x" "$copydir/build/$x"
# done
sed -e '/^MAKEFLAGS=/d' -e '/^PACKAGER=/d' -i "$copydir/etc/makepkg.conf" sed -e '/^MAKEFLAGS=/d' -e '/^PACKAGER=/d' -i "$copydir/etc/makepkg.conf"
for x in BUILDDIR=/build PKGDEST=/pkgdest SRCPKGDEST=/srcpkgdest SRCDEST=/srcdest LOGDEST=/logdest \ for x in BUILDDIR=/build PKGDEST=/pkgdest SRCPKGDEST=/srcpkgdest SRCDEST=/srcdest LOGDEST=/logdest \
@@ -203,19 +206,22 @@ _chrootbuild() {
# No coredumps # No coredumps
ulimit -c 0 ulimit -c 0
# Work around chroot-run not giving a ctty . /etc/locale.conf
#exec </dev/console
# shellcheck source=/dev/null
. /etc/profile . /etc/profile
#export LANG=en_US.UTF-8 # Beware, there are some stupid arbitrary rules on how you can
# use "$" in arguments to commands with "sudo -i". ${foo} or
# ${1} is OK, but $foo or $1 isn't.
# https://bugzilla.sudo.ws/show_bug.cgi?id=765
sudo --preserve-env=SOURCE_DATE_EPOCH -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@" sudo --preserve-env=SOURCE_DATE_EPOCH -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
ret=$? ret=$?
case $ret in case $ret in
0|14) return 0;; 0|14)
*) return $ret;; return 0;;
*)
return $ret;;
esac esac
} }
@@ -227,17 +233,15 @@ _chrootnamcap() {
done done
} }
# Usage: download_sources $copydir $src_owner # Usage: download_sources $copydir $makepkg_user
# Globals: # Globals:
# - SRCDEST # - SRCDEST
# - USER
download_sources() { download_sources() {
local copydir=$1 local copydir=$1
local makepkg_user=$2 local makepkg_user=$2
local builddir local builddir
builddir="$(mktemp -d)" builddir="$(mktemp -d)"
# chmod 1777 "$builddir"
chown "$makepkg_user:" "$builddir" chown "$makepkg_user:" "$builddir"
# Ensure sources are downloaded # Ensure sources are downloaded
@@ -254,6 +258,7 @@ download_sources() {
# Globals: # Globals:
# - PKGDEST # - PKGDEST
# - LOGDEST # - LOGDEST
# - SRCPKGDEST
move_products() { move_products() {
local copydir=$1 local copydir=$1
local src_owner=$2 local src_owner=$2
@@ -301,8 +306,8 @@ main() {
chrootdir= chrootdir=
passeddir= passeddir=
makepkg_user= makepkg_user=
declare -ga install_pkgs declare -a install_pkgs
declare -gi ret=0 declare -i ret=0
bindmounts_ro=() bindmounts_ro=()
bindmounts_rw=() bindmounts_rw=()
@@ -314,7 +319,7 @@ main() {
local opts='hcur:I:l:nTD:d:U:' local opts='hcur:I:l:nTD:d:U:'
while getopts ${opts} arg; do while getopts "${opts}" arg; do
case "$arg" in case "$arg" in
c) clean_first=true ;; c) clean_first=true ;;
D) bindmounts_ro+=("$OPTARG") ;; D) bindmounts_ro+=("$OPTARG") ;;
@@ -364,7 +369,7 @@ main() {
umask 0022 umask 0022
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf" load_vars "${XDG_CONFIG_HOME:-$USER_HOME/.config}/pacman/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
load_vars /etc/makepkg.conf load_vars /etc/makepkg.conf
# Use PKGBUILD directory if these don't exist # Use PKGBUILD directory if these don't exist
@@ -377,10 +382,13 @@ main() {
lock 9 "$copydir.lock" "Locking chroot copy [%s]" "$copy" lock 9 "$copydir.lock" "Locking chroot copy [%s]" "$copy"
if [[ ! -d $copydir ]] || $clean_first; then if [[ ! -d $copydir ]] || $clean_first; then
sync_chroot "$chrootdir" "$copy" sync_chroot "$chrootdir/root" "$copydir" "$copy"
fi fi
$update_first && chroot-run -r "${bindmounts_ro[*]}" -w "${bindmounts_rw[*]}" "$copydir" \ $update_first && chroot-run \
-r "${bindmounts_ro[@]}" \
-w "${bindmounts_rw[@]}" \
"$copydir" \
pacman -Syu --noconfirm pacman -Syu --noconfirm
if [[ -n ${install_pkgs[*]:-} ]]; then if [[ -n ${install_pkgs[*]:-} ]]; then
@@ -395,14 +403,18 @@ main() {
exit 1 exit 1
fi fi
download_sources "$copydir" "$src_owner" download_sources "$copydir" "$makepkg_user"
prepare_chroot "$copydir" "$USER_HOME" "$keepbuilddir" "$run_namcap" prepare_chroot "$copydir" "$USER_HOME" "$keepbuilddir" "$run_namcap"
bindmounts_rw+=("${PWD}:/startdir" "${SRCDEST}:/srcdest") bindmounts_rw+=("${PWD}:/startdir" "${SRCDEST}:/srcdest")
if chroot-run -r "${bindmounts_ro[*]}" -w "${bindmounts_rw[*]}" "$copydir" \ if chroot-run \
/chrootbuild "${makepkg_args[@]}"; then -r "${bindmounts_ro[*]}" \
-w "${bindmounts_rw[*]}" \
"$copydir" \
/chrootbuild "${makepkg_args[@]}"
then
move_products "$copydir" "$src_owner" move_products "$copydir" "$src_owner"
else else
(( ret += 1 )) (( ret += 1 ))

44
bin/pkg2yaml.in Normal file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
#
# 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.
VERSION=@version@
VERSION=0.10.4.r2.gd0e3c4e
if [[ -f "$1"/PKGBUILD ]]; then
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
for lib in "$LIBRARY"/*.sh; do
source "$lib"
done
. /etc/makepkg.conf
. "$1"/PKGBUILD
pkgfile=$(print_all_package_names)
fi
NL=$'\n'
Yaml="%YAML 1.2"$NL
Yaml+="---"$NL
Yaml+="pkgfile:"$NL
for f in ${pkgfile[@]};do
Yaml+=" - ${f##*/}"$NL
done
Yaml+="pkgname:"$NL
for n in ${pkgname[@]};do
Yaml+=" - ${n##*/}"$NL
done
printf '%s' "${Yaml}"

View File

@@ -0,0 +1,146 @@
#
# /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 -C - -f %u > %o
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
#UseDelta = 0.7
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# 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.
[gnome-wobble]
Include = /etc/pacman.d/mirrorlist
[goblins]
Include = /etc/pacman.d/mirrorlist
[gremlins]
Include = /etc/pacman.d/mirrorlist
[system]
Include = /etc/pacman.d/mirrorlist
[world]
Include = /etc/pacman.d/mirrorlist
[galaxy-goblins]
Include = /etc/pacman.d/mirrorlist
[galaxy-gremlins]
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-goblins]
#Include = /etc/pacman.d/mirrorlist
#[lib32-gremlins]
#Include = /etc/pacman.d/mirrorlist
#[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
#
[gnome-unstable]
Include = /etc/pacman.d/mirrorlist-arch
[staging]
Include = /etc/pacman.d/mirrorlist-arch
[testing]
Include = /etc/pacman.d/mirrorlist-arch
[extra]
Include = /etc/pacman.d/mirrorlist-arch
[community-staging]
Include = /etc/pacman.d/mirrorlist-arch
[community-testing]
Include = /etc/pacman.d/mirrorlist-arch
[community]
Include = /etc/pacman.d/mirrorlist-arch
#[multilib-staging]
#Include = /etc/pacman.d/mirrorlist-arch
#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist-arch
#[multilib]
#Include = /etc/pacman.d/mirrorlist-arch

146
data/pacman-kde-wobble.conf Normal file
View File

@@ -0,0 +1,146 @@
#
# /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 -C - -f %u > %o
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
#UseDelta = 0.7
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# 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.
[kde-wobble]
Include = /etc/pacman.d/mirrorlist
[goblins]
Include = /etc/pacman.d/mirrorlist
[gremlins]
Include = /etc/pacman.d/mirrorlist
[system]
Include = /etc/pacman.d/mirrorlist
[world]
Include = /etc/pacman.d/mirrorlist
[galaxy-goblins]
Include = /etc/pacman.d/mirrorlist
[galaxy-gremlins]
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-goblins]
#Include = /etc/pacman.d/mirrorlist
#[lib32-gremlins]
#Include = /etc/pacman.d/mirrorlist
#[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
#
[kde-unstable]
Include = /etc/pacman.d/mirrorlist-arch
[staging]
Include = /etc/pacman.d/mirrorlist-arch
[testing]
Include = /etc/pacman.d/mirrorlist-arch
[extra]
Include = /etc/pacman.d/mirrorlist-arch
[community-staging]
Include = /etc/pacman.d/mirrorlist-arch
[community-testing]
Include = /etc/pacman.d/mirrorlist-arch
[community]
Include = /etc/pacman.d/mirrorlist-arch
#[multilib-staging]
#Include = /etc/pacman.d/mirrorlist-arch
#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist-arch
#[multilib]
#Include = /etc/pacman.d/mirrorlist-arch

View File

@@ -12,17 +12,28 @@ is_btrfs() {
[[ -e "$1" && "$(stat -f -c %T "$1")" == btrfs ]] [[ -e "$1" && "$(stat -f -c %T "$1")" == btrfs ]]
} }
is_subvolume() {
[[ -e "$1" && "$(stat -f -c %T "$1")" == btrfs && "$(stat -c %i "$1")" == 256 ]]
}
is_same_fs() {
[[ "$(stat -c %d "$1")" == "$(stat -c %d "$1")" ]]
}
subvolume_delete_recursive() { subvolume_delete_recursive() {
local subvol local subvol
is_btrfs "$1" || return 0 is_subvolume "$1" || return 0
while IFS= read -d $'\0' -r subvol; do while IFS= read -d $'\0' -r subvol; do
if ! btrfs subvolume delete "$subvol" &>/dev/null; then if ! subvolume_delete_recursive "$subvol"; then
return 1
fi
done < <(find "$1" -mindepth 1 -xdev -depth -inum 256 -print0)
if ! btrfs subvolume delete "$1" &>/dev/null; then
error "Unable to delete subvolume %s" "$subvol" error "Unable to delete subvolume %s" "$subvol"
return 1 return 1
fi fi
done < <(find "$1" -xdev -depth -inum 256 -print0)
return 0 return 0
} }

View File

@@ -26,6 +26,17 @@ init_profile(){
[[ -d "$profdir/$prof/live-overlay" ]] && LIVE_OVERLAY="$profdir/$prof/live-overlay" [[ -d "$profdir/$prof/live-overlay" ]] && LIVE_OVERLAY="$profdir/$prof/live-overlay"
} }
show_profile(){
msg2 "iso_file: %s" "${iso_file}"
msg2 "AUTOLOGIN: %s" "${AUTOLOGIN}"
msg2 "HOST_NAME: %s" "${HOST_NAME}"
msg2 "USER_NAME: %s" "${USER_NAME}"
msg2 "PASSWORD: %s" "${PASSWORD}"
msg2 "ADDGROUPS: %s" "${ADDGROUPS}"
msg2 "SERVICES_LIVE: %s" "${SERVICES_LIVE[*]}"
msg2 "SERVICES: %s" "${SERVICES[*]}"
}
load_profile(){ load_profile(){
local prof="$1" local prof="$1"
local profdir="${DATADIR}/iso-profiles" local profdir="${DATADIR}/iso-profiles"

View File

@@ -105,7 +105,7 @@ run_safe() {
restoretrap=$(trap -p ERR) restoretrap=$(trap -p ERR)
trap 'error_function $func' ERR trap 'error_function $func' ERR
if ${verbose};then if ${log};then
run_log "$func" run_log "$func"
else else
"$func" "$func"
@@ -316,7 +316,6 @@ make_sfs() {
msg2 "Creating ext4 image of %s ..." "${size}" msg2 "Creating ext4 image of %s ..." "${size}"
truncate -s ${size} "${src}.img" truncate -s ${size} "${src}.img"
local ext4_args=() local ext4_args=()
${verbose} && ext4_args+=(-q)
ext4_args+=(-O ^has_journal,^resize_inode -E lazy_itable_init=0 -m 0) ext4_args+=(-O ^has_journal,^resize_inode -E lazy_itable_init=0 -m 0)
mkfs.ext4 ${ext4_args[@]} -F "${src}.img" &>/dev/null mkfs.ext4 ${ext4_args[@]} -F "${src}.img" &>/dev/null
tune2fs -c 0 -i 0 "${src}.img" &> /dev/null tune2fs -c 0 -i 0 "${src}.img" &> /dev/null
@@ -340,11 +339,9 @@ make_sfs() {
local highcomp="-b 256K -Xbcj x86" comp='xz' local highcomp="-b 256K -Xbcj x86" comp='xz'
mksfs_args+=(-comp ${comp} ${highcomp}) mksfs_args+=(-comp ${comp} ${highcomp})
if ${verbose};then
mksquashfs "${mksfs_args[@]}" >/dev/null
else
mksquashfs "${mksfs_args[@]}" mksquashfs "${mksfs_args[@]}"
fi
make_checksum "${dest}" "${name}" make_checksum "${dest}" "${name}"
${persist} && rm "${src}.img" ${persist} && rm "${src}.img"

View File

@@ -34,6 +34,19 @@ delete_repo(){
-H "accept: application/json" -H "accept: application/json"
} }
get_pkg_org(){
local pkg="$1" org= sub=
case ${pkg} in
# ruby-*) org=${pkg:0:6}; sub="${org:5}"; echo "packagesRuby" ;;
perl-*) org=${pkg:0:6}; sub="${org:5}"; echo "packagesPerl" ;;
python-*) org=${pkg:0:8}; sub="${org:7}"; echo "packagesPython" ;;
python2-*) org=${pkg:0:9}; sub="${org:8}"; echo "packagesPython" ;;
lib32*) org=${pkg:0:7}; sub="${org:6}"; echo "packagesL" ;; #"packages${sub^^}" ;;
# lib*) org=${pkg:0:4}; sub="${org:3}"; echo "packagesLib${sub^^}" ;;
*) org=${pkg:0:1}; echo "packages${org^^}" ;;
esac
}
load_team_id(){ load_team_id(){
local org="$1" tree="$2" id=0 local org="$1" tree="$2" id=0

View File

@@ -11,7 +11,22 @@
subrepo_push(){ subrepo_push(){
local pkg="$1" local pkg="$1"
git subrepo push "$pkg" --clean msg2 "Update (%s)" "$pkg"
git subrepo push "$pkg"
}
subrepo_config(){
local pkg="$1" org="$2"
local gitname=$(get_compliant_name "$pkg")
local url=gitea@"${GIT_DOMAIN}":"$org"/"$gitname".git
msg2 "Update .gitrepo (%s) [%s]" "$pkg" "$url"
git subrepo config "$pkg" remote "$url"
}
subrepo_clean(){
local pkg="$1"
msg2 "Clean (%s)" "$pkg"
git subrepo clean "$pkg"
} }
subrepo_pull(){ subrepo_pull(){
@@ -26,28 +41,50 @@ subrepo_clone(){
git subrepo clone gitea@"${GIT_DOMAIN}":"$org"/"$gitname".git "$pkg" git subrepo clone gitea@"${GIT_DOMAIN}":"$org"/"$gitname".git "$pkg"
} }
mainrepo_pull(){
local tree="$1"
msg2 "Check (%s)" "${tree}"
git push origin master
}
mainrepo_push(){
local tree="$1"
msg2 "Update (%s)" "${tree}"
git push origin master
}
write_jenkinsfile(){ write_jenkinsfile(){
local jenkins=Jenkinsfile local pkg="$1"
echo '@Library(["PackagePipeline", "RepoPackage"]) import org.artixlinux.RepoPackage' > $jenkins local jenkins=$pkg/Jenkinsfile
echo "@Library('artix-ci') import org.artixlinux.RepoPackage" > $jenkins
echo '' >> $jenkins echo '' >> $jenkins
echo 'PackagePipeline(new RepoPackage(this))' >> $jenkins echo 'PackagePipeline(new RepoPackage(this))' >> $jenkins
echo '' >> $jenkins echo '' >> $jenkins
git add $jenkins
} }
write_agentyaml(){ write_agentyaml(){
local agent=.artixlinux/agent.yaml label='master' local pkg="$1"
[[ -d .artixlinux ]] || mkdir .artixlinux local agent=$pkg/.artixlinux/agent.yaml label='master'
[[ -d $pkg/.artixlinux ]] || mkdir $pkg/.artixlinux
echo '%YAML 1.2' > $agent echo '%YAML 1.2' > $agent
echo '---' >> $agent echo '---' >> $agent
echo '' >> $agent echo '' >> $agent
echo "label: $label" >> $agent echo "label: $label" >> $agent
echo '' >> $agent echo '' >> $agent
git add $agent
} }
commit_jenkins_files(){ commit_jenkins_files(){
write_jenkinsfile local pkg="$1"
write_agentyaml
git add Jenkinsfile write_jenkinsfile "$pkg"
git add .artixlinux write_agentyaml "$pkg"
git commit -m "add jenkinsfile & .artixlinux/agent.yaml" git commit -m "add jenkinsfile & .artixlinux/agent.yaml"
} }

View File

@@ -95,6 +95,14 @@ find_repo(){
echo $repo echo $repo
} }
get_import_path(){
local pkg="$1" import_path=
for tree in ${tree_names[@]};do
[[ -d ${TREE_DIR_ARCH}/$tree/$pkg ]] && import_path=${TREE_DIR_ARCH}/$tree/$pkg
done
echo $import_path
}
clone_tree(){ clone_tree(){
local timer=$(get_timer) host_tree="$1" local timer=$(get_timer) host_tree="$1"
git clone $host_tree.git git clone $host_tree.git
@@ -113,16 +121,14 @@ pull_tree(){
fi fi
} }
get_pkg_org(){ pkgver_equal() {
local pkg="$1" org= sub= if [[ $1 = *-* && $2 = *-* ]]; then
case ${pkg} in # if both versions have a pkgrel, then they must be an exact match
perl-*) org=${pkg:0:6}; sub="${org:5}"; echo "packagesPerl" ;; [[ $1 = "$2" ]]
python-*) org=${pkg:0:8}; sub="${org:7}"; echo "packagesPython" ;; else
python2-*) org=${pkg:0:9}; sub="${org:8}"; echo "packagesPython" ;; # otherwise, trim any pkgrel and compare the bare version.
lib32*) org=${pkg:0:7}; sub="${org:6}"; echo "packagesL" ;; #"packages${sub^^}" ;; [[ ${1%%-*} = "${2%%-*}" ]]
# lib*) org=${pkg:0:4}; sub="${org:3}"; echo "packagesLib${sub^^}" ;; fi
*) org=${pkg:0:1}; echo "packages${org^^}" ;;
esac
} }
find_cached_package() { find_cached_package() {

View File

@@ -155,23 +155,13 @@ load_user_info(){
prepare_dir "${AT_USERCONFDIR}" prepare_dir "${AT_USERCONFDIR}"
} }
show_version(){ # orig_argv=("$0" "$@")
msg "ARTOOLS"
msg2 "VERSION: %s" "${VERSION}"
}
show_config(){
if [[ -f ${AT_USERCONFDIR}/artools.conf ]]; then
msg2 "config: %s" "~/.config/artools/artools.conf"
else
msg2 "config: %s" "${ARTOOLS_CONF}"
fi
}
check_root() { check_root() {
local keepenv=$1
(( EUID == 0 )) && return (( EUID == 0 )) && return
if type -P sudo >/dev/null; then if type -P sudo >/dev/null; then
exec sudo -- "${orig_argv[@]}" exec sudo --preserve-env=$keepenv -- "${orig_argv[@]}"
else else
exec su root -c "$(printf ' %q' "${orig_argv[@]}")" exec su root -c "$(printf ' %q' "${orig_argv[@]}")"
fi fi