From fe21e760f1e5918a013c805562c6ed74f25eb8b0 Mon Sep 17 00:00:00 2001 From: Jesus Alvarez Date: Sun, 29 Jan 2017 20:39:17 -0800 Subject: [PATCH] Fix archzfs-qemu-git-test-00-bootfs --- repo.sh | 16 +++++- testing/README.rst | 6 +-- testing/test.sh | 4 +- testing/tests/archzfs-qemu-base/setup.sh | 8 +-- .../README.rst | 52 ------------------- .../archiso.sh | 2 +- .../archzfs-qemu-git-test-00-bootfs/conf.sh | 4 +- .../archzfs-qemu-git-test-00-bootfs/pacman.sh | 4 ++ .../archiso.sh | 2 +- .../archzfs-qemu-lts-test-00-bootfs/conf.sh | 4 +- .../archzfs-qemu-lts-test-00-bootfs/pacman.sh | 3 ++ .../archiso.sh | 2 +- .../archzfs-qemu-std-test-00-bootfs/conf.sh | 4 +- .../archzfs-qemu-std-test-00-bootfs/pacman.sh | 3 ++ .../archiso.sh | 2 +- .../archzfs-qemu-std-test-00-default/conf.sh | 4 +- .../pacman.sh | 3 ++ 17 files changed, 49 insertions(+), 74 deletions(-) delete mode 100644 testing/tests/archzfs-qemu-git-test-00-bootfs/README.rst diff --git a/repo.sh b/repo.sh index 6f9f5a3..01bf7b9 100755 --- a/repo.sh +++ b/repo.sh @@ -13,6 +13,7 @@ repo_name="" # The destination repo for the packages package_list=() # A list of packages to add. Array items are in the form of "name;pkg.tar.xz;repo_path". package_src_list=() # A list of package sources to move package_exist_list=() +haz_error=0 if ! source ${script_dir}/lib.sh; then @@ -128,8 +129,17 @@ repo_package_list() { fi debug "Version match check: arch: ${arch} name: ${name} vers: ${vers} vers_match: ${match}" - if ! [[ ${vers} =~ ^${match} ]]; then + if ! [[ ${vers} =~ ^${match} ]] ; then debug "Version mismatch!" + if [[ ${name} =~ .*-git ]]; then + error "Attempting to add Git packages that are out of date!" + error "package version from filesystem: ${vers}" + error "calculated version from git: ${match}" + haz_error=1 + if [[ ${dry_run} -ne 1 ]]; then + exit 1 + fi + fi continue fi @@ -260,3 +270,7 @@ for func in ${update_funcs[@]}; do repo_package_backup repo_add done + +if [[ ${haz_error} -ne 0 ]]; then + warning "An error has been detected! Inspect output above closely..." +fi diff --git a/testing/README.rst b/testing/README.rst index 29b9724..9285a2d 100644 --- a/testing/README.rst +++ b/testing/README.rst @@ -1,7 +1,7 @@ ===================== archzfs testing guide ===================== -:Modified: Sat Sep 17 00:43 2016 +:Modified: Sun Jan 29 14:08 2017 -------- Overview @@ -229,8 +229,8 @@ If all of these criteria are met, the test is a success. Another key area I am going to look at is the changes made to the systemd scripts reported by bronek via https://github.com/archzfs/archzfs/issues/72. How will these changes impact -Deployng the archzfs-linux packages to the archzfs-testing repo -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +Deploying the archzfs-linux packages to the archzfs-testing repo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ This is the easiest part, all that needed to be done was to increment the version number in `src/kernels/linux.sh` and build using `./build.sh std update make -u -U` once this was done the packages were added to the `archzfs-testing` repo using diff --git a/testing/test.sh b/testing/test.sh index 5ace6b2..0f39a9f 100755 --- a/testing/test.sh +++ b/testing/test.sh @@ -63,8 +63,8 @@ archiso_build() { archiso_init_vars() { - export archiso_iso_name=$(find ${packer_work_dir}/ -iname "archlinux*.iso" | xargs basename) - export archiso_sha=$(sha1sum ${packer_work_dir}/${archiso_iso_name} | awk '{ print $1 }') + export archiso_iso_name=$(find ${packer_work_dir}/ -iname "archlinux*.iso" | xargs basename 2> /dev/null ) + export archiso_sha=$(sha1sum ${packer_work_dir}/${archiso_iso_name} 2> /dev/null | awk '{ print $1 }') export archiso_url="${packer_work_dir}/${archiso_iso_name}" debug "archiso_iso_name=${archiso_iso_name}" debug "archiso_sha=${archiso_sha}" diff --git a/testing/tests/archzfs-qemu-base/setup.sh b/testing/tests/archzfs-qemu-base/setup.sh index 52d629b..8ce5f3a 100644 --- a/testing/tests/archzfs-qemu-base/setup.sh +++ b/testing/tests/archzfs-qemu-base/setup.sh @@ -10,6 +10,10 @@ if ! source ${script_dir}/lib.sh; then fi +export debug_flag=1 +export dry_run=0 + + # source_safe "${script_dir}/archzfs-conf.sh" source_safe "${script_dir}/test-conf.sh" source_safe "${script_dir}/test-archiso.sh" @@ -20,10 +24,6 @@ source_safe "${script_dir}/test-hooks.sh" source_safe "${script_dir}/test-pacman.sh" -export debug_flag=1 -export dry_run=0 - - # Install nfs mount points to the archiso environment test_fs_config_nfs diff --git a/testing/tests/archzfs-qemu-git-test-00-bootfs/README.rst b/testing/tests/archzfs-qemu-git-test-00-bootfs/README.rst deleted file mode 100644 index b9a8159..0000000 --- a/testing/tests/archzfs-qemu-git-test-00-bootfs/README.rst +++ /dev/null @@ -1,52 +0,0 @@ -========================================= -Test archzfs-qemu-lts-test-01-root-bootfs -========================================= - -Tests all the steps required for archzfs-linux-lts to be used as a boot filesystem. - --------- -Overview --------- - -Builds a custom archiso with the linux-lts kernel used by packer to create a Qemu base image. Syslinux is used as the boot -loader. - ---- -How ---- - -1. The archzfs-linux-lts packages are built for the linux-lts kernel and added to a package repository named "archzfs-testing". - -#. The archzfs-testing repo is shared over NFS. - -#. A custom archiso is built that boots into the linux-lts kernel. See `Archiso customization`_ - -#. The test files are compressed into a tar archive. - -#. Packer is used to build a qemu base image using the custom archiso. - -#. `setup.sh` is ran in the archiso to install arch on ZFS. - -#. After installation of Arch on ZFS, the VM is rebooted and packer finalizes the base image. - -#. The qemu base image created by packer is booted, if the boot is successful, the test is considered passed. - ---------------------- -Archiso customization ---------------------- - -At the time of putting this test together (2016.09.03), there was no stable ZFSonLinux release that supported kernel 4.7 and -the archiso release at the time shipped with kernel 4.7. In order to install Arch on ZFS for test, I needed an archiso with -the linux-lts kernel. Thus, the archzfs-archiso was born! - -The archiso is built by `test.sh` and used by packer to create a Qemu base image with ZFS as the root filesystem for testing. - -The archiso comes with a bunch of features that are not needed in test, so they have been stripped out or modified. This -includes: - -* boot straight into the linux-lts kernel to speed up the testing cycle. -* ZFS does not support arch-i686, so it was stripped. -* iPXE was not needed. - -The archiso sources are copied from `/usr/share/archiso/configs/releng` after installation of the "archiso" package. The -modifed code is contained in the `testing/archiso-linux-lts` directory of this project. diff --git a/testing/tests/archzfs-qemu-git-test-00-bootfs/archiso.sh b/testing/tests/archzfs-qemu-git-test-00-bootfs/archiso.sh index cba15ae..e19ac43 100644 --- a/testing/tests/archzfs-qemu-git-test-00-bootfs/archiso.sh +++ b/testing/tests/archzfs-qemu-git-test-00-bootfs/archiso.sh @@ -6,7 +6,7 @@ test_build_archiso() { run_cmd "rm -rf ${test_root_dir}/archiso/out/archlinux*" fi run_cmd "./build.sh -v" - msg2 "Coping archiso to packer_work_dir" + msg2 "Copying archiso to packer_work_dir" run_cmd "cp ${test_root_dir}/../../../archiso/out/archlinux* ${packer_work_dir} && rm -rf ${test_root_dir}/archiso/work" cd - &> /dev/null } diff --git a/testing/tests/archzfs-qemu-git-test-00-bootfs/conf.sh b/testing/tests/archzfs-qemu-git-test-00-bootfs/conf.sh index c2ed44a..d50aeb7 100644 --- a/testing/tests/archzfs-qemu-git-test-00-bootfs/conf.sh +++ b/testing/tests/archzfs-qemu-git-test-00-bootfs/conf.sh @@ -10,8 +10,8 @@ export test_archzfs_repo_name="archzfs-testing" # Additional packages to install in the archiso export test_archiso_packages="archzfs-linux-lts" -# Additional packages to install in the archiso -export test_chroot_packages="$(> ${arch_target_dir}/etc/pacman.conf @@ -34,6 +37,7 @@ test_pacman_config() { test_pacman_pacstrap() { msg "bootstrapping the base installation" + debug "TEST_CHROOT_PACKAGES: ${test_chroot_packages}" run_cmd "/usr/bin/pacstrap -c '${test_target_dir}/ROOT' base base-devel ${test_chroot_packages}" run_cmd_check 1 } diff --git a/testing/tests/archzfs-qemu-lts-test-00-bootfs/archiso.sh b/testing/tests/archzfs-qemu-lts-test-00-bootfs/archiso.sh index 02bb4dd..6a06cd9 100644 --- a/testing/tests/archzfs-qemu-lts-test-00-bootfs/archiso.sh +++ b/testing/tests/archzfs-qemu-lts-test-00-bootfs/archiso.sh @@ -10,7 +10,7 @@ test_build_archiso() { run_cmd "rm -rf ${test_root_dir}/archiso/out/archlinux*" fi run_cmd "./build.sh -v" - msg2 "Coping archiso to packer_work_dir" + msg2 "Copying archiso to packer_work_dir" run_cmd "cp ${test_root_dir}/../../../archiso/out/archlinux* ${packer_work_dir} && rm -rf ${test_root_dir}/archiso/work" cd - &> /dev/null } diff --git a/testing/tests/archzfs-qemu-lts-test-00-bootfs/conf.sh b/testing/tests/archzfs-qemu-lts-test-00-bootfs/conf.sh index 6f297a8..afcfa04 100644 --- a/testing/tests/archzfs-qemu-lts-test-00-bootfs/conf.sh +++ b/testing/tests/archzfs-qemu-lts-test-00-bootfs/conf.sh @@ -10,8 +10,8 @@ export test_archzfs_repo_name="archzfs-testing" # Additional packages to install in the archiso export test_archiso_packages="archzfs-linux-lts" -# Additional packages to install in the archiso -export test_chroot_packages="$(> ${arch_target_dir}/etc/pacman.conf diff --git a/testing/tests/archzfs-qemu-std-test-00-bootfs/archiso.sh b/testing/tests/archzfs-qemu-std-test-00-bootfs/archiso.sh index cba15ae..e19ac43 100644 --- a/testing/tests/archzfs-qemu-std-test-00-bootfs/archiso.sh +++ b/testing/tests/archzfs-qemu-std-test-00-bootfs/archiso.sh @@ -6,7 +6,7 @@ test_build_archiso() { run_cmd "rm -rf ${test_root_dir}/archiso/out/archlinux*" fi run_cmd "./build.sh -v" - msg2 "Coping archiso to packer_work_dir" + msg2 "Copying archiso to packer_work_dir" run_cmd "cp ${test_root_dir}/../../../archiso/out/archlinux* ${packer_work_dir} && rm -rf ${test_root_dir}/archiso/work" cd - &> /dev/null } diff --git a/testing/tests/archzfs-qemu-std-test-00-bootfs/conf.sh b/testing/tests/archzfs-qemu-std-test-00-bootfs/conf.sh index 892c194..86e273a 100644 --- a/testing/tests/archzfs-qemu-std-test-00-bootfs/conf.sh +++ b/testing/tests/archzfs-qemu-std-test-00-bootfs/conf.sh @@ -10,8 +10,8 @@ export test_archzfs_repo_name="archzfs-testing" # Additional packages to install in the archiso export test_archiso_packages="archzfs-linux-lts" -# Additional packages to install in the archiso -export test_chroot_packages="$(> ${arch_target_dir}/etc/pacman.conf diff --git a/testing/tests/archzfs-qemu-std-test-00-default/archiso.sh b/testing/tests/archzfs-qemu-std-test-00-default/archiso.sh index 02bb4dd..6a06cd9 100644 --- a/testing/tests/archzfs-qemu-std-test-00-default/archiso.sh +++ b/testing/tests/archzfs-qemu-std-test-00-default/archiso.sh @@ -10,7 +10,7 @@ test_build_archiso() { run_cmd "rm -rf ${test_root_dir}/archiso/out/archlinux*" fi run_cmd "./build.sh -v" - msg2 "Coping archiso to packer_work_dir" + msg2 "Copying archiso to packer_work_dir" run_cmd "cp ${test_root_dir}/../../../archiso/out/archlinux* ${packer_work_dir} && rm -rf ${test_root_dir}/archiso/work" cd - &> /dev/null } diff --git a/testing/tests/archzfs-qemu-std-test-00-default/conf.sh b/testing/tests/archzfs-qemu-std-test-00-default/conf.sh index a1eced0..86e273a 100644 --- a/testing/tests/archzfs-qemu-std-test-00-default/conf.sh +++ b/testing/tests/archzfs-qemu-std-test-00-default/conf.sh @@ -10,8 +10,8 @@ export test_archzfs_repo_name="archzfs-testing" # Additional packages to install in the archiso export test_archiso_packages="archzfs-linux-lts" -# Additional packages to install after base and base-devel -export test_chroot_packages="$(> ${arch_target_dir}/etc/pacman.conf