summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorcoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2015-08-29 08:22:51 -0300
committercoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2015-08-29 08:22:51 -0300
commitbd16b61a2be9d158778244c3e2b184a65a496e5d (patch)
treec8c31f7fead3dccbb7b6ca49838c3ec627b922f2 /src/bin
parentc7f15e3d643c6ab4537b7355b7544b84aabf6039 (diff)
replace all db-* exec with xbs, create all db-* compability, and add DISTRO_TYPE on all platform configs
Diffstat (limited to 'src/bin')
-rw-r--r--[l---------]src/bin/db-import23
-rw-r--r--[-rwxr-xr-x]src/bin/db-init34
-rwxr-xr-xsrc/bin/db-pkg-add76
-rwxr-xr-xsrc/bin/db-pkg-rm72
-rw-r--r--[l---------]src/bin/db-repo-add23
-rw-r--r--[l---------]src/bin/db-repo-remove23
-rw-r--r--src/bin/xbs206
7 files changed, 275 insertions, 182 deletions
diff --git a/src/bin/db-import b/src/bin/db-import
index fc0dcd8..f5e445e 120000..100644
--- a/src/bin/db-import
+++ b/src/bin/db-import
@@ -1 +1,22 @@
-db-sync \ No newline at end of file
+#!/bin/bash
+# X Build System
+# Copyright (C) 2012-2015 Parabola Hackers <https://www.parabola.nu>
+
+# 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, either version 3 of the License, or
+# (at your option) any later version.
+
+# 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.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CONFIG_DIR="$(dirname "$(readlink -e "$0")")/etc"
+
+FLAGS=("${@}")
+
+RUN_DIR="xbs import ${FLAGS[@]}"
diff --git a/src/bin/db-init b/src/bin/db-init
index 42574a4..624fb7f 100755..100644
--- a/src/bin/db-init
+++ b/src/bin/db-init
@@ -1,5 +1,5 @@
#!/bin/bash
-# Creates the repository structure defined in config
+# X Build System
# Copyright (C) 2012-2015 Parabola Hackers <https://www.parabola.nu>
# This program is free software: you can redistribute it and/or modify
@@ -17,34 +17,6 @@
CONFIG_DIR="$(dirname "$(readlink -e "$0")")/etc"
-source "${CONFIG_DIR}/xbs.cfg"
-source "${SHARE_DIR}/db-functions"
+FLAGS=("${@}")
-platforms=("${@:1}")
-
-db-init_run() {
- mkdir -p -- "${PKG_MAIN_POOLS}" "${SRC_MAIN_POOLS}" "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR}" "${STAGING}"
-}
-
-for '_platform' in "${PLATFORMS[@]}"; do
- if [ "${#}" -eq '0' ]; then
- source "${CONFIG_DIR}/xbs.d/${_platform}.cfg"
-
- db-init_run
- else
- for 'platform' in "${platforms[@]}"; do
- # Rename ("${plataform}") to easily script usage
- _platform_name="${platform/\//+}" _platform_name="${_platforms_name,,}"
-
- if [ "${_platform_name}" == "${platform}" ]; then
- source "${CONFIG_DIR}/xbs.d/${_platform_name}.cfg"
-
- db-init_run
- else
- die "This %s plataform doesn't exist" "${plataform}"
- fi
- done
- fi
-done
-
-# "${BIN_DIR}/db-repo-add" -p "${_platform}" "${PKG_REPOS[@]}"
+RUN_DIR="xbs init ${FLAGS[@]}"
diff --git a/src/bin/db-pkg-add b/src/bin/db-pkg-add
deleted file mode 100755
index 718e7d4..0000000
--- a/src/bin/db-pkg-add
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/bin/bash
-# Add package to repository defined in config
-# Copyright (C) 2012-2015 Parabola Hackers <https://www.parabola.nu>
-
-# 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, either version 3 of the License, or
-# (at your option) any later version.
-
-# 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.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-CONFIG_DIR="$(dirname "$(readlink -e "${0}")")/etc"
-
-source "${CONFIG_DIR}/xbs.cfg"
-source "${SHARE_DIR}/db-functions"
-
-if [ "${#}" -lt '4' ]; then
- msg "usage: %s <platform> <repo> <arch> <pkg_file> ..." "${0##*/}"
- exit 1
-fi
-
-plataform="${1}"
-repo="${2}"
-arch="${3}"
-pkg_files=("${@:4}")
-
-for '_platform' in "${PLATFORMS[@]}"; do
- # Rename ("${plataform}") to easily script usage
- _platform_name="${plataform/\//+}" _platform_name="${_platform_name,,}"
-
- if [ "${_platform_name}" == "${_platform}" ]; then
- source "${CONFIG_DIR}/xbs.d/${_platform}.cfg"
-
- repo_path="${REPO_DIR}/${repo}/os"
-
- if ! check_repo_permission "${repo}"; then
- die "You don't have permission to add packages to %s" "${repo}"
- fi
-
- if [ "${arch}" == "{any}" ]; then
- tarches=("${ARCHES[@]}")
- else
- tarches=("${arch}")
- fi
-
- for 'tarch' in "${tarches[@]}"; do
- if [[ ! -d "${repo_path} ]]; then
- die "This [%s] doesn't exist" "${repo}"
- elif [[ ! -d "${repo_path}/${tarch}" ]]; then
- die "This [%s] doesn't support %s archictecture" "${repo}" "${arch}"
- else
- repo_lock "${repo}" "${tarch}" || exit 1
- fi
- done
-
- for 'tarch' in "${tarches[@]}"; do
- for 'pkg_file' in "${pkg_files[@]}"; do
- if [[ ! -f "${repo_path}/${arch}/${pkg_file##*/}" ]]; then
- die "Package file %s not found in %s" "${pkg_file##*/}" "${repo_path}/${arch}/"
- else
- msg "Adding %s to [%s]..." "${pkg_file}" "${repo}"
- fi
- done
- pkg_repo_add "${repo}" "${tarch}" "${pkg_files[@]}"
- repo_unlock "${repo}" "${tarch}"
- done
- else
- die "This %s plataform doesn't exist" "${plataform}"
- fi
-done
diff --git a/src/bin/db-pkg-rm b/src/bin/db-pkg-rm
deleted file mode 100755
index 1a651c4..0000000
--- a/src/bin/db-pkg-rm
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/bash
-# Remove package to repository defined in config
-# Copyright (C) 2012-2015 Parabola Hackers <https://www.parabola.nu>
-
-# 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, either version 3 of the License, or
-# (at your option) any later version.
-
-# 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.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-CONFIG_DIR="$(dirname "$(readlink -e "${0}")")/etc"
-
-source "${CONFIG_DIR}/xbs.cfg"
-source "${SHARE_DIR}/db-functions"
-
-if [ "${#}" -lt '4' ]; then
- msg "usage: %s <platform> <repo> <arch> <pkg_name> ..." "${0##*/}"
- exit 1
-fi
-
-plataform="${1}"
-repo="${2}"
-arch="${3}"
-pkg_names=("${@:4}")
-
-for '_platform' in "${PLATFORMS[@]}"; do
- # Rename ("${plataform}") to easily script usage
- _platform_name="${plataform/\//+}" _platform_name="${_platform_name,,}"
-
- if [ "${_platform_name}" == "${_platform}" ]; then
- source "${CONFIG_DIR}/xbs.d/${_platform}.cfg"
-
- repo_path="${REPO_DIR}/${repo}/os"
-
- if ! check_repo_permission "${repo}"; then
- die "You don't have permission to remove packages to %s" "${repo}"
- fi
-
- if [ "${arch}" == "{any}" ]; then
- tarches=("${ARCHES[@]}")
- else
- tarches=("${arch}")
- fi
-
- for 'tarch' in "${tarches[@]}"; do
- if [[ ! -d "${repo_path} ]]; then
- die "This [%s] doesn't exist" "${repo}"
- elif [[ ! -d "${repo_path}/${tarch}" ]]; then
- die "This [%s] doesn't support %s archictecture" "${repo}" "${arch}"
- else
- repo_lock "${repo}" "${tarch}" || exit 1
- fi
- done
-
- for 'tarch' in "${tarches[@]}"; do
- for 'pkg_name' in "${pkg_names[@]}"; do
- msg "Removing %s from [%s]..." "${pkg_name}" "${repo}"
- done
- pkg_repo_rm "${repo}" "${tarch}" "${pkgnames[@]}"
- repo_unlock "${repo}" "${tarch}"
- done
- else
- die "This %s plataform doesn't exist" "${plataform}"
- fi
-done
diff --git a/src/bin/db-repo-add b/src/bin/db-repo-add
index 94f9cee..6969746 120000..100644
--- a/src/bin/db-repo-add
+++ b/src/bin/db-repo-add
@@ -1 +1,22 @@
-db-pkg-add \ No newline at end of file
+#!/bin/bash
+# X Build System
+# Copyright (C) 2012-2015 Parabola Hackers <https://www.parabola.nu>
+
+# 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, either version 3 of the License, or
+# (at your option) any later version.
+
+# 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.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CONFIG_DIR="$(dirname "$(readlink -e "$0")")/etc"
+
+FLAGS=("${@}")
+
+RUN_DIR="xbs add ${FLAGS[@]}"
diff --git a/src/bin/db-repo-remove b/src/bin/db-repo-remove
index be2508d..e3c29dd 120000..100644
--- a/src/bin/db-repo-remove
+++ b/src/bin/db-repo-remove
@@ -1 +1,22 @@
-db-pkg-rm \ No newline at end of file
+#!/bin/bash
+# X Build System
+# Copyright (C) 2012-2015 Parabola Hackers <https://www.parabola.nu>
+
+# 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, either version 3 of the License, or
+# (at your option) any later version.
+
+# 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.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CONFIG_DIR="$(dirname "$(readlink -e "$0")")/etc"
+
+FLAGS=("${@}")
+
+RUN_DIR="xbs rm ${FLAGS[@]}"
diff --git a/src/bin/xbs b/src/bin/xbs
new file mode 100644
index 0000000..7b5bea6
--- /dev/null
+++ b/src/bin/xbs
@@ -0,0 +1,206 @@
+#!/bin/bash
+# X Build System
+# Copyright (C) 2012-2015 Parabola Hackers <https://www.parabola.nu>
+
+# 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, either version 3 of the License, or
+# (at your option) any later version.
+
+# 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.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+##############################################################
+
+xbs_error_platform-not-found() {
+ die "This %s plataform doesn't exist" "${plataform}"
+}
+
+xbs_rename-variable_platform-config() {
+ # Rename ("${_plataform}") to easily script usage
+ _platform="${_platform/\//+}"
+ _platform="${_platforms,,}"
+}
+
+xbs_source_platform-config() {
+ source "${PLATAFORM_CONFIG}"
+}
+
+xbs_variable_platform-config() {
+ PLATAFORM_CONFIG="${CONFIG_DIR}/xbs.d/${_platform}.cfg"
+}
+
+xbs-add() {
+ xbs-add_check-permission
+ xbs-pkg
+ for 'tarch' in "${tarches[@]}"; do
+ for 'pkg_file' in "${pkg_files[@]}"; do
+ if [[ ! -f "${repo_path}/${arch}/${pkg_file##*/}" ]]; then
+ die "Package file %s not found in %s" "${pkg_file##*/}" "${repo_path}/${arch}/"
+ else
+ msg "Adding %s to [%s]..." "${pkg_file}" "${repo}"
+ fi
+ done
+ pkg_repo_add "${repo}" "${tarch}" "${pkg_files[@]}"
+ repo_unlock "${repo}" "${tarch}"
+ done
+}
+
+xbs-add_check-permission() {
+ if ! check_repo_permission "${repo}"; then
+ die "You don't have permission to add packages to %s" "${repo}"
+ fi
+}
+
+xbs-init() {
+ mkdir -p -- "${PKG_MAIN_POOLS}" "${SRC_MAIN_POOLS}" "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR}" "${STAGING}"
+ # "${BIN_DIR}/db-repo-add" "${_platform}" "${PKG_REPOS[@]}"
+}
+
+xbs-pkg() {
+ repo_path="${REPO_DIR}/${repo}/os"
+ if [ "${arch}" == "{any}" ]; then
+ tarches=("${ARCHES[@]}")
+ else
+ tarches=("${arch}")
+ fi
+ for 'tarch' in "${tarches[@]}"; do
+ if [[ ! -d "${repo_path} ]]; then
+ die "This [%s] doesn't exist" "${repo}"
+ elif [[ ! -d "${repo_path}/${tarch}" ]]; then
+ die "This [%s] doesn't support %s archictecture" "${repo}" "${arch}"
+ else
+ repo_lock "${repo}" "${tarch}" || exit 1
+ fi
+ done
+}
+
+xbs-rm() {
+ xbs-rm_check-permission
+ xbs-pkg
+ for 'tarch' in "${tarches[@]}"; do
+ for 'pkg_name' in "${pkg_names[@]}"; do
+ msg "Removing %s from [%s]..." "${pkg_name}" "${repo}"
+ done
+ pkg_repo_rm "${repo}" "${tarch}" "${pkgnames[@]}"
+ repo_unlock "${repo}" "${tarch}"
+ done
+}
+
+xbs-rm_check-permission() {
+ if ! check_repo_permission "${repo}"; then
+ die "You don't have permission to remove packages to %s" "${repo}"
+ fi
+}
+
+
+xbs-sync() {
+
+}
+
+##############################################################
+
+CONFIG_DIR="$(dirname "$(readlink -e "$0")")/etc"
+
+source "${CONFIG_DIR}/xbs.cfg"
+source "${SHARE_DIR}/xbs-functions"
+
+if [ "${#}" -eq '0' ]; then
+ msg "usage: %s {add,init,rm,sync} <value> ..." "${0##*/}"
+fi
+
+rules=${1}
+
+case "${rules}" in
+ add)
+ # Add package to repository defined in config
+ if [ "${#}" -lt '5' ]; then
+ msg "usage: %s add <platform> <repo> <arch> <pkg_file> ..." "${0##*/}"
+ exit 1
+ }
+ platform="${2}"
+ repo="${3}"
+ arch="${4}"
+ pkg_files=("${@:5}")
+ for '_platform' in "${platforms[@]}"; do
+ xbs_rename-variable_platform-config
+ xbs_variable_platform-config
+ if [ -f "${PLATAFORM_CONFIG}" ]; then
+ xbs_source_platform-config
+ xbs-add
+ else
+ xbs_error_platform-not-found
+ fi
+ done
+ ;;
+ init)
+ # Creates the repository structure defined in config
+ platforms=("${@:2}")
+ if [ "${#}" -lt '2' ]; then
+ for '_platform' in "${PLATFORMS[@]}"; do
+ xbs_variable_platform-config
+ xbs_source_platform-config
+ xbs-init
+ done
+ else
+ for '_platform' in "${platforms[@]}"; do
+ xbs_rename-variable_platform-config
+ xbs_variable_platform-config
+ if [ -f "${PLATAFORM_CONFIG}" ]; then
+ xbs_source_platform-config
+ xbs-init
+ else
+ xbs_error_platform-not-found
+ fi
+ done
+ fi
+ ;;
+ rm|remove)
+ # Remove package to repository defined in config
+ if [ "${#}" -lt '5' ]; then
+ msg "usage: %s rm <platform> <repo> <arch> <pkg_name> ..." "${0##*/}"
+ exit 1
+ fi
+ platform="${2}"
+ repo="${3}"
+ arch="${4}"
+ pkg_names=("${@:5}")
+ for '_platform' in "${platforms[@]}"; do
+ xbs_rename-variable_platform-config
+ xbs_variable_platform-config
+ if [ -f "${PLATAFORM_CONFIG}" ]; then
+ xbs_source_platform-config
+ xbs-rm
+ else
+ xbs_error_platform-not-found
+ fi
+ done
+ ;;
+ sync|import)
+ # Import and sync the derivated repositories based on info contained in repo.db files
+ platforms=("${@:2}")
+ if [ "${#}" -lt '2' ]; then
+ for '_platform' in "${DD_PLATFORMS[@]}"; do
+ xbs_variable_platform-config
+ xbs_source_platform-config
+ xbs-sync
+ done
+ else
+ for '_platform' in "${platforms[@]}"; do
+ xbs_rename-variable_platform-config
+ xbs_variable_platform-config
+ if [ -f "${PLATAFORM_CONFIG}" && "${DISTRO_TYPE}" == 'derivated' ]; then
+ xbs_source_platform-config
+ xbs-sync
+ else
+ xbs_error_platform-not-found
+ fi
+ done
+ fi
+ ;;
+esac