{ "info": { "author": "Ingeniweb", "author_email": "support@ingeniweb.com", "bugtrack_url": null, "classifiers": [ "Framework :: Buildout", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ".. contents::\n\n\nCode repository: https://ingeniweb.svn.sourceforge.net/svnroot/ingeniweb/iw.recipe.backup/\n\n\nChange history\n**************\n\ntrunk (2009-11-25)\n==================\n\n - xxx [Ingeniweb]\n\n0.2.1 (2008-11-24)\n==================\n\n - added 'base-path' option [fdupre]\n if set, use it instead buildout-dir, really usefull if datas are stored\n in another place in the system (NAS, NFS mount...).\n\n0.2.0 (2008-05-08)\n==================\n\n - added 'archive-before-backup' option. [tdesvenain]\n True by default. If set to 0, buildout is not backuped before a restore\n\n - added 'include-folders' option, that allows to limit backup\n on some directories [tdesvenain]\n\n - create backups dir if not exists [tdesvenain]\n\n - add format option instead of archive-root-name\n [gawel]\n\n - fixing test so it passes on all machines\n [tarek]\n\n0.1.2 (2008-04-11)\n==================\n\n - Added the fs-location option, that allows\n doing a safe backup of a running Data.fs.\n [tarek]\n\n0.1.1 (2008-03-21)\n==================\n\n - Added the `exclude-folders` option\n\n - Now asks a question before restoring.\n It is more a conveniency since everything\n is backed up in any case.\n [tarek]\n\n0.1.0 (2008-03-12)\n==================\n\n - Initial implementation.\n [tarek]\n - Created recipe with ZopeSkel\n [Ingeniweb].\n\n\nDetailed Documentation\n**********************\n\nSupported options\n=================\n\nThe recipe supports the following options:\n\nbackup-script-name\n Name of the backup script. Default: `backup`\n\nrestore-script-name\n Name of the restore script. Default: `restore`\n\nformat\n Formated name of the archive.\n Default to %(name)s-%(year)s-%(month)s-%(day)s-%(hour)s-%(minute)s\n where name is the section name\n\nexclude-folders\n Names of folder to avoid backing up. Relative to buildout root.\n\ninclude-folders\n If set, back up those folders only. Relative to buildout root.\n\nfs-location\n If given, indicates the path of the file system storage.\n The recipe will carefully copy it when doing a backup,\n by using a transaction-level read of the file.\n This means that you can launch a backup without stopping\n the Zope server.\n\ntarget-folder\n Folder where the archives are stored. **Mandatory**\n\nlog-file\n File where all calls are recorded. **Mandatory**\n\narchive-before-restore\n If not set to 0, do a complete backup before a restore\n\nprompt-before-restore\n If not set to 0, prompt before a restore\n \nbase-path\n If set, backup this path instead base on instance path\n\nExample usage\n=============\n\nWe'll start by creating a buildout that uses the recipe::\n\n >>> import os\n >>> root = os.path.split(sample_buildout)[0]\n >>> if root == '':\n ... root = '.'\n\nLet's copy a real Data.fs in our buildout::\n\n >>> import shutil\n >>> data_fs = os.path.join(test_dir, 'Data.fs')\n >>> shutil.copyfile(data_fs, join(sample_buildout, 'Data.fs'))\n\n >>> write('buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = backup\n ... index = http://pypi.python.org/simple\n ...\n ... [backup]\n ... recipe = iw.recipe.backup\n ...\n ... format = %(format)s\n ... target-folder = %(root)s\n ... log-file = %(root)s/backup.log\n ... fs-location = ${buildout:directory}/Data.fs\n ... \"\"\" % {'root': root, 'format':'%(name)s-%(year)s-%(month)s-%(day)s'})\n\nLet's run the buildout::\n\n >>> null = system(buildout)\n\nLet's see what we got in the backup script::\n\n >>> print open(join(sample_buildout, 'bin', 'backup')).read()\n #!...\n \n import sys\n sys.path[0:0] = [\n ...\n ]\n \n import iw.recipe.backup.archive\n \n if __name__ == '__main__':\n iw.recipe.backup.archive.archive_buildout(('/sample-buildout', '%(name)s-%(year)s-%(month)s-%(day)s', '..._TEST_', '/backup.log', [], [], '/sample-buildout/Data.fs', {'name': 'backup'}))\n \n\nOk, let's call it to backup the current buildout::\n\n >>> print system(join(sample_buildout, 'bin', 'backup'))\n Starting the backup...\n Archived in /backup-XXXX-XX-XX.tar.gz\n ...\n \n\nWe should have a log file generated as well::\n\n >>> print open(join(root, 'backup.log')).read()\n 20... Starting the backup...\n 20... INFO Archived in /backup-XXXX-XX-XX.tar.gz\n\nWe also have a restore feature::\n\n >>> print system(join(sample_buildout, 'bin', 'restore'))\n Usage: ...restore archive_name\n \n\nLet's set the user input::\n\n >>> from iw.recipe.backup.testing import set_input\n >>> set_input('Y')\n\nOh right, the restore script takes the name of the archive::\n\n >>> import glob\n >>> arc = glob.glob('%s/*.tar.gz' % root)[0]\n >>> print system(join(sample_buildout, 'bin', 'restore %s' % arc))\n Are you sure you want to restore ? Every data will be lost ! (y/N) Y\n Archiving current folder before restoring\n Starting the backup...\n Archived in /before-restore-XXXX-XX-XX-XX-XX.tar.gz\n Starting the restore...\n Archive restored in /sample-buildout\n ...\n \n\nAnd a restore *always* makes an archive on the current folder before\nit is applied, to make sure nothing is never lost.\n\nThere's also something quite important: make sure the archive and\nlog files are not located in the buildout !::\n\n >>> write('buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = backup\n ... index = http://pypi.python.org/simple\n ...\n ... [backup]\n ... recipe = iw.recipe.backup\n ...\n ... target-folder = %(root)s\n ... log-file = %(root)s/backup.log\n ... \"\"\" % {'root': sample_buildout})\n\n >>> print system(buildout)\n Uninstalling backup.\n Installing backup.\n While:\n Installing backup.\n \n An internal error occured due to a bug in either zc.buildout or in a\n recipe being used:\n ...\n ValueError: Cannot backup within the buildout ! Check your values\n \n\nA bit of cleaning::\n\n >>> import glob\n >>> arc = glob.glob('%s/*.tar.gz' % root)\n >>> for f in arc:\n ... os.remove(f)\n\nWe can also exclude some folders from being archived::\n\n >>> os.mkdir(join(sample_buildout, 'not'))\n >>> open(join(sample_buildout, 'not', 'f'), 'w').write('me file')\n\n >>> os.mkdir(join(sample_buildout, 'neh'))\n\n >>> write('buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = backup\n ... index = http://pypi.python.org/simple\n ...\n ... [backup]\n ... recipe = iw.recipe.backup\n ...\n ... target-folder = %(root)s\n ... log-file = %(root)s/backup.log\n ... fs-location = ${buildout:directory}/Data.fs\n ... exclude-folders =\n ... %(sample_buildout)s/not\n ... %(sample_buildout)s/neh\n ... \"\"\" % {'root': root, 'sample_buildout': sample_buildout})\n\nRunning the buildout again::\n\n >>> print system(buildout+' -D')\n Installing backup.\n Generated script '...backup'.\n Generated script '...restore'.\n \n\nLet's backup::\n\n >>> print system(join(sample_buildout, 'bin', 'backup'))\n Starting the backup...\n Archived in /backup-XXXX-XX-XX-XX-XX.tar.gz\n ...\n \n\nLet's remove the folder and the Data.fs::\n\n >>> import shutil\n >>> shutil.rmtree(join(sample_buildout, 'not'))\n >>> os.rmdir(join(sample_buildout, 'neh'))\n >>> os.remove(join(sample_buildout, 'Data.fs'))\n\nLet's restore::\n\n >>> arc = glob.glob('%s/*.tar.gz' % root)[0]\n >>> print system(join(sample_buildout, 'bin', 'restore %s' % arc))\n Are you sure you want to restore ? Every data will be lost ! (y/N) Y\n ...\n \n\nAnd make sure the `not` folder is not back !\n\n >>> os.path.exists(join(sample_buildout, 'not'))\n False\n >>> os.path.exists(join(sample_buildout, 'neh'))\n False\n\nAnd the `Data.fs` is back, so we're OK::\n\n >>> os.path.exists(join(sample_buildout, 'Data.fs'))\n True\n\n==============\n\nWe can also restrict archive on some folders ::\n\n >>> os.mkdir(join(sample_buildout, 'not'))\n >>> open(join(sample_buildout, 'not', 'f'), 'w').write('me file')\n\n >>> os.mkdir(join(sample_buildout, 'neh'))\n >>> open(join(sample_buildout, 'neh', 'f'), 'w').write('me file')\n \n >>> os.mkdir(join(sample_buildout, 'neh/not'))\n >>> open(join(sample_buildout, 'neh/not', 'f'), 'w').write('me file')\n\n >>> write('buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = backup\n ... index = http://pypi.python.org/simple\n ...\n ... [backup]\n ... recipe = iw.recipe.backup\n ...\n ... target-folder = %(root)s\n ... log-file = %(root)s/backup.log\n ... fs-location = ${buildout:directory}/Data.fs\n ... exclude-folders =\n ... %(sample_buildout)s/not\n ... %(sample_buildout)s/neh/not\n ... include-folders =\n ... %(sample_buildout)s/neh\n ... prompt-before-restore = 0\n ... archive-before-restore = 0\n ... \"\"\" % {'root': root, 'sample_buildout': sample_buildout})\n\nRunning the buildout again::\n\n >>> print system(buildout+' -D')\n Uninstalling backup.\n Installing backup.\n Generated script '...backup'.\n Generated script '...restore'.\n \n\nLet's see what we got in the backup script::\n\n >>> print open(join(sample_buildout, 'bin', 'backup')).read()\n #!...\n \n import sys\n sys.path[0:0] = [\n ...\n ]\n \n import iw.recipe.backup.archive\n \n if __name__ == '__main__':\n iw.recipe.backup.archive.archive_buildout(('/sample-buildout', '...', '..._TEST_', '/backup.log', ['/sample-buildout/not', '/sample-buildout/neh/not'], ['/sample-buildout/neh'], '/sample-buildout/Data.fs', {'name': 'backup'}))\n \n\n \nLet's backup::\n\n >>> print system(join(sample_buildout, 'bin', 'backup'))\n Starting the backup...\n Archived in /backup-XXXX-XX-XX-XX-XX.tar.gz\n \n\nLet's remove the folder and the Data.fs::\n \n >>> import shutil\n >>> shutil.rmtree(join(sample_buildout, 'not'))\n >>> shutil.rmtree(join(sample_buildout, 'neh'))\n >>> os.remove(join(sample_buildout, 'Data.fs'))\n \nLet's restore::\n\n >>> arc = glob.glob('%s/*.tar.gz' % root)[0]\n >>> rest = os.popen(join(sample_buildout, 'bin', 'restore %s' % arc))\n\t\nAnd make sure the `not` folder and 'neh/not' are not back and neh is back !\n >>> os.path.exists(join(sample_buildout, 'not'))\n False\n >>> os.path.exists(join(sample_buildout, 'neh/not'))\n False\n >>> os.path.exists(join(sample_buildout, 'neh'))\n True\n\nContributors\n************\n\nIngeniweb, Author\n\n\nDownload\n********", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://ingeniweb.svn.sourceforge.net/svnroot/ingeniweb/iw.recipe.backup", "keywords": "recipe buildout", "license": "ZPL", "maintainer": null, "maintainer_email": null, "name": "iw.recipe.backup", "package_url": "https://pypi.org/project/iw.recipe.backup/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/iw.recipe.backup/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://ingeniweb.svn.sourceforge.net/svnroot/ingeniweb/iw.recipe.backup" }, "release_url": "https://pypi.org/project/iw.recipe.backup/0.2.1/", "requires_dist": null, "requires_python": null, "summary": "Zc buildout recipe that provides a backup script", "version": "0.2.1" }, "last_serial": 755357, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "38d96f04ccaaf35624a6ae174d02b3e0", "sha256": "75d75bfe5709984d5b875e8ad0209ada5231f8b36b7b86da559801cc2dd03407" }, "downloads": -1, "filename": "iw.recipe.backup-0.1.1-py2.4.egg", "has_sig": false, "md5_digest": "38d96f04ccaaf35624a6ae174d02b3e0", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 16513, "upload_time": "2008-03-21T09:06:25", "url": "https://files.pythonhosted.org/packages/6b/6d/2cb9e9816e3edf019449ca6b933de52276f4f6457692ad4e88d79e42e16c/iw.recipe.backup-0.1.1-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "89df2c415bc162943d24fd177b6ec1aa", "sha256": "e1531d37f7c59dd60a0866de2881c72aa4175449b06a14bf457647d571ee4b4e" }, "downloads": -1, "filename": "iw.recipe.backup-0.1.1.tar.gz", "has_sig": false, "md5_digest": "89df2c415bc162943d24fd177b6ec1aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9226, "upload_time": "2008-03-21T09:06:24", "url": "https://files.pythonhosted.org/packages/2c/a3/f4f076eea065ea50bf8a4429806a6655f00d3500aabc3a98604681c2c0d7/iw.recipe.backup-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "fefa2b56c021d4998a4ae7791e177276", "sha256": "8477ebf7d25c6046cf4dcfc45cb5ce34e0378f05b744c630c72d2c434d578e19" }, "downloads": -1, "filename": "iw.recipe.backup-0.1.2-py2.4.egg", "has_sig": false, "md5_digest": "fefa2b56c021d4998a4ae7791e177276", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 20681, "upload_time": "2008-04-11T17:13:07", "url": "https://files.pythonhosted.org/packages/15/73/f60410b84d067c3ffd0b4def16df64048345e438bbc188528ad139fe0cd0/iw.recipe.backup-0.1.2-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "518cbe365f0213779af608662cb3b0f7", "sha256": "9e26c6138b510ae7b2edb39e7b792ce216232b1befa4f3e2515ff54778f7160d" }, "downloads": -1, "filename": "iw.recipe.backup-0.1.2.tar.gz", "has_sig": false, "md5_digest": "518cbe365f0213779af608662cb3b0f7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10632, "upload_time": "2008-04-11T17:13:06", "url": "https://files.pythonhosted.org/packages/e4/b1/f96cbd5272b46217e468d5e04944d11a40a091c06d28615f5e9c55c957a9/iw.recipe.backup-0.1.2.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "7ee6f66054192f936d4038b96160cf38", "sha256": "add9e62148e36a29db1fe71b92e4035889affc8f67abbf83be098b029f2aec46" }, "downloads": -1, "filename": "iw.recipe.backup-0.2.0-py2.4.egg", "has_sig": false, "md5_digest": "7ee6f66054192f936d4038b96160cf38", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 22463, "upload_time": "2009-11-07T16:02:13", "url": "https://files.pythonhosted.org/packages/1f/0d/099863d8852f22fdf80f2d7a309dc8c61d5040d75616fd84ff2797c07529/iw.recipe.backup-0.2.0-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "0fa9a3a5acf6cbd8045d9f58ba18be7b", "sha256": "c03f6fd76afa9b6eca9d23ebe2c8d13fd108b6f9d8420a91c04780d9fd40430c" }, "downloads": -1, "filename": "iw.recipe.backup-0.2.0.tar.gz", "has_sig": false, "md5_digest": "0fa9a3a5acf6cbd8045d9f58ba18be7b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10902, "upload_time": "2009-11-07T16:02:12", "url": "https://files.pythonhosted.org/packages/5d/11/e6ec31d9c5c54112b06744e978df49222072ef3d35b459858f02bef8b5db/iw.recipe.backup-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "66c703f24bd3894f6a2a46642ece6917", "sha256": "7f5ca8bbba2ddc57da1a7acdd43142117e5dd767350ae610475b25b727fe3fe3" }, "downloads": -1, "filename": "iw.recipe.backup-0.2.1-py2.4.egg", "has_sig": false, "md5_digest": "66c703f24bd3894f6a2a46642ece6917", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 22600, "upload_time": "2009-11-25T14:12:12", "url": "https://files.pythonhosted.org/packages/df/28/112841a9158d6eb3b7de40f34cc4fd3007d19ce37f0b6bd485a2fb181901/iw.recipe.backup-0.2.1-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "5fc57dd2c5b88453d1b248c6b3008ad2", "sha256": "5eb2bcf5ca934df19eaa8b43bf0179a2f883e0a0016c88700261041f886be52f" }, "downloads": -1, "filename": "iw.recipe.backup-0.2.1.tar.gz", "has_sig": false, "md5_digest": "5fc57dd2c5b88453d1b248c6b3008ad2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12914, "upload_time": "2009-11-25T11:54:50", "url": "https://files.pythonhosted.org/packages/fc/3a/055fa50f5fb21d199e62ad2d5553bbf8d7e2ed37188bcb6d8b1f37f1049d/iw.recipe.backup-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "66c703f24bd3894f6a2a46642ece6917", "sha256": "7f5ca8bbba2ddc57da1a7acdd43142117e5dd767350ae610475b25b727fe3fe3" }, "downloads": -1, "filename": "iw.recipe.backup-0.2.1-py2.4.egg", "has_sig": false, "md5_digest": "66c703f24bd3894f6a2a46642ece6917", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 22600, "upload_time": "2009-11-25T14:12:12", "url": "https://files.pythonhosted.org/packages/df/28/112841a9158d6eb3b7de40f34cc4fd3007d19ce37f0b6bd485a2fb181901/iw.recipe.backup-0.2.1-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "5fc57dd2c5b88453d1b248c6b3008ad2", "sha256": "5eb2bcf5ca934df19eaa8b43bf0179a2f883e0a0016c88700261041f886be52f" }, "downloads": -1, "filename": "iw.recipe.backup-0.2.1.tar.gz", "has_sig": false, "md5_digest": "5fc57dd2c5b88453d1b248c6b3008ad2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12914, "upload_time": "2009-11-25T11:54:50", "url": "https://files.pythonhosted.org/packages/fc/3a/055fa50f5fb21d199e62ad2d5553bbf8d7e2ed37188bcb6d8b1f37f1049d/iw.recipe.backup-0.2.1.tar.gz" } ] }