Merge pull request #180 from minextu/repo.sh-fix

repo.sh fixes
pull/181/head
Jesus Alvarez 8 years ago committed by GitHub
commit b9d61cce24
  1. 32
      repo.sh

@ -164,6 +164,12 @@ repo_package_list() {
fi fi
fi fi
# check if package version is already in repo
if [ -f "${repo_target}/${arch}/${name}-${vers}-${arch}.pkg.tar.xz" ]; then
msg2 "Package ${name}=${vers} already in repo. Skipping"
continue
fi
debug "Using: pkgname: ${name} pkgver: ${vers} pkgpath: ${pkg} pkgdest: ${repo_target}/${arch}" debug "Using: pkgname: ${name} pkgver: ${vers} pkgpath: ${pkg} pkgdest: ${repo_target}/${arch}"
package_list+=("${name};${vers};${pkg};${repo_target}/${arch}") package_list+=("${name};${vers};${pkg};${repo_target}/${arch}")
@ -180,23 +186,28 @@ repo_package_list() {
repo_package_backup() { repo_package_backup() {
msg "Getting a list of packages to backup..." msg "Getting a list of packages to backup..."
local pkgs=() local pkgs=()
for pkg in ${pkg_list[@]}; do for ipkg in ${package_list[@]}; do
debug "pkg: ${pkg}" IFS=';' read -a pkgopt <<< "${ipkg}"
name="${pkgopt[0]}"
vers="${pkgopt[1]}"
pkgp="${pkgopt[2]}"
dest="${pkgopt[3]}"
debug "pkg: ${name}"
local o="" local o=""
if [[ ${#pkgs[@]} -ne 0 ]]; then if [[ ${#pkgs[@]} -ne 0 ]]; then
local o="-o" local o="-o"
fi fi
if [[ ${pkg} =~ .*-git$ ]]; then
pkgs+=("${o} -iname '*git*' -regextype egrep -regex '.*${pkg}-(headers-)*[a-z0-9\.\_\-]+-x86_64.pkg.tar.xz'") pkgs+=("$o -regextype egrep -regex '.*${name}-[a-z0-9\.\_]+-[0-9]+-x86_64.pkg.tar.xz'")
elif [[ ${pkg} =~ .*-hardened$ ]]; then
pkgs+=("${o} -not -iname '*git*' -regextype egrep -regex '.*${pkg}-(headers-)*[a-z0-9\.\_\-]+-x86_64.pkg.tar.xz'")
else
pkgs+=("${o} -not -iname '*git*' -regextype egrep -regex '.*${pkg}-(headers-)*[0-9\.\_\-]+-x86_64.pkg.tar.xz'")
fi
done done
run_cmd_show_and_capture_output_no_dry_run "find ${repo_target} -type f -iname '*git*' ${pkgs[@]}" # only run find, if new packages will be copied
if [[ ! ${#pkgs[@]} -eq 0 ]]; then
run_cmd_show_and_capture_output_no_dry_run "find ${repo_target} -type f ${pkgs[@]}"
for x in ${run_cmd_output}; do for x in ${run_cmd_output}; do
debug "Evaluating ${x}" debug "Evaluating ${x}"
@ -209,6 +220,7 @@ repo_package_backup() {
debug "backing up package: ${epkg}" debug "backing up package: ${epkg}"
package_exist_list+=("${epkg}") package_exist_list+=("${epkg}")
done done
fi
if [[ ${#package_exist_list[@]} -eq 0 ]]; then if [[ ${#package_exist_list[@]} -eq 0 ]]; then
msg2 "No packages found for backup." msg2 "No packages found for backup."

Loading…
Cancel
Save