Compare commits

...

17 Commits

Author SHA1 Message Date
Maciej Barć 56bdfe5c35
src/repomanci: update ignored
Signed-off-by: Maciej Barć <xgqt@riseup.net>
2021-07-24 00:58:25 +02:00
Maciej Barć 82a583f00d
ebuild-activate: tweaks; add more aliases; mark time
Signed-off-by: Maciej Barć <xgqt@riseup.net>
2021-07-05 14:13:02 +02:00
Maciej Barć 5db7afa3d5
ebuild-activate: add PORTAGE_*LOG*
Signed-off-by: Maciej Barć <xgqt@riseup.net>
2021-07-05 13:54:45 +02:00
Maciej Barć 662d9b42f4
src/ebuild-activate: change PS1
Signed-off-by: Maciej Barć <xgqt@riseup.net>
2021-07-03 16:27:17 +02:00
Maciej Barć e1973e3055
src: add ebuild-activate
Thanks to Micahł Górny for inspiration: https://0x0.st/-fQu.sh

Signed-off-by: Maciej Barć <xgqt@riseup.net>
2021-07-03 16:19:06 +02:00
Maciej Barć 910a2e8426
src/*: empty GENTOO_MIRRORS
Signed-off-by: Maciej Barć <xgqt@riseup.net>
2021-07-01 20:09:16 +02:00
Maciej Barć 452a71560e
src: verbose repoman
Signed-off-by: Maciej Barć <xgqt@riseup.net>
2021-06-06 23:58:36 +02:00
Maciej Barć b71af2ce28
.gitlab-ci.yml: switch to dyne/devuan:ceres image
Signed-off-by: Maciej Barć <xgqt@riseup.net>
2021-06-04 10:59:29 +02:00
xosefulk d4306a3f7e
simplify logic 2021-06-04 14:21:00 +06:00
xosefulk 14b734ad42
ditch `echo` for `printf` & redirect error messages to standard output stream 2021-06-04 14:19:26 +06:00
Maciej Barć 850ca56ff7
src/eball: update usage
Signed-off-by: Maciej Barć <xgqt@riseup.net>
2021-04-18 02:03:25 +02:00
Maciej Barć c6b6f6062d
*: update my email (xgqt@riseup.net)
Signed-off-by: Maciej Barć <xgqt@riseup.net>
2021-04-18 02:02:15 +02:00
Maciej Barć ba55fe2f2d
src/install-ebuild-deps: fix some stupid bugs; update copyright
Signed-off-by: Maciej Barć <xgqt@riseup.net>
2021-04-18 01:59:44 +02:00
Maciej Barć e2cd817f72
src/commit-ebuild: rework; add options to quickly bump or drop pkgs
Signed-off-by: Maciej Barć <xgqt@riseup.net>
2021-04-08 23:57:45 +02:00
Maciej Barć 8945817ba4
LICENSE: original text
Signed-off-by: Maciej Barć <xgqt@riseup.net>
2021-03-29 13:26:46 +02:00
Maciej Barć c0570e273b
README.md: re-format; update license text
Signed-off-by: Maciej Barć <xgqt@riseup.net>
2021-03-29 13:02:48 +02:00
Maciej Barć 9987663dc4
*: move to GPL-3.0-only
Signed-off-by: Maciej Barć <xgqt@riseup.net>
2021-03-29 13:02:30 +02:00
22 changed files with 385 additions and 203 deletions

View File

@ -2,8 +2,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -13,21 +12,24 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć (xgqt@protonmail.com)
# Copyright (c) 2020, src_prepare group
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020-2021, src_prepare group
# Licensed under the GNU GPL v3 License
image: debian:stable-slim
image: dyne/devuan:ceres
stages:
- test
before_script:
- apt-get update
- apt update
- apt-get install -y bash pylint3 shellcheck
- ln -fs $(which pylint3) /usr/bin/pylint
test:
stage: test
script:

View File

@ -1,3 +1,5 @@
# Scripts
<p align="center">
<a href="https://gitlab.com/src_prepare/scripts/pipelines">
<img src="https://gitlab.com/src_prepare/scripts/badges/master/pipeline.svg">
@ -20,6 +22,30 @@
</p>
# Scripts
# About
Miscellaneous maintenance scripts by src_prepare group
# License
SPDX-License-Identifier: GPL-3.0-only
## Unless otherwise stated contents here are under the GNU GPL v3 license
This file is part of scripts.
scripts 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 3.
scripts 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.
You should have received a copy of the GNU General Public License
along with scripts. If not, see <https://www.gnu.org/licenses/>.
Copyright (c) 2020-2021, src_prepare group
Licensed under the GNU GPL v3 License

View File

@ -5,8 +5,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć (xgqt@protonmail.com)
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020, src_prepare group
# Licensed under the GNU GPL v3 License
@ -28,7 +27,7 @@
# Check if we are in a git repo
if ! git status >/dev/null; then
echo "Not a git repo... exiting"
printf "%s\n" "Not a git repo... exiting" >> /dev/stderr
exit 1
fi
@ -47,19 +46,20 @@ fi
# This will likely exit firh error, because repoman
# has to download some files (metadata.xsd)
# We do that so we can truthfully test the actual latest commit
echo ">>> Starting full test"
echo "Running repoman -Idix"
repoman -Idix
echo "Running pkgcheck scan"
printf "%s\n" \
">>> Starting full test" \
"Running repoman -Idix"
repoman --verbose -Idix
printf "%s\n" "Running pkgcheck scan"
pkgcheck scan
echo ">>> Starting latest commit test"
printf "%s\n" ">>> Starting latest commit test"
test_success=true
# Use pkgchek
echo "Running pkgcheck scan --commits"
printf "%s\n" "Running pkgcheck scan --commits"
pkgcheck scan --commits || test_success=false
# Iterate through changed files in last commit
@ -79,10 +79,10 @@ do
if cd "${commit_dir}"
then
echo
echo "Directory $(pwd):"
echo "Running repoman -Idix"
repoman -Idix || test_success=false
printf "\n%s\n" \
"Directory $(pwd):" \
"Running repoman -Idix"
repoman --verbose -Idix || test_success=false
cd - >/dev/null || return
fi
done
@ -90,7 +90,7 @@ done
# If any of the QA tools fail the test will fail
if [ ${test_success} = false ]
then
echo ">>> Exiting with failure due to previous errors..."
printf "%s\n" ">>> Exiting with failure due to previous errors..." >> /dev/stderr
exit 1
else
exit 0

View File

@ -5,8 +5,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć <xgqt@protonmail.com>
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2021, src_prepare group
# Licensed under the GNU GPL v3 License
@ -70,8 +69,12 @@ do
done
# Output info with colors.
echo -e "\e[1;33m${PACKAGE}\e[0m"
echo -e " \e[1;35mPortage:\e[0m${PORTPACK_VERS}"
echo -e " \e[1;35mOverlay:\e[0m${OVERPACK_VERS}"
purple=$'\e[1;35m'
esc=$'\e[0m'
printf "%s\n" \
"${purple}${PACKAGE}${esc}" \
" ${purple}Portage:${esc}${PORTPACK_VERS}" \
" ${purple}Overlay:${esc}${OVERPACK_VERS}"
fi
done

View File

@ -5,8 +5,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć <xgqt@protonmail.com>
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020-2021, src_prepare group
# Licensed under the GNU GPL v3 License
@ -47,11 +46,12 @@ reset="$(tput sgr0)"
ok_msg() {
echo "${bold}${green}* ${white}${1}${reset}"
printf "%s\n" "${bold}${green}* ${white}${1}${reset}"
}
err_msg() {
echo "${bold}${red}* ${white}${1}${reset}"
# redirect error messages to standard error stream
printf "%s\n" "${bold}${red}* ${white}${1}${reset}" >> /dev/stderr
}
usage() {
@ -104,7 +104,7 @@ do
if [ "${known_unique#*${pkg}}" = "${known_unique}" ]
then
nnuniq=$((nnuniq + 1))
echo
printf "\n"
ok_msg "Package ${nnuniq} ${pkg}:"
use_eix --exact --force-color "${pkg}"
fi

View File

@ -5,8 +5,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć (xgqt@protonmail.com)
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020, src_prepare group
# Licensed under the GNU GPL v3 License
@ -37,5 +36,5 @@ then
su root -c "rm -fr ${cache}" || exit 1
fi
else
echo "No pre-generated md5-cache found in ${cache}"
printf "%s\n" "No pre-generated md5-cache found in ${cache}" >> /dev/stderr
fi

View File

@ -5,8 +5,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć (xgqt@protonmail.com)
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020, src_prepare group
# Licensed under the GNU GPL v3 License
@ -26,21 +25,54 @@ set -e
export PATH
pdir="$(git rev-parse --show-prefix)"
FEATURES="sign"
export FEATURES
package_directory="$(git rev-parse --show-prefix)"
package="${package_directory%/}"
error_no_version() {
printf "%s\n" \
"[ERROR]: No version given" \
" Ran with option: ${1}" >> /dev/stderr
exit 1
}
git add .
if [ -z "${1}" ]
then
repoman commit
else
repoman commit -m "${pdir%/}: ${*}"
fi
git pull --verbose
git push --verbose
case "${1}"
in
"" )
printf "%s\n" "[DEBUG]: no additional arguments/options given" >> /dev/stderr
repoman commit
;;
-b | --bump )
printf "%s\n" "[DEBUG]: to be: ${package}: bump to ${2}"
if [ -n "${2}" ]
then
repoman commit -m "${package}: bump to ${2}"
else
error_no_version "${1}"
fi
;;
-d | --drop )
printf "%s\n" "[DEBUG]: to be: ${package}: drop old ${2}"
if [ -n "${2}" ]
then
repoman commit -m "${package}: drop old ${2}"
else
error_no_version "${1}"
fi
;;
-* )
printf "%s\n" "[ERROR]: Unknown option ${1}" >> /dev/stderr
exit 1
;;
* )
printf "%s\n" "[DEBUG]: to be: ${package}: ${*}"
repoman commit -m "${package}: ${*}"
;;
esac

View File

@ -5,8 +5,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,8 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć (xgqt@protonmail.com)
# Copyright (c) 2020, src_prepare group
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020-2021, src_prepare group
# Licensed under the GNU GPL v3 License
@ -30,9 +29,9 @@ usage() {
Usage: eball FILES
eball - test new ebuilds
Original author: XGQT
Copyright (c) 2020, src_prepare group
Licensed under the ISC License
Original author: Maciej Barć
Copyright (c) 2020-2021, src_prepare group
Licensed under the GPLv3
HELP
}
@ -50,12 +49,12 @@ fi
for ebuild in "${@}"
do
# one may want this to be unprivileged
repoman manifest || ebuild "${ebuild}" manifest
GENTOO_MIRRORS="" repoman manifest || ebuild "${ebuild}" manifest
# we want this to be privileged on Gentoo systems
if [ "$(whoami)" != root ] && [ -z "${EPREFIX}" ]
then
echo "Switching to the root account"
printf "%s\n" "Switching to the root account"
su root -c "ebuild ${ebuild} clean test merge"
else
ebuild "${ebuild}" clean test merge

119
src/ebuild-activate Normal file
View File

@ -0,0 +1,119 @@
#!/bin/sh
# This file is part of scripts.
# scripts 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 3.
# scripts 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.
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2021, src_prepare group
# Licensed under the GNU GPL v3 License
# Exit if script is not sourced
case ${-}
in
*i* )
:
;;
* )
printf "%s\n" "Run: source ${0}" \
">>> Exiting the shell" \
>> /dev/stderr
exit 1
;;
esac
# Internal
_timest="$(date +%Y-%m-%d_%H:%M:%S || echo 'null')"
_tmpdir='/tmp/edev'
_toplevel="$(git rev-parse --show-toplevel || echo '/dev/null')"
# Mark time when user entered environment for given repository
if mkdir -p "${_tmpdir}"
then
if cd "${_tmpdir}"
then
ln -fs "${_toplevel}" "${_timest}"
cd - ||
echo 'Bug?'
fi
fi
# Set variables for ebuild development
ACCEPT_LICENSE='*'
export ACCEPT_LICENSE
if type lz4 >/dev/null
then
BINPKG_COMPRESS='lz4'
export BINPKG_COMPRESS
fi
if mkdir -p "${_tmpdir}/dist"
then
DISTDIR="${_tmpdir}/dist"
export DISTDIR
fi
GENTOO_MIRRORS=''
export GENTOO_MIRRORS
INSTALL_MASK=''
export INSTALL_MASK
if mkdir -p "${_tmpdir}/elog"
then
PORTAGE_ELOG_CLASSES='warn error log'
export PORTAGE_ELOG_CLASSES
PORTAGE_ELOG_SYSTEM='save'
export PORTAGE_ELOG_SYSTEM
PORTAGE_LOGDIR="${_tmpdir}/elog"
export PORTAGE_LOGDIR
fi
if [ -e "${_toplevel}/profiles/repo_name" ]
then
PORTDIR="${_toplevel}"
export PORTDIR
fi
PS1="(ebuild) ${PS1}"
# Some helpful aliases
alias cd-edev='cd ${_tmpdir}'
alias cd-repo='cd ${_toplevel}'
alias cd-dist='cd ${DISTDIR}'
alias cd-elog='cd ${PORTAGE_LOGDIR}'
alias clean-edev='rm -r ${_tmpdir}'
alias clean-dist='rm -r ${DISTDIR}'
alias clean-elog='rm -r ${PORTAGE_LOGDIR}'
alias ls-edev='ls -ahl ${_tmpdir}'
alias ls-repo='ls -ahl ${_toplevel}'
alias ls-dist='ls -ahl ${DISTDIR}'
alias ls-elog='ls -ahl ${PORTAGE_LOGDIR}'
clear
echo ">>> Entering Ebuild development environment"

View File

@ -5,8 +5,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć (xgqt@protonmail.com)
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020, src_prepare group
# Licensed under the GNU GPL v3 License
@ -37,9 +36,8 @@ command_exists() {
if command -v "${1}" >/dev/null
then
return 0
else
return 1
fi
return 1
}
if command_exists tput
@ -59,7 +57,7 @@ eprefix_addpath() {
PATH=${1}:${PATH}
export PATH
else
echo "${eprefix_warn} ${1} not found"
printf "%s\n" "${eprefix_warn} ${1} not found" >> /dev/stderr
fi
}
@ -69,7 +67,7 @@ eprefix_addman() {
MANPATH=${1}:${MANPATH}
export MANPATH
else
echo "${eprefix_warn} ${1} not found"
printf "%s\n" "${eprefix_warn} ${1} not found" >> /dev/stderr
fi
}
@ -96,9 +94,10 @@ case ${-} in
:
;;
* )
echo "${eprefix_bad} Error: not a login shell"
echo "${eprefix_bad} Run: source ${0}"
echo ">>> Exiting the shell"
printf "%s\n" \
"${eprefix_bad} Error: not a login shell" \
"${eprefix_bad} Run: source ${0}" \
">>> Exiting the shell" >> /dev/stderr
exit 1
;;
esac
@ -106,8 +105,9 @@ esac
# Exit if eprefix does not exist
if [ ! -d "${EPREFIX}" ]
then
echo "${eprefix_bad} No ${EPREFIX} found!"
echo ">>> Exiting the shell"
printf "%s\n" \
"${eprefix_bad} No ${EPREFIX} found!" \
">>> Exiting the shell" >> /dev/stderr
sleep 3
exit 1
fi
@ -179,44 +179,42 @@ FEATURES="${FEATURES} -usersandbox -sandbox"
export FEATURES
# Check if we are on a prefix profile
echo ""
printf "\n"
if command_exists eselect
then
eprofile="$(eselect profile show)"
if [[ "${eprofile}" == *prefix* ]]
then
echo "${eprefix_good} ${eprofile}"
printf "%s\n" "${eprefix_good} ${eprofile}"
else
echo "${eprefix_bad} You are not on a prefix profile"
printf "%s\n" "${eprefix_bad} You are not on a prefix profile" >> /dev/stderr
fi
unset eprofile
else
echo "${eprefix_bad} Could not determine running profile"
printf "%s\n" "${eprefix_bad} Could not determine running profile" >> /dev/stderr
fi
# >>> Finish
echo ""
echo ">>> Sourced the eprefix script"
echo ""
echo "${eprefix_good} Prefix: ${EPREFIX}"
echo "${eprefix_good} Packages: $(eprefix_packages)"
echo "${eprefix_good} In World: $(eprefix_world)"
echo "${eprefix_good} Have fun! ;-)"
printf "\n%s\n" \
">>> Sourced the eprefix script\n" \
"${eprefix_good} Prefix: ${EPREFIX}" \
"${eprefix_good} Packages: $(eprefix_packages)" \
"${eprefix_good} In World: $(eprefix_world)" \
"${eprefix_good} Have fun! ;-)"
if command_exists emerge
then
echo ""
echo ">>> Environment ready"
printf "\n%s\n" ">>> Environment ready"
else
echo ""
echo "${eprefix_bad} Could not locate emerge"
echo "${eprefix_bad} Environment may be broken"
echo ">>> Continuing anyway..."
printf "\n%s\n" \
"${eprefix_bad} Could not locate emerge" \
"${eprefix_bad} Environment may be broken" \
">>> Continuing anyway..." >> /dev/stderr
fi

View File

@ -5,8 +5,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć (xgqt@protonmail.com)
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020, src_prepare group
# Licensed under the GNU GPL v3 License
@ -32,9 +31,10 @@ export PATH
if [ -z "${1}" ]
then
echo "No overlay names given"
echo "Please give at least one overlay name as a commandline argument"
echo "Exiting"
printf "%s\n" \
"No overlay names given" \
"Please give at least one overlay name as a commandline argument" \
"Exiting" >> /dev/stderr
exit 1
fi
@ -44,5 +44,5 @@ do
do
euscan --nocolor --quiet "${ebuild}" | tee -a "euscan-${overlay}.log"
done
echo ">>> Done scanning ${overlay}"
printf "%s\n" ">>> Done scanning ${overlay}"
done

View File

@ -4,8 +4,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -22,8 +21,8 @@
function scanning(){
EUSCAN=$(euscan --nocolor --quiet "$1")
if [ -n "$EUSCAN" ]; then
echo "=============== NOW: $(find ./* -mindepth 2 -maxdepth 2 -name ''"$1"'*.ebuild' | tail -1) =================
$(echo -e "$EUSCAN" | tail -1)"
printf "%s\n" "=============== NOW: $(find ./* -mindepth 2 -maxdepth 2 -name ''"$1"'*.ebuild' | tail -1) =================
$(printf "%s\n" "$EUSCAN" | tail -1)"
fi
}
@ -34,7 +33,7 @@ function folder(){
for FILE in */*
do
PACKAGE=$(echo "$FILE" | grep -Eo '[A-z0-9_-]+$')
PACKAGE=$(printf "%s\n" "$FILE" | grep -Eo '[A-z0-9_-]+$')
PACKAGES+=("$PACKAGE")
done
@ -48,14 +47,15 @@ function folder(){
wait "$j"
done
echo -n ">>> Done scanning $1"
printf "%s\n" ">>> Done scanning $1"
}
function nofolder(){
if [ -z "${1}" ]; then
echo "No overlay names given"
echo "Please give at least one overlay name as a commandline argument"
echo "Exiting"
printf "%s\n" \
"No overlay names given" \
"Please give at least one overlay name as a commandline argument" \
"Exiting" >> /dev/stderr
exit 1
fi
@ -71,23 +71,23 @@ do
wait "$j"
done
echo -n ">>> Done scanning ${overlay}"
printf "%s\n" ">>> Done scanning ${overlay}"
done
}
function help(){
echo "You can use:"
echo "* -r or --repo <HERE-REPO-NAME>"
echo "* -f or --folder <FOLDER-NAME>"
echo
echo "Example of usage"
echo "./euscan-parallel -r src_prepare-overlay"
echo "./euscan-parallel -f ~/git/src_prepare-overlay"
printf "%s\n" \
"You can use:" \
"* -r or --repo <HERE-REPO-NAME>" \
"* -f or --folder <FOLDER-NAME>\n" \
"Example of usage" \
"./euscan-parallel -r src_prepare-overlay" \
"./euscan-parallel -f ~/git/src_prepare-overlay"
}
function main(){
[ "$(whereis eix | wc -w)" -le "1" ] && { echo "The eix is NOT installed"; exit; }
[ "$(whereis euscan | wc -w)" -le "1" ] && { echo "The euscan is NOT installed"; exit; }
[ "$(whereis eix | wc -w)" -le "1" ] && { printf "%s\n" "The eix is NOT installed" >> /dev/stderr; exit; }
[ "$(whereis euscan | wc -w)" -le "1" ] && { printf "%s\n" "The euscan is NOT installed" >> /dev/stderr; exit; }
case $1 in
-h|--help)
help
@ -99,7 +99,7 @@ function main(){
folder "$2" | tee -a "euscan-$(date -I).log"
;;
*)
echo "No found variable"; echo; help
printf "%s\n" "No found variable" >> /dev/stderr; printf "\n"; help
esac
}

View File

@ -5,8 +5,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć (xgqt@protonmail.com)
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020, src_prepare group
# Licensed under the GNU GPL v3 License
@ -27,7 +26,7 @@ export PATH
emsg() {
echo "$(tput bold)$(tput setaf 6)>>> $(tput setaf 4)$(date +%H:%M:%S)$(tput setaf 7) ${*} $(tput sgr0)"
printf "%s\n" "$(tput bold)$(tput setaf 6)>>> $(tput setaf 4)$(date +%H:%M:%S)$(tput setaf 7) ${*} $(tput sgr0)"
}
edie() {

View File

@ -6,8 +6,7 @@ This file is part of scripts.
scripts 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, either version 3 of the License, or
(at your option) any later version.
the Free Software Foundation, version 3.
scripts is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -17,8 +16,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with scripts. If not, see <https://www.gnu.org/licenses/>.
Original author: Maciej Barć (xgqt@protonmail.com)
Copyright (c) 2020, src_prepare group
Original author: Maciej Barć <xgqt@riseup.net>
Copyright (c) 2020-2021, src_prepare group
Licensed under the GNU GPL v3 License
Install Ebuild Dependencies
@ -30,12 +29,13 @@ to emerge dependencies we would just do "emerge --oneshot --onlydeps PKG".
import argparse
import sys
from subprocess import call
parser = argparse.ArgumentParser(
description="Install Ebuild Dependencies",
epilog="Copyright (c) 2020, src_prepare group (License: ISC)"
epilog="Copyright (c) 2020-2021, src_prepare group (License: GPLv3)"
)
parser.add_argument(
"ebuild",
@ -46,16 +46,14 @@ args = parser.parse_args()
def pkg_name(pkg_str):
"""Parse string and return a pkg name"""
"""
Parse string and return a pkg name.
"""
# TODO: don't strip but force
proper = ""
# Strip required use
for i in ["["]:
if i in pkg_str:
proper = pkg_str.split(i)[0]
proper = pkg_str.split("[")[0]
# Strip conditional use
for i in ["$", "DEPEND", "||", "!", "?", "(", ")"]:
@ -66,12 +64,21 @@ def pkg_name(pkg_str):
def ebuild_deps(ebuild_file):
"""Returns dependencies from a ebuild file"""
"""
Returns dependencies from a ebuild file.
"""
deps = []
adddeps = False
with open(ebuild_file) as ebuild:
for line in ebuild.read().splitlines():
if adddeps:
# TODO: Find a better way to find the depend "block"
if "DEPEND" in line:
adddeps = True
elif adddeps:
# TODO: Find a better pkg match method
if "/" in line:
deps.append(
@ -79,16 +86,20 @@ def ebuild_deps(ebuild_file):
)
elif "\"" in line:
adddeps = False
# TODO: Find a better way to find the depend "block"
elif "DEPEND" in line:
adddeps = True
return deps
def main():
"""The main function"""
"""
The main function.
"""
print("Ebuilds:", args.ebuild)
if args.ebuild == []:
print("[ERROR]: No ebuilds given")
sys.exit(1)
all_deps = []
for ebuild in args.ebuild:

View File

@ -6,8 +6,7 @@ This file is part of scripts.
scripts 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, either version 3 of the License, or
(at your option) any later version.
the Free Software Foundation, version 3.
scripts is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -17,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with scripts. If not, see <https://www.gnu.org/licenses/>.
Original author: Maciej Barć (xgqt@protonmail.com)
Original author: Maciej Barć <xgqt@riseup.net>
Copyright (c) 2020, src_prepare group
Licensed under the GNU GPL v3 License

View File

@ -5,8 +5,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć (xgqt@protonmail.com)
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020, src_prepare group
# Licensed under the GNU GPL v3 License
@ -75,15 +74,15 @@ main() {
ebuild="$(basename "$(pwd)")-9999.ebuild"
if [ ! -f "${ebuild}" ]
then
echo "${ebuild_template}" > "${ebuild}"
printf "%s\n" "${ebuild_template}" > "${ebuild}"
else
echo "Already exists: ${ebuild}"
printf "%s\n" "Already exists: ${ebuild}" >> /dev/stderr
fi
if [ ! -f "metadata.xml" ]
then
echo "${metadata_template}" > "metadata.xml"
printf "%s\n" "${metadata_template}" > "metadata.xml"
else
echo "Already exists: metadata.xml"
printf "%s\n" "Already exists: metadata.xml" >> /dev/stderr
fi
}
@ -92,10 +91,11 @@ if [ -f ../../profiles/repo_name ]
then
main
else
echo "Are you in a overlay repo?"
echo "To use this script successfully:"
echo "1. Create a \${CATEGOTY}/\${PN} directory"
echo "2. Change directory to it"
echo "3. Execute ${0}"
printf "%s\n" \
"Are you in a overlay repo?" \
"To use this script successfully:" \
"1. Create a \${CATEGOTY}/\${PN} directory" \
"2. Change directory to it" \
"3. Execute ${0}" >> /dev/stderr
exit 1
fi

7
src/pn
View File

@ -5,8 +5,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć (xgqt@protonmail.com)
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020, src_prepare group
# Licensed under the GNU GPL v3 License
@ -27,4 +26,4 @@ trap 'exit 128' INT
cd "${1:-$(pwd)}" || exit 1
path="$(git rev-parse --show-prefix)"
echo "${path%/}"
printf "%s\n" "${path%/}"

View File

@ -4,8 +4,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -25,7 +24,7 @@
if [ -z "$1" ]; then
echo "Must specify a file to modify..."
printf "%s\n" "Must specify a file to modify..."
exit 1
fi
regex='^=?(\S+)(?:-[[:digit:]]+\S*)(\s)(\S+)$'

View File

@ -5,8 +5,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,8 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć (xgqt@protonmail.com)
# Copyright (c) 2020, src_prepare group
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020-2021, src_prepare group
# Licensed under the GNU GPL v3 License
@ -27,7 +26,7 @@ export PATH
main() {
[ -f Manifest ] && rm -v Manifest
repoman --verbose manifest
GENTOO_MIRRORS="" repoman --verbose manifest
repoman --verbose -Idx full
pkgcheck --verbose scan
@ -37,12 +36,13 @@ main() {
case ${1}
in
-h | -help | --help )
echo "Usage: ${0}"
echo "Performed in this script:"
echo "1. remove Manifest file"
echo "2. regen Manifest with 'repoman manifest'"
echo "3. Check with 'repoman -Idx full'"
echo "4. Check with 'pkgcheck scan'"
printf "%s\n" \
"Usage: ${0}" \
"Performed in this script:" \
"1. remove Manifest file" \
"2. regen Manifest with 'repoman manifest'" \
"3. Check with 'repoman -Idx full'" \
"4. Check with 'pkgcheck scan'"
;;
* )
main

View File

@ -5,8 +5,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć (xgqt@protonmail.com)
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020, src_prepare group
# Licensed under the GNU GPL v3 License
@ -30,13 +29,16 @@
ignored_dirs=(
.
.git
3rd_party
doc
eclass
files
licenses
metadata
profiles
public
scribblings
scripts
3rd_party
)
@ -49,12 +51,13 @@ ignored_dirs=(
# This will likely exit firh error, because repoman
# has to download some files (metadata.xsd)
# We do that so we can truthfully test the actual latest commit
echo ">>> Starting full test"
echo "Running repoman -Idix"
repoman -Idix
printf "%s\n" \
">>> Starting full test" \
"Running repoman -Idix"
repoman --verbose -Idix
echo ">>> Starting latest commit test"
printf "%s\n" ">>> Starting latest commit test"
# If any of the QA checks fail the test will fail
test_success=true
@ -71,27 +74,26 @@ do
do
if [[ "${commit_dir}" = *"${i_dir}"* ]]
then
echo
echo "Ignoring ${commit_dir}"
printf "\n%s\n" "Ignoring ${commit_dir}"
continue 2
fi
done
if cd "${commit_dir}"
then
echo
echo "Checking ${commit_dir}"
echo "Running repoman -Idix"
repoman -Idix || test_success="false"
printf "\n%s\n" \
"Checking ${commit_dir}" \
"Running repoman -Idix"
repoman --verbose -Idix || test_success="false"
cd - >/dev/null || return
fi
done
if [ "${test_success}" = "false" ]
then
echo ">>> Exiting with failure due to previous errors"
printf "%s\n" ">>> Exiting with failure due to previous errors" >> /dev/stderr
exit 1
else
echo ">>> Exiting successfully"
printf "%s\n" ">>> Exiting successfully"
exit 0
fi

View File

@ -5,8 +5,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć (xgqt@protonmail.com)
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020, src_prepare group
# Licensed under the GNU GPL v3 License

20
test.sh
View File

@ -5,8 +5,7 @@
# scripts 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, either version 3 of the License, or
# (at your option) any later version.
# the Free Software Foundation, version 3.
# scripts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
# Original author: Maciej Barć (xgqt@protonmail.com)
# Original author: Maciej Barć <xgqt@riseup.net>
# Copyright (c) 2020, src_prepare group
# Licensed under the GNU GPL v3 License
@ -31,16 +30,15 @@ exit_result=0
run_test() {
for file in ${2}
do
echo "File ${file}... checking"
printf "%s\n" "File ${file}... checking"
if command "${1}" "${file}"
then
echo " file is correct"
printf "%s\n" " file is correct"
else
echo " there were errors found in the file"
printf "%s\n" " there were errors found in the file" >> /dev/stderr
exit_result=1
fi
echo "Done: ${file}"
echo
printf "%s\n\n" "Done: ${file}"
done
}
@ -53,11 +51,9 @@ run_test pylint "${py_files}"
if [ ${exit_result} = 0 ]
then
echo "No errors reported"
echo "Exiting successfully"
printf "%s\n" "No errors reported" "Exiting successfully"
exit ${exit_result}
else
echo "Some errors reported"
echo "Exiting without success"
printf "%s\n" "Some errors reported" "Exiting without success" >> /dev/stderr
exit ${exit_result}
fi