Minor syntax cleanups for PKGBUILD output

pull/181/head
Jesus Alvarez 8 years ago
parent 7b3420e66b
commit 9136ed6c6f
  1. 37
      build.sh
  2. 13
      lib.sh
  3. 8
      repo.sh
  4. 2
      src/spl-utils/PKGBUILD.sh
  5. 10
      src/spl/PKGBUILD.sh
  6. 2
      src/zfs-dkms/PKGBUILD.sh
  7. 2
      src/zfs-utils/PKGBUILD.sh
  8. 2
      src/zfs/PKGBUILD.sh

@ -199,34 +199,45 @@ generate_package_files() {
build_packages() { build_packages() {
for pkg in "${pkg_list[@]}"; do for pkg in "${pkg_list[@]}"; do
# get version of any package that has been build previously # get version of any package that has been built previously
run_cmd_show_and_capture_output "ls \"${script_dir}/packages/${kernel_name}/${pkg}/\"${pkg}*.pkg.tar.xz | grep \"$pkg\" | grep -v \"headers\" | tail -1" run_cmd_show_and_capture_output "ls \"${script_dir}/packages/${kernel_name}/${pkg}/\"${pkg}*.pkg.tar.xz | grep \"$pkg\" | grep -v \"headers\" | tail -1"
pkg_path=${run_cmd_output} pkg_path=${run_cmd_output}
vers=$(package_version_from_path ${pkg_path})
if [[ ${pkg_path} == "" ]]; then
# get current version msg2 "No previously built packages exist for ${pkg}!"
eval $(source "${script_dir}/packages/${kernel_name}/${pkg}/PKGBUILD"; else
echo current_vers="${pkgver}"; vers=$(package_version_from_path ${pkg_path})
echo current_rel="${pkgrel}";
) # get current version
# stop if version has already been build eval $(source "${script_dir}/packages/${kernel_name}/${pkg}/PKGBUILD";
if [[ ${run_cmd_return} -eq 0 && ${vers} = ${current_vers}-${current_rel} ]]; then echo current_vers="${pkgver}";
msg "${pkg}=${vers} has already been build, skipping" echo current_rel="${pkgrel}";
continue )
# stop if version has already been built
if [[ ${run_cmd_return} -eq 0 && ${vers} == ${current_vers}-${current_rel} ]]; then
msg "${pkg}=${vers} has already been built, skipping"
continue
fi
fi fi
msg "Building ${pkg}..." msg "Building ${pkg}..."
# Cleanup all previously built packages for the current package
cleanup ${pkg} cleanup ${pkg}
run_cmd "cd \"${script_dir}/packages/${kernel_name}/${pkg}\" && ccm64 s && mksrcinfo" run_cmd "cd \"${script_dir}/packages/${kernel_name}/${pkg}\" && ccm64 s && mksrcinfo"
if [[ ${run_cmd_return} -ne 0 ]]; then if [[ ${run_cmd_return} -ne 0 ]]; then
error "A problem occurred building the package" error "A problem occurred building the package"
exit 1 exit 1
fi fi
# if [[ "${pkg}" == "zfs-utils-common" ]]; then # if [[ "${pkg}" == "spl-linux-hardened-git" ]]; then
# msg2 "${pkg} package files:" # msg2 "${pkg} package files:"
# run_cmd "tree ${chroot_path}/build/${pkg}/pkg" # run_cmd "tree ${chroot_path}/build/${pkg}/pkg"
# exit # exit
# fi # fi
exit 1
done done
run_cmd "find . -iname \"*.log\" -print -exec rm {} \\;" run_cmd "find . -iname \"*.log\" -print -exec rm {} \\;"
} }

@ -372,9 +372,15 @@ kernel_version_full() {
local arg=$1 local arg=$1
if ! kernel_version_has_minor_version $1; then if ! kernel_version_has_minor_version $1; then
debug "kernel_version_full: Have kernel without minor version!" debug "kernel_version_full: Have kernel without minor version!"
# Kernel version has the format 3.14, so add a 0. if [[ ${1} =~ ^([[:digit:]]+\.[[:digit:]]+)\.?([[:alpha:][:digit:]]+)?\-([[:digit:]]+) ]]; then
local arg=$(echo ${arg} | cut -f1 -d-) local arg=${BASH_REMATCH[1]}
local rev=$(echo ${1} | cut -f2 -d-) local minor=${BASH_REMATCH[2]}
local rev=${BASH_REMATCH[3]}
if [[ ${minor} =~ ^[[:alpha:]]+ ]]; then
printf "${arg}.0.${minor}-${rev}"
return 0
fi
fi
printf "${arg}.0-${rev}" printf "${arg}.0-${rev}"
return 0 return 0
fi fi
@ -755,6 +761,7 @@ pkgbuild_cleanup() {
sed -i '/^\s*$/d' $1 sed -i '/^\s*$/d' $1
sed -i 's/"\ )$/")/g' $1 sed -i 's/"\ )$/")/g' $1
# Readd blanklines above build and package # Readd blanklines above build and package
sed -i '/^pkgver\(\)/{x;p;x;}' $1
sed -i '/^build\(\)/{x;p;x;}' $1 sed -i '/^build\(\)/{x;p;x;}' $1
sed -i '/^package\(\)/{x;p;x;}' $1 sed -i '/^package\(\)/{x;p;x;}' $1
} }

@ -186,7 +186,7 @@ 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 ipkg in ${package_list[@]}; do for ipkg in ${package_list[@]}; do
IFS=';' read -a pkgopt <<< "${ipkg}" IFS=';' read -a pkgopt <<< "${ipkg}"
@ -195,16 +195,16 @@ repo_package_backup() {
vers="${pkgopt[1]}" vers="${pkgopt[1]}"
pkgp="${pkgopt[2]}" pkgp="${pkgopt[2]}"
dest="${pkgopt[3]}" dest="${pkgopt[3]}"
debug "pkg: ${name}" 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
pkgs+=("$o -regextype egrep -regex '.*${name}-[a-z0-9\.\_]+-[0-9]+-x86_64.pkg.tar.xz'") pkgs+=("$o -regextype egrep -regex '.*${name}-[a-z0-9\.\_]+-[0-9]+-x86_64.pkg.tar.xz'")
done done
# only run find, if new packages will be copied # only run find, if new packages will be copied
if [[ ! ${#pkgs[@]} -eq 0 ]]; then if [[ ! ${#pkgs[@]} -eq 0 ]]; then
run_cmd_show_and_capture_output_no_dry_run "find ${repo_target} -type f ${pkgs[@]}" run_cmd_show_and_capture_output_no_dry_run "find ${repo_target} -type f ${pkgs[@]}"

@ -31,7 +31,7 @@ package() {
EOF EOF
if [[ ${archzfs_package_group} =~ -git$ ]]; then if [[ ${archzfs_package_group} =~ -git$ ]]; then
sed -i "/^build()/ i pkgver() { \n cd \"${spl_workdir}\" \n git describe --long | sed 's/^spl-//;s/\\\([^-]*-g\\\)/r\\\1/;s/-/./g' \n}" ${spl_utils_pkgbuild_path}/PKGBUILD sed -i "/^build()/i pkgver() { cd \"${spl_workdir}\"\n git describe --long | sed 's/^spl-//;s/\\\([^-]*-g\\\)/r\\\1/;s/-/./g'\n}" ${spl_utils_pkgbuild_path}/PKGBUILD
fi fi
pkgbuild_cleanup "${spl_utils_pkgbuild_path}/PKGBUILD" pkgbuild_cleanup "${spl_utils_pkgbuild_path}/PKGBUILD"

@ -31,11 +31,11 @@ package_${spl_pkgname}() {
groups=("${archzfs_package_group}") groups=("${archzfs_package_group}")
conflicts=(${spl_conflicts}) conflicts=(${spl_conflicts})
${spl_replaces} ${spl_replaces}
cd "${spl_workdir}" cd "${spl_workdir}"
make DESTDIR="\${pkgdir}" install make DESTDIR="\${pkgdir}" install
mv "\${pkgdir}/lib" "\${pkgdir}/usr/" mv "\${pkgdir}/lib" "\${pkgdir}/usr/"
# Remove src dir # Remove src dir
rm -r "\${pkgdir}"/usr/src rm -r "\${pkgdir}"/usr/src
} }
@ -43,11 +43,11 @@ package_${spl_pkgname}() {
package_${spl_pkgname}-headers() { package_${spl_pkgname}-headers() {
pkgdesc="Solaris Porting Layer kernel headers." pkgdesc="Solaris Porting Layer kernel headers."
conflicts=(${spl_headers_conflicts}) conflicts=(${spl_headers_conflicts})
cd "${spl_workdir}" cd "${spl_workdir}"
make DESTDIR="\${pkgdir}" install make DESTDIR="\${pkgdir}" install
rm -r "\${pkgdir}/lib" rm -r "\${pkgdir}/lib"
# Remove reference to \${srcdir} # Remove reference to \${srcdir}
sed -i "s+\${srcdir}++" \${pkgdir}/usr/src/spl-*/${kernel_mod_path}/Module.symvers sed -i "s+\${srcdir}++" \${pkgdir}/usr/src/spl-*/${kernel_mod_path}/Module.symvers
} }
@ -55,7 +55,7 @@ package_${spl_pkgname}-headers() {
EOF EOF
if [[ ${archzfs_package_group} =~ -git$ ]]; then if [[ ${archzfs_package_group} =~ -git$ ]]; then
sed -i "/^build()/ i pkgver() { \n cd \"${spl_workdir}\" \n echo \$(git describe --long | sed 's/^spl-//;s/\\\([^-]*-g\\\)/r\\\1/;s/-/./g').${kernel_version_full_pkgver} \n}" ${spl_pkgbuild_path}/PKGBUILD sed -i "/^build()/i pkgver() {\n cd \"${spl_workdir}\"\n echo \$(git describe --long | sed 's/^spl-//;s/\\\([^-]*-g\\\)/r\\\1/;s/-/./g').${kernel_version_full_pkgver}\n}" ${spl_pkgbuild_path}/PKGBUILD
fi fi
pkgbuild_cleanup "${spl_pkgbuild_path}/PKGBUILD" pkgbuild_cleanup "${spl_pkgbuild_path}/PKGBUILD"

@ -46,7 +46,7 @@ package() {
EOF EOF
if [[ ${archzfs_package_group} =~ -git$ ]]; then if [[ ${archzfs_package_group} =~ -git$ ]]; then
sed -i "/^build()/ i pkgver() { \n cd \"${zfs_workdir}\" \n git describe --long | sed 's/^zfs-//;s/\\\([^-]*-g\\\)/r\\\1/;s/-/./g' \n}" ${zfs_dkms_pkgbuild_path}/PKGBUILD sed -i "/^build()/i pkgver() {\n cd \"${zfs_workdir}\"\n git describe --long | sed 's/^zfs-//;s/\\\([^-]*-g\\\)/r\\\1/;s/-/./g'\n}" ${zfs_dkms_pkgbuild_path}/PKGBUILD
fi fi
pkgbuild_cleanup "${zfs_dkms_pkgbuild_path}/PKGBUILD" pkgbuild_cleanup "${zfs_dkms_pkgbuild_path}/PKGBUILD"

@ -59,7 +59,7 @@ package() {
EOF EOF
if [[ ${archzfs_package_group} =~ -git$ ]]; then if [[ ${archzfs_package_group} =~ -git$ ]]; then
sed -i "/^build()/ i pkgver() { \n cd \"${zfs_workdir}\" \n git describe --long | sed 's/^zfs-//;s/\\\([^-]*-g\\\)/r\\\1/;s/-/./g' \n}" ${zfs_utils_pkgbuild_path}/PKGBUILD sed -i "/^build()/i pkgver() {\n cd \"${zfs_workdir}\"\n git describe --long | sed 's/^zfs-//;s/\\\([^-]*-g\\\)/r\\\1/;s/-/./g'\n}" ${zfs_utils_pkgbuild_path}/PKGBUILD
fi fi
pkgbuild_cleanup "${zfs_utils_pkgbuild_path}/PKGBUILD" pkgbuild_cleanup "${zfs_utils_pkgbuild_path}/PKGBUILD"

@ -57,7 +57,7 @@ package_${zfs_pkgname}-headers() {
EOF EOF
if [[ ${archzfs_package_group} =~ -git$ ]]; then if [[ ${archzfs_package_group} =~ -git$ ]]; then
sed -i "/^build()/ i pkgver() { \n cd \"${zfs_workdir}\" \n echo \$(git describe --long | sed 's/^zfs-//;s/\\\([^-]*-g\\\)/r\\\1/;s/-/./g').${kernel_version_full_pkgver} \n}" ${zfs_pkgbuild_path}/PKGBUILD sed -i "/^build()/i pkgver() {\n cd \"${zfs_workdir}\"\n echo \$(git describe --long | sed 's/^zfs-//;s/\\\([^-]*-g\\\)/r\\\1/;s/-/./g').${kernel_version_full_pkgver}\n}" ${zfs_pkgbuild_path}/PKGBUILD
fi fi
pkgbuild_cleanup "${zfs_pkgbuild_path}/PKGBUILD" pkgbuild_cleanup "${zfs_pkgbuild_path}/PKGBUILD"

Loading…
Cancel
Save