repo.sh: Fix support for archiso repo

* Check existing core repo for packages
* Change package file operations back to cp commands
pull/26/head
Jesus Alvarez 11 years ago
parent 128b1a1fd2
commit d47d7a657e
  1. 62
      repo.sh

@ -112,6 +112,9 @@ if [[ "${#pkgs[@]}" -eq 0 ]]; then
# Get packages from the backup directory if the repo is demz-repo-archiso # Get packages from the backup directory if the repo is demz-repo-archiso
if [[ $AZB_REPO == "demz-repo-archiso" ]]; then if [[ $AZB_REPO == "demz-repo-archiso" ]]; then
fcmd_out=$(find ${AZB_PACKAGE_BACKUP_DIR} -iname "*${AZB_KERNEL_ARCHISO_VERSION}*.pkg.tar.xz") fcmd_out=$(find ${AZB_PACKAGE_BACKUP_DIR} -iname "*${AZB_KERNEL_ARCHISO_VERSION}*.pkg.tar.xz")
if [[ $fcmd_out == "" ]]; then
fcmd_out=$(find ${AZB_REPO_BASEPATH}/demz-repo-core -iname "*${AZB_KERNEL_ARCHISO_VERSION}*.pkg.tar.xz")
fi
else else
fcmd_out=$(find ${path_glob} -iname "*${AZB_KERNEL_VERSION}*.pkg.tar.xz") fcmd_out=$(find ${path_glob} -iname "*${AZB_KERNEL_VERSION}*.pkg.tar.xz")
fi fi
@ -169,7 +172,11 @@ if [[ $AZB_REPO != "" ]]; then
debug "Using: pkgname: $name\n\t\t pkgver: $vers\n\t\t pkgpath: $pkg\n\t\t pkgdest: $AZB_REPO_TARGET/$arch" debug "Using: pkgname: $name\n\t\t pkgver: $vers\n\t\t pkgpath: $pkg\n\t\t pkgdest: $AZB_REPO_TARGET/$arch"
pkg_list+=("$name;$vers;$pkg;$AZB_REPO_TARGET/$arch") pkg_list+=("$name;$vers;$pkg;$AZB_REPO_TARGET/$arch")
litem="$name/$name-$vers.src.tar.gz;$AZB_REPO_TARGET/$arch" if [[ $AZB_REPO == "demz-repo-archiso" ]]; then
litem="$AZB_REPO_BASEPATH/demz-repo-core/$arch/$name-$vers.src.tar.gz;$AZB_REPO_TARGET/$arch"
else
litem="$name/$name-$vers.src.tar.gz;$AZB_REPO_TARGET/$arch"
fi
debug "Source: srcname: $name-$vers.src.tar.gz\n\t\t srcdest: $AZB_REPO_TARGET/$arch" debug "Source: srcname: $name-$vers.src.tar.gz\n\t\t srcdest: $AZB_REPO_TARGET/$arch"
pkg_src_list+=($litem) pkg_src_list+=($litem)
done done
@ -180,7 +187,7 @@ if [[ $AZB_REPO != "" ]]; then
fi fi
exist_pkg_mv_list=() exist_pkg_mv_list=()
new_pkg_mv_list=() new_pkg_cp_list=()
pkg_add_list=() pkg_add_list=()
src_mv_list=() src_mv_list=()
@ -207,41 +214,64 @@ if [[ $AZB_REPO != "" ]]; then
fi fi
done done
new_pkg_mv_list+=("$pkgp*;$repo") # The * is to catch the signature
new_pkg_cp_list+=("$pkgp*;$repo")
bname=$(basename $pkgp) bname=$(basename $pkgp)
pkg_add_list+=("$repo/$bname;$repo") pkg_add_list+=("$repo/$bname;$repo")
done done
# Remove duplicate src packages
for ((i = 0; i < ${#exist_pkg_mv_list[@]}; i++)); do
bname=$(basename ${exist_pkg_mv_list[$i]})
if [[ $bname != *src.tar.gz ]]; then
continue
fi
for pkg2 in ${exist_pkg_mv_list[@]}; do
bname2=$(basename $pkg2)
if [[ $bname2 != *src.tar.gz ]]; then
continue
fi
if [[ $bname == $bname2 ]]; then
unset $exist_pkg_mv_list[$i]
fi
done
done
msg "Performing file operations..." msg "Performing file operations..."
if [[ ${#exist_pkg_mv_list[@]} -gt 0 ]]; then if [[ ${#exist_pkg_mv_list[@]} -gt 0 && $AZB_REPO != "demz-repo-archiso" ]]; then
msg2 "Move old packages and sources to backup directory" msg2 "Move old packages and sources to backup directory"
run_cmd "mv -f ${exist_pkg_mv_list[*]} $AZB_PACKAGE_BACKUP_DIR/" run_cmd "mv -f ${exist_pkg_mv_list[*]} $AZB_PACKAGE_BACKUP_DIR/"
elif [[ ${#exist_pkg_mv_list[@]} -gt 0 && $AZB_REPO == "demz-repo-archiso" ]]; then
# We don't need the archiso repo packages because they are already in
# the backup directory.
run_cmd "rm -f ${exist_pkg_mv_list[*]}"
fi fi
for arch in "i686" "x86_64"; do for arch in "i686" "x86_64"; do
msg "Copying the new $arch packages and sources to the repo..." msg "Copying the new $arch packages to the repo..."
mv_list="" # The packages to copy in one string cp_list="" # The packages to copy in one string
ra_list="" # The packages to add to the repo in one string ra_list="" # The packages to add to the repo in one string
repo="" # The destination repo repo="" # The destination repo
# Create the command file lists from the arrays # Create the command file lists from the arrays
for pkg in "${new_pkg_mv_list[@]}"; do for pkg in "${new_pkg_cp_list[@]}"; do
if [[ "$pkg" == *$arch* ]]; then if [[ "$pkg" == *$arch* ]]; then
mv_list="$mv_list "$(echo "$pkg" | cut -d \; -f 1) cp_list="$cp_list "$(echo "$pkg" | cut -d \; -f 1)
repo=$(echo "$pkg" | cut -d \; -f 2) repo=$(echo "$pkg" | cut -d \; -f 2)
ra=$(echo "$pkg" | cut -d \; -f 1 | xargs basename) ra=$(echo "$pkg" | cut -d \; -f 1 | xargs basename)
ra_list="$ra_list $repo/${ra%?}" ra_list="$ra_list $repo/${ra%?}"
fi fi
done done
if [[ $mv_list == "" ]]; then if [[ $cp_list == "" ]]; then
warning "No packages to move!" warning "No packages to copy!"
continue continue
fi fi
run_cmd "mv $mv_list $repo/"
run_cmd "cp -f $cp_list $repo/"
run_cmd "repo-add -k $AZB_GPG_SIGN_KEY -s -v -f $repo/${AZB_REPO}.db.tar.xz $ra_list" run_cmd "repo-add -k $AZB_GPG_SIGN_KEY -s -v -f $repo/${AZB_REPO}.db.tar.xz $ra_list"
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
@ -254,17 +284,17 @@ if [[ $AZB_REPO != "" ]]; then
# Copy package sources # Copy package sources
msg "Copy package sources" msg "Copy package sources"
for arch in "i686" "x86_64"; do for arch in "i686" "x86_64"; do
src_mv_list=() src_cp_list=()
for src in "${pkg_src_list[@]}"; do for src in "${pkg_src_list[@]}"; do
if [[ "$src" == *$arch* ]]; then if [[ "$src" == *$arch* ]]; then
src_mv_list="$src_mv_list "$(echo "$src" | cut -d \; -f 1) src_cp_list="$src_cp_list "$(echo "$src" | cut -d \; -f 1)
repo=$(echo "$src" | cut -d \; -f 2) repo=$(echo "$src" | cut -d \; -f 2)
fi fi
done done
run_cmd "cp $src_mv_list $repo/" run_cmd "cp $src_cp_list $repo/"
if [[ $arch == "x86_64" ]]; then if [[ $arch == "x86_64" && $AZB_REPO != "demz-repo-archiso" ]]; then
# Delete the package sources # Delete the package sources
run_cmd "rm $src_mv_list" run_cmd "rm $src_cp_list"
fi fi
done done
fi fi

Loading…
Cancel
Save