diff --git a/tests/parsers.py b/tests/parsers.py new file mode 100644 index 0000000..dc9fd6a --- /dev/null +++ b/tests/parsers.py @@ -0,0 +1,228 @@ +# -*- coding: utf-8 -*- +import os +import sys +sys.path.insert(0,'.') +sys.path.insert(0,'..') +import unittest + +from molecule.settings import SpecParser +from molecule.compat import get_stringtype + +class ParsersTest(unittest.TestCase): + + def setUp(self): + sys.stdout.write("%s called\n" % (self,)) + sys.stdout.flush() + + def tearDown(self): + """ + tearDown is run after each test + """ + sys.stdout.write("%s ran\n" % (self,)) + sys.stdout.flush() + + def test_iso_remaster(self): + + from molecule.specs.plugins.remaster_plugin import RemasterSpec + + expected_data = { + 'paths_to_remove': ['/this/and/that', '/that/and/this'], + 'post_iso_script': ['/sabayon/scripts/post_iso_script.sh'], + 'iso_title': 'Sabayon KDE', + 'extra_mkisofs_parameters': ['-b', 'isolinux/isolinux.bin', '-c', + 'isolinux/boot.cat'], + 'release_version': '5.3', + 'source_iso': 'specs/data/Sabayon_Linux_SpinBase_DAILY_x86.iso', + '__plugin__': None, + 'destination_iso_image_name': 'Sabayon_Linux_5.3_x86_TEST.iso', + 'release_desc': 'x86 TEST', + 'packages_to_remove': ['app-foo/foo', 'app-foo2/foo2'], + 'pre_iso_script': ['/sabayon/scripts/generic_pre_iso_script.sh', + 'KDE'], + 'custom_packages_add_cmd': ['equo', 'install', '--ask'], + 'packages_to_add': ['app-admin/packagekit-base', + 'app-admin/packagekit-qt4', 'app-admin/sulfur'], + 'release_file': '/etc/sabayon-edition', + 'outer_chroot_script': ['/sabayon/scripts/remaster_pre.sh'], + 'execute_repositories_update': 'yes', + 'inner_chroot_script_after': [ + '/sabayon/scripts/remaster_generic_inner_chroot_script_after.sh', + 'kde'], + 'release_string': 'Sabayon Linux', + 'paths_to_empty': ['/empty/this', '/empty/that'], + 'destination_iso_directory': 'specs/out/', + 'repositories_update_cmd': ['equo', 'update', '--debug'], + 'outer_chroot_script_after': ['/sabayon/scripts/remaster_post.sh'] + } + + parse_obj = SpecParser("specs/iso_remaster.spec") + extracted_data = parse_obj.parse() + + self.assert_(isinstance(extracted_data['__plugin__'], RemasterSpec)) + extracted_data['__plugin__'] = None + self.assertEqual(expected_data, extracted_data) + + def test_chroot_to_iso(self): + + from molecule.specs.plugins.builtin_plugin import LivecdSpec + + expected_data = { + 'destination_iso_image_name': 'Sabayon_Linux_5.3_x86_chroot_TEST.iso', + 'post_iso_script': ['specs/data/post_iso_script.sh'], + 'extra_mkisofs_parameters': ['-b', 'isolinux/isolinux.bin', '-c', + 'isolinux/boot.cat'], + 'prechroot': ['linux32'], + 'pre_iso_script': ['specs/data/pre_iso_script.sh'], + 'paths_to_remove': [ + '/var/lib/entropy/client/database/*/sabayonlinux.org', + '/boot/grub/grub.conf', + '/root/.subversion', + '/lib/udev-state/devices.tar.bz2', + '/var/log/scrollkeeper.log', + '/var/log/genkernel.log', + '/var/log/emerge.log', + '/usr/tmp/portage/*', + '/root/.bash_history', + '/usr/share/slocate/slocate.db', + '/root/test-results.txt', + '/root/test.sh', + '/usr/portage/distfiles/*', + '/usr/portage/packages/*', + '/root/.revdep*', + '/install-data/games/*', + '/var/lib/entropy/store/*', + '/var/log/entropy/*', + '/var/lib/entropy/caches/*', + '/var/lib/entropy/smartapps/*/*', + '/var/lib/entropy/tmp/*', + '/var/lib/entropy/packages*/*', + '/var/tmp/entropy/*', + '/*.txt', u'/usr/portage/a*', + '/usr/portage/b*', '/usr/portage/c*', + '/usr/portage/d*', '/usr/portage/e*', '/usr/portage/f*', + '/usr/portage/g*', '/usr/portage/h*', '/usr/portage/i*', + '/usr/portage/j*', '/usr/portage/k*', '/usr/portage/licenses', + '/usr/portage/lxde*', '/usr/portage/m*', '/usr/portage/n*', + '/usr/portage/o*', '/usr/portage/packages', + '/usr/portage/pe*', '/usr/portage/q*', + '/usr/portage/r*', '/usr/portage/s*', + '/usr/portage/t*', '/usr/portage/u*', '/usr/portage/v*', + '/usr/portage/w*', '/usr/portage/x*', '/usr/portage/y*', + '/usr/portage/z*', '/etc/ssh/ssh_host_*', '/entropy', + '/tmp/equoerror.txt', '/var/cache/man', + '/var/lib/entropy/glsa/*', '/root/local', '/var/tmp/*', + '/boot/grub/device.map'], + 'release_version': '5.3', 'source_chroot': 'specs/data/fake_chroot', + 'destination_chroot': 'specs/out/fake_dest_chroot', + '__plugin__': None, + 'destination_livecd_root': 'specs/out/fake_livecd_root', + 'release_desc': 'x86 SpinBase', + 'inner_chroot_script': ['/sabayon/scripts/inner_chroot_script.sh', + 'spinbase'], + 'extra_rsync_parameters': ['--one-file-system', '--exclude', + '"/proc/*"', '--exclude', '"/dev/pts/*"'], + 'release_file': '/etc/sabayon-edition', + 'merge_livecd_root': 'specs/out/fake_merge_livecd_root', + 'release_string': 'Sabayon Linux', + 'paths_to_empty': ['/home/sabayonuser/.thumbnails/', + '/root/.ccache', '/var/tmp/portage', '/var/tmp/ccache', + '/var/tmp/portage-pkg', '/var/tmp/binpkgs', + '/var/lib/entropy/portage', '/var/lib/entropy/logs', + '/var/cache/genkernel'], + 'destination_iso_directory': 'specs/out' + } + + parse_obj = SpecParser("specs/chroot_to_iso.spec") + extracted_data = parse_obj.parse() + + self.assert_(isinstance(extracted_data['__plugin__'], LivecdSpec)) + extracted_data['__plugin__'] = None + self.assertEqual(expected_data, extracted_data) + + def test_iso_to_tar(self): + + from molecule.specs.plugins.tar_plugin import IsoToTarSpec + + expected_data = { + 'iso_mounter': ['mount', '-t', 'iso9660', '-o', 'loop,ro'], + 'custom_packages_add_cmd': 'equo install --debug', + 'post_tar_script': ['specs/data/post_tar_script.sh'], + 'paths_to_remove': ['remove/this', 'and/that'], + 'release_version': '5.3', + 'custom_packages_remove_cmd': 'equo remove --debug', + 'source_iso': 'specs/data/Sabayon_Linux_SpinBase_DAILY_x86.iso', + '__plugin__': None, + 'prechroot': ['linux32'], + 'packages_to_remove': ['app-remove/this', 'app-remove/that'], + 'inner_chroot_script': ['specs/data/inner_chroot_script.sh'], + 'pre_tar_script': ['specs/data/pre_tar_script.sh'], + 'packages_to_add': ['add-this/pkg', 'add-that/pkg'], + 'iso_umounter': ['umount', '-l'], + 'error_script': ['specs/data/error_script.sh'], + 'destination_tar_directory': 'specs/out/', + 'outer_chroot_script': ['specs/data/outer_chroot_script.sh'], + 'execute_repositories_update': 'yes', 'compression_method': 'bz2', + 'inner_chroot_script_after': ['specs/data/inner_chroot_script_after.sh'], + 'paths_to_empty': ['remove/that', 'and/this'], + 'squash_mounter': ['mount', '-t', 'squashfs', '-o', 'loop,ro'], + 'squash_umounter': ['umount', '-l'], + 'tar_name': 'Sabayon_Linux_SpinBase_5.3_x86_openvz.tar.bz2', + 'repositories_update_cmd': ['equo', 'update', '--debug'], + 'outer_chroot_script_after': [ + 'specs/data/outer_chroot_script_after.sh'] + } + + parse_obj = SpecParser("specs/iso_to_tar.spec") + extracted_data = parse_obj.parse() + + self.assert_(isinstance(extracted_data['__plugin__'], IsoToTarSpec)) + extracted_data['__plugin__'] = None + self.assertEqual(expected_data, extracted_data) + + def test_iso_to_image(self): + + from molecule.specs.plugins.image_plugin import IsoToImageSpec + + expected_data = { + 'destination_image_directory': '/sabayon/images', + 'outer_chroot_script_after': [ + '/path/to/script/to/be/executed/outside/after'], + 'iso_mounter': ['mount', '-t', 'iso9660', '-o', 'loop'], + 'prechroot': ['linux32'], + 'image_name': 'image_name_w00t Sabayon_Linux_SpinBase_5.3_x86_ami.img', + 'paths_to_remove': ['/remove/this', '/and/that'], + 'release_version': '5.3', + 'custom_packages_remove_cmd': 'equo remove --debug', + 'source_iso': 'specs/data/Sabayon_Linux_SpinBase_DAILY_x86.iso', + 'image_mb': 5000, + 'image_randomize': 'yes', + 'image_formatter': ['mkfs.ext2'], + 'packages_to_remove': ['app-remove/this', 'app-remove/that'], + 'inner_chroot_script': ['/sabayon/scripts/openvz_inner_chroot_script.sh'], + 'custom_packages_add_cmd': 'equo install --debug', + 'packages_to_add': ['app-add/this', 'app-add/that'], + 'iso_umounter': ['umount', '-l'], + 'error_script': ['/path/to/script/to/be/executed/outside/after'], + 'image_mounter': ['mount', '-o', 'rw,loop'], + 'post_image_script': ['/sabayon/scripts/post_image_script.sh'], + 'outer_chroot_script': ['/path/to/script/to/be/executed/outside'], + 'execute_repositories_update': 'yes', + 'inner_chroot_script_after': [ + '/sabayon/scripts/image_generic_inner_chroot_script_after.sh'], + 'paths_to_empty': ['/empty/this', 'and/that'], + 'squash_mounter': ['mount', '-t', 'squashfs', '-o', 'loop'], + 'pre_image_script': ['/sabayon/scripts/pre_image_script.sh'], + 'repositories_update_cmd': ['equo', 'update', '--debug'], + '__plugin__': None, 'image_umounter': ['umount', '-l'] + } + + parse_obj = SpecParser("specs/iso_to_image.spec") + extracted_data = parse_obj.parse() + + self.assert_(isinstance(extracted_data['__plugin__'], IsoToImageSpec)) + extracted_data['__plugin__'] = None + self.assertEqual(expected_data, extracted_data) + +if __name__ == '__main__': + unittest.main() + raise SystemExit(0) diff --git a/tests/run b/tests/run index 6726dbc..175a889 100755 --- a/tests/run +++ b/tests/run @@ -7,11 +7,11 @@ import unittest sys.path.insert(0,'.') sys.path.insert(0,'..') -from tests import version, utils +from tests import version, utils, specs, parsers rc = 0 # Add to the list the module to test -mods = [version, utils] +mods = [version, utils, specs, parsers] tests = [] for mod in mods: diff --git a/tests/specs/chroot_to_iso.common b/tests/specs/chroot_to_iso.common new file mode 100644 index 0000000..72988af --- /dev/null +++ b/tests/specs/chroot_to_iso.common @@ -0,0 +1,122 @@ +# Execution strategy +execution_strategy: livecd + +# Release string +release_string: Sabayon Linux + +# File to write release string +release_file: /etc/sabayon-edition + +# Destination chroot directory, where files are pushed to before creating the squashfs image +# NOTE: data will be stored inside an auto-generated subdir +destination_chroot: specs/out/fake_dest_chroot + +# Extra mirror (r)sync parameters +extra_rsync_parameters: --one-file-system --exclude "/proc/*" --exclude "/dev/pts/*" + +# Inner chroot script command, to be executed inside destination chroot before packing it +# - kmerge.sh - setup kernel bins +# inner_chroot_script: /sabayon/scripts/inner_chroot_script.sh +inner_chroot_script: /sabayon/scripts/inner_chroot_script.sh spinbase + +# Destination LiveCD root directory, where files are placed before getting mkisofs'ed +# NOTE: data will be stored inside an auto-generated subdir +destination_livecd_root: specs/out/fake_livecd_root + +# Merge directory with destination LiveCD root +merge_livecd_root: specs/out/fake_merge_livecd_root + +# Extra mkisofs parameters, perhaps something to include/use your bootloader +extra_mkisofs_parameters: -b isolinux/isolinux.bin -c isolinux/boot.cat + +# Pre-ISO building script. Hook called before ISO image creation +# Variables exported: +# SOURCE_CHROOT_DIR = path pointing to the initial chroot +# CHROOT_DIR = path pointing to the working chroot (the one that gets modified) +# CDROOT_DIR = path pointing to the root of the CD image being created +# ISO_PATH = path pointing to the destination ISO +# ISO_CHECKSUM_PATH = path pointing to the destination iso checksum (md5) +pre_iso_script: specs/data/pre_iso_script.sh + +# Post-ISO building script. Hook called after ISO image creation +# Variables exported: +# ISO_PATH = path pointing to the destination ISO +# ISO_CHECKSUM_PATH = path pointing to the destination iso checksum (md5) +post_iso_script: specs/data/post_iso_script.sh + +# Destination directory for the ISO image path +destination_iso_directory: specs/out + +# Directories to remove completely (comma separated) +paths_to_remove: + /var/lib/entropy/client/database/*/sabayonlinux.org, + /boot/grub/grub.conf, + /root/.subversion, + /lib/udev-state/devices.tar.bz2, + /var/log/scrollkeeper.log, /var/log/genkernel.log, + /var/log/emerge.log, /usr/tmp/portage/*, + /root/.bash_history, + /usr/share/slocate/slocate.db, + /root/test-results.txt, + /root/test.sh, + /usr/portage/distfiles/*, + /usr/portage/packages/*, + /root/.revdep*, + /install-data/games/*, + /var/lib/entropy/store/*, + /var/log/entropy/*, + /var/lib/entropy/caches/*, + /var/lib/entropy/smartapps/*/*, + /var/lib/entropy/smartapps/*/*, + /var/lib/entropy/tmp/*, + /var/lib/entropy/packages*/*, + /var/tmp/entropy/*, + /*.txt, + /usr/portage/a*, + /usr/portage/b*, + /usr/portage/c*, + /usr/portage/d*, + /usr/portage/e*, + /usr/portage/f*, + /usr/portage/g*, + /usr/portage/h*, + /usr/portage/i*, + /usr/portage/j*, + /usr/portage/k*, + /usr/portage/licenses, + /usr/portage/lxde*, + /usr/portage/m*, + /usr/portage/n*, + /usr/portage/o*, + /usr/portage/packages, + /usr/portage/pe*, + /usr/portage/q*, + /usr/portage/r*, + /usr/portage/s*, + /usr/portage/t*, + /usr/portage/u*, + /usr/portage/v*, + /usr/portage/w*, + /usr/portage/x*, + /usr/portage/y*, + /usr/portage/z*, + /etc/ssh/ssh_host_*, + /entropy, + /tmp/equoerror.txt, + /var/cache/man, + /var/lib/entropy/glsa/*, + /root/local, + /var/tmp/*, + /boot/grub/device.map + +# Directories to empty (comma separated) +paths_to_empty: + /home/sabayonuser/.thumbnails/, + /root/.ccache, + /var/tmp/portage, + /var/tmp/ccache, + /var/tmp/portage-pkg, + /var/tmp/binpkgs, + /var/lib/entropy/portage, + /var/lib/entropy/logs, + /var/cache/genkernel diff --git a/tests/specs/chroot_to_iso.spec b/tests/specs/chroot_to_iso.spec new file mode 100644 index 0000000..a9ef109 --- /dev/null +++ b/tests/specs/chroot_to_iso.spec @@ -0,0 +1,18 @@ +# Use abs path, otherwise daily builds automagic won't work +%import chroot_to_iso.common + +# Release Version +# Keep this here, otherwise daily builds automagic won't work +release_version: 5.3 + +prechroot: linux32 + +# Release Version string description +release_desc: x86 SpinBase + +# Source chroot directory, where files are pulled from +source_chroot: specs/data/fake_chroot + +# Destination ISO image name, call whatever you want.iso, not mandatory +# Keep this here and set, otherwise daily builds automagic won't work +destination_iso_image_name: Sabayon_Linux_5.3_x86_chroot_TEST.iso diff --git a/tests/specs/data/Sabayon_Linux_SpinBase_DAILY_x86.iso b/tests/specs/data/Sabayon_Linux_SpinBase_DAILY_x86.iso new file mode 100644 index 0000000..f610218 Binary files /dev/null and b/tests/specs/data/Sabayon_Linux_SpinBase_DAILY_x86.iso differ diff --git a/tests/specs/data/error_script.sh b/tests/specs/data/error_script.sh new file mode 100644 index 0000000..e69de29 diff --git a/tests/specs/data/fake_chroot/.keep b/tests/specs/data/fake_chroot/.keep new file mode 100644 index 0000000..e69de29 diff --git a/tests/specs/data/post_iso_script.sh b/tests/specs/data/post_iso_script.sh new file mode 100644 index 0000000..e69de29 diff --git a/tests/specs/data/pre_iso_script.sh b/tests/specs/data/pre_iso_script.sh new file mode 100644 index 0000000..e69de29 diff --git a/tests/specs/iso_remaster.common b/tests/specs/iso_remaster.common new file mode 100644 index 0000000..cbfb391 --- /dev/null +++ b/tests/specs/iso_remaster.common @@ -0,0 +1,70 @@ +# Define an alternative execution strategy, in this case, the value must be +# "iso_remaster" +execution_strategy: iso_remaster + +# Release string +release_string: Sabayon Linux + +# File to write release string +release_file: /etc/sabayon-edition + +# ISO Image title +iso_title: Sabayon KDE + +# Outer chroot script command, to be executed outside destination chroot before +# before entering it (and before inner_chroot_script) +outer_chroot_script: /sabayon/scripts/remaster_pre.sh + +# Inner chroot script command, to be executed inside destination chroot after +# packages installation and removal +inner_chroot_script_after: /sabayon/scripts/remaster_generic_inner_chroot_script_after.sh kde + +# Outer chroot script command, to be executed outside destination chroot before +# before entering it (and AFTER inner_chroot_script) +outer_chroot_script_after: /sabayon/scripts/remaster_post.sh + +# Extra mkisofs parameters, perhaps something to include/use your bootloader +extra_mkisofs_parameters: -b isolinux/isolinux.bin -c isolinux/boot.cat + +# Pre-ISO building script. Hook called before ISO image creation +# Variables exported: +# SOURCE_CHROOT_DIR = path pointing to the initial chroot +# CHROOT_DIR = path pointing to the working chroot (the one that gets modified) +# CDROOT_DIR = path pointing to the root of the CD image being created +# ISO_PATH = path pointing to the destination ISO +# ISO_CHECKSUM_PATH = path pointing to the destination iso checksum (md5) +pre_iso_script: /sabayon/scripts/generic_pre_iso_script.sh KDE + +# Post-ISO building script. Hook called after ISO image creation +# Variables exported: +# ISO_PATH = path pointing to the destination ISO +# ISO_CHECKSUM_PATH = path pointing to the destination iso checksum (md5) +post_iso_script: /sabayon/scripts/post_iso_script.sh + +# Destination directory for the ISO image path (MANDATORY) +destination_iso_directory: specs/out/ + +# List of packages that would be removed from chrooted system (comma separated) +packages_to_remove: app-foo/foo, app-foo2/foo2 + +# List of packages that would be added from chrooted system (comma separated) +packages_to_add: + app-admin/packagekit-base, + app-admin/packagekit-qt4, + app-admin/sulfur + +# Custom shell call to packages add (default is: equo install) +custom_packages_add_cmd: equo install --ask + +# Custom command for updating repositories (default is: equo update) +repositories_update_cmd: equo update --debug + +# Determine whether repositories update should be run (if packages_to_add is set) +# (default is: no), values are: yes, no. +execute_repositories_update: yes + +# Directories to remove completely (comma separated) +paths_to_remove: /this/and/that, /that/and/this + +# Directories to empty (comma separated) +paths_to_empty: /empty/this, /empty/that diff --git a/tests/specs/iso_remaster.spec b/tests/specs/iso_remaster.spec new file mode 100644 index 0000000..11c9bea --- /dev/null +++ b/tests/specs/iso_remaster.spec @@ -0,0 +1,14 @@ +# Use abs path, otherwise daily builds automagic won't work +%import iso_remaster.common + +# Release Version +release_version: 5.3 + +# Release Version string description +release_desc: x86 TEST + +# Path to source ISO file (MANDATORY) +source_iso: specs/data/Sabayon_Linux_SpinBase_DAILY_x86.iso + +# Destination ISO image name, call whatever you want.iso, not mandatory +destination_iso_image_name: Sabayon_Linux_5.3_x86_TEST.iso diff --git a/tests/specs/iso_to_image.common b/tests/specs/iso_to_image.common new file mode 100644 index 0000000..d139885 --- /dev/null +++ b/tests/specs/iso_to_image.common @@ -0,0 +1,105 @@ +# Define an alternative execution strategy, in this case, the value must be +execution_strategy: iso_to_image + +# Error script command, executed when something went wrong and molecule has +# to terminate the execution +error_script: /path/to/script/to/be/executed/outside/after + +# Outer chroot script command, to be executed outside destination chroot before +# before entering it (and before inner_chroot_script) +outer_chroot_script: /path/to/script/to/be/executed/outside + +# Inner chroot script command, to be executed inside destination chroot before +# packing it +inner_chroot_script: /sabayon/scripts/openvz_inner_chroot_script.sh + +# Inner chroot script command, to be executed inside destination chroot after +# packages installation and removal +inner_chroot_script_after: /sabayon/scripts/image_generic_inner_chroot_script_after.sh + +# Outer chroot script command, to be executed outside destination chroot before +# before entering it (and AFTER inner_chroot_script) +outer_chroot_script_after: /path/to/script/to/be/executed/outside/after + +# Pre-image building script. Hook called before image file creation +# Variables exported: +# TMP_IMAGE_PATH = path pointing to the temporary destination image file +# LOOP_DEVICE = loop device (/dev/loopN) currently in use +pre_image_script: /sabayon/scripts/pre_image_script.sh + +# Post-image building script. Hook called after image file creation and move +# into destination directory. +# Variables exported: +# IMAGE_PATH = path pointing to the destination image file +# IMAGE_CHECKSUM_PATH = path pointing to the destination image file checksum (md5) +post_image_script: /sabayon/scripts/post_image_script.sh + +# Destination directory for the image path (MANDATORY) +destination_image_directory: /sabayon/images + +# Specify an alternative image file name (image file name will be automatically +# produced otherwise) +image_name: image_name_w00t + +# Specify the image file size in Megabytes. This is mandatory. +# To avoid runtime failure, make sure the image is large enough to fit your +# chroot data. +# Example: 5000 (means: ~5GB) +# Example: 15000 (means: ~15GB) +image_mb: 5000 + +# Either set this to "yes" or "no" if you want your image to be filled with +# random data instead of zeroes. urandom is used, fallback is: random. +# Default is: no +image_randomize: yes + +# Specify an image filesystem formatter that takes a single argument , which is +# the image device (by design, a loop device is passed to this executable). +# Default is: mkfs.ext3 +image_formatter: mkfs.ext2 + +# Specify an image file mount command. Two arguments are passed: (1) a loop +# device (/dev/loopN), (2) a temporary destination directory. +# Default is: mount -o loop,rw +image_mounter: mount -o rw,loop + +# Specify am image file unmount command. One arguments is passed: mount point. +# Default is: umount +image_umounter: umount -l + +# Alternative ISO file mount command (default is: mount -o loop -t iso9660) +iso_mounter: mount -t iso9660 -o loop + +# Alternative ISO umounter command (default is: umount) +iso_umounter: umount -l + +# Alternative squashfs file mount command (default is: mount -o loop -t squashfs) +squash_mounter: mount -t squashfs -o loop + +# Alternative ISO squashfs umount command (default is: umount) +squash_umounter: + +# List of packages that would be removed from chrooted system (comma separated) +packages_to_remove: app-remove/this, app-remove/that + +# Custom shell call to packages removal (default is: equo remove) +custom_packages_remove_cmd: equo remove --debug + +# List of packages that would be added from chrooted system (comma separated) +packages_to_add: app-add/this, app-add/that + +# Custom shell call to packages add (default is: equo install) +custom_packages_add_cmd: equo install --debug + +# Custom command for updating repositories (default is: equo update) +repositories_update_cmd: equo update --debug + +# Determine whether repositories update should be run (if packages_to_add is set) +# (default is: no), values are: yes, no. +execute_repositories_update: yes + +# Directories to remove completely (comma separated) +paths_to_remove: /remove/this, /and/that + +# Directories to empty (comma separated) +paths_to_empty: /empty/this, and/that diff --git a/tests/specs/iso_to_image.spec b/tests/specs/iso_to_image.spec new file mode 100644 index 0000000..52b64d0 --- /dev/null +++ b/tests/specs/iso_to_image.spec @@ -0,0 +1,13 @@ +# Use abs path, otherwise daily builds automagic won't work +# For further documentation, see the file above: +%import iso_to_image.common + +# pre chroot command, example, for 32bit chroots on 64bit system, you always +# have to append "linux32" this is useful for inner_chroot_script +prechroot: linux32 + +# Path to source ISO file (MANDATORY) +source_iso: specs/data/Sabayon_Linux_SpinBase_DAILY_x86.iso + +release_version: 5.3 +image_name: Sabayon_Linux_SpinBase_5.3_x86_ami.img diff --git a/tests/specs/iso_to_tar.common b/tests/specs/iso_to_tar.common new file mode 100644 index 0000000..ba0056c --- /dev/null +++ b/tests/specs/iso_to_tar.common @@ -0,0 +1,84 @@ +# Define an alternative execution strategy, in this case, the value must be +execution_strategy: iso_to_tar + +# Error script command, executed when something went wrong and molecule has +# to terminate the execution +# environment variables exported: +# - CHROOT_DIR: path to chroot directory +error_script: specs/data/error_script.sh + +# Outer chroot script command, to be executed outside destination chroot before +# before entering it (and before inner_chroot_script) +outer_chroot_script: specs/data/outer_chroot_script.sh + +# Inner chroot script command, to be executed inside destination chroot before packing it +inner_chroot_script: specs/data/inner_chroot_script.sh + +# Inner chroot script command, to be executed inside destination chroot after +# packages installation and removal +inner_chroot_script_after: specs/data/inner_chroot_script_after.sh + +# Outer chroot script command, to be executed outside destination chroot before +# before entering it (and AFTER inner_chroot_script) +outer_chroot_script_after: specs/data/outer_chroot_script_after.sh + +# Pre-tar building script. Hook called before tar file creation +# Variables exported: +# CHROOT_DIR = path pointing to the working chroot (the one that gets modified) +# TAR_PATH = path pointing to the destination tar file +# TAR_CHECKSUM_PATH = path pointing to the destination tar file checksum (md5) +pre_tar_script: specs/data/pre_tar_script.sh + +# Post-tar building script. Hook called after tar file creation +# Variables exported: +# CHROOT_DIR = path pointing to the working chroot (the one that gets modified) +# TAR_PATH = path pointing to the destination tar file +# TAR_CHECKSUM_PATH = path pointing to the destination tar file checksum (md5) +post_tar_script: specs/data/post_tar_script.sh + +# Destination directory for the tar file (MANDATORY) +destination_tar_directory: specs/out/ + +# Compression method (default is: gz). Supported compression methods: gz, bz2 +compression_method: bz2 + +# Specify an alternative tar file name (tar file name will be automatically +# produced otherwise) +# tar_name: + +# Alternative ISO file mount command (default is: mount -o loop -t iso9660) +iso_mounter: mount -t iso9660 -o loop,ro + +# Alternative ISO umounter command (default is: umount) +iso_umounter: umount -l + +# Alternative squashfs file mount command (default is: mount -o loop -t squashfs) +squash_mounter: mount -t squashfs -o loop,ro + +# Alternative ISO squashfs umount command (default is: umount) +squash_umounter: umount -l + +# List of packages that would be removed from chrooted system (comma separated) +packages_to_remove: app-remove/this, app-remove/that + +# Custom shell call to packages removal (default is: equo remove) +custom_packages_remove_cmd: equo remove --debug + +# List of packages that would be added from chrooted system (comma separated) +packages_to_add: add-this/pkg, add-that/pkg + +# Custom shell call to packages add (default is: equo install) +custom_packages_add_cmd: equo install --debug + +# Custom command for updating repositories (default is: equo update) +repositories_update_cmd: equo update --debug + +# Determine whether repositories update should be run (if packages_to_add is set) +# (default is: no), values are: yes, no. +execute_repositories_update: yes + +# Directories to remove completely (comma separated) +paths_to_remove: remove/this, and/that + +# Directories to empty (comma separated) +paths_to_empty: remove/that, and/this diff --git a/tests/specs/iso_to_tar.spec b/tests/specs/iso_to_tar.spec new file mode 100644 index 0000000..8169c53 --- /dev/null +++ b/tests/specs/iso_to_tar.spec @@ -0,0 +1,12 @@ +# Use abs path, otherwise daily builds automagic won't work +%import iso_to_tar.common + +# pre chroot command, example, for 32bit chroots on 64bit system, you always +# have to append "linux32" this is useful for inner_chroot_script +prechroot: linux32 + +# Path to source ISO file (MANDATORY) +source_iso: specs/data/Sabayon_Linux_SpinBase_DAILY_x86.iso + +release_version: 5.3 +tar_name: Sabayon_Linux_SpinBase_5.3_x86_openvz.tar.bz2 diff --git a/tests/specs/out/.keep b/tests/specs/out/.keep new file mode 100644 index 0000000..e69de29 diff --git a/tests/specs/out/fake_dest_chroot/.keep b/tests/specs/out/fake_dest_chroot/.keep new file mode 100644 index 0000000..e69de29 diff --git a/tests/specs/out/fake_livecd_root/.keep b/tests/specs/out/fake_livecd_root/.keep new file mode 100644 index 0000000..e69de29 diff --git a/tests/specs/out/fake_merge_livecd_root/.keep b/tests/specs/out/fake_merge_livecd_root/.keep new file mode 100644 index 0000000..e69de29