diff --git a/PKG-INFO b/PKG-INFO index 4001d4a..423ffc0 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,57 +1,57 @@ Metadata-Version: 2.1 Name: swh.loader.svn -Version: 1.3.3 +Version: 1.3.4 Summary: Software Heritage Loader SVN Home-page: https://forge.softwareheritage.org/diffusion/DLDSVN Author: Software Heritage developers Author-email: swh-devel@inria.fr Project-URL: Bug Reports, https://forge.softwareheritage.org/maniphest Project-URL: Funding, https://www.softwareheritage.org/donate Project-URL: Source, https://forge.softwareheritage.org/source/swh-loader-svn Project-URL: Documentation, https://docs.softwareheritage.org/devel/swh-loader-svn/ Classifier: Programming Language :: Python :: 3 Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3) Classifier: Operating System :: OS Independent Classifier: Development Status :: 5 - Production/Stable Requires-Python: >=3.7 Description-Content-Type: text/markdown Provides-Extra: testing License-File: LICENSE License-File: AUTHORS swh-loader-svn ============== The Software Heritage SVN Loader is a tool and a library to walk a remote svn repository and inject into the SWH dataset all contained files that weren't known before. The main entry points are - :class:`swh.loader.svn.loader.SvnLoader` for the main svn loader which ingests content out of a remote svn repository - :class:`swh.loader.svn.loader.SvnLoaderFromDumpArchive` which mounts a repository out of a svn dump prior to ingest it. - :class:`swh.loader.svn.loader.SvnLoaderFromRemoteDump` which mounts a repository with svnrdump prior to ingest its content. # CLI run With the configuration: /tmp/loader_svn.yml: ``` storage: cls: remote args: url: http://localhost:5002/ ``` Run: ``` swh loader --config-file /tmp/loader_svn.yml \ run svn ``` diff --git a/debian/changelog b/debian/changelog index 5e89897..7e452f2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,844 +1,846 @@ -swh-loader-svn (1.3.3-1~swh1~bpo10+1) buster-swh; urgency=medium +swh-loader-svn (1.3.4-1~swh1) unstable-swh; urgency=medium - * Rebuild for buster-swh + * New upstream release 1.3.4 - (tagged by Antoine Lambert + on 2022-09-15 17:04:40 +0200) + * Upstream changes: - version 1.3.4 - -- Software Heritage autobuilder (on jenkins-debian1) Wed, 01 Jun 2022 09:58:52 +0000 + -- Software Heritage autobuilder (on jenkins-debian1) Thu, 15 Sep 2022 15:11:30 +0000 swh-loader-svn (1.3.3-1~swh1) unstable-swh; urgency=medium * New upstream release 1.3.3 - (tagged by Antoine Lambert on 2022-06-01 11:49:17 +0200) * Upstream changes: - version 1.3.3 -- Software Heritage autobuilder (on jenkins-debian1) Wed, 01 Jun 2022 09:55:53 +0000 swh-loader-svn (1.3.2-1~swh1) unstable-swh; urgency=medium * New upstream release 1.3.2 - (tagged by Antoine Lambert on 2022-04-29 12:06:51 +0200) * Upstream changes: - version 1.3.2 -- Software Heritage autobuilder (on jenkins-debian1) Fri, 29 Apr 2022 10:11:07 +0000 swh-loader-svn (1.3.1-1~swh1) unstable-swh; urgency=medium * New upstream release 1.3.1 - (tagged by Antoine Lambert on 2022-04-21 15:24:00 +0200) * Upstream changes: - version 1.3.1 -- Software Heritage autobuilder (on jenkins-debian1) Thu, 21 Apr 2022 13:27:38 +0000 swh-loader-svn (1.3.0-1~swh1) unstable-swh; urgency=medium * New upstream release 1.3.0 - (tagged by Antoine Lambert on 2022-03-24 13:30:17 +0100) * Upstream changes: - version 1.3.0 -- Software Heritage autobuilder (on jenkins-debian1) Thu, 24 Mar 2022 12:34:14 +0000 swh-loader-svn (1.2.1-1~swh1) unstable-swh; urgency=medium * New upstream release 1.2.1 - (tagged by Antoine Lambert on 2022-03-09 13:57:18 +0100) * Upstream changes: - version 1.2.1 -- Software Heritage autobuilder (on jenkins-debian1) Wed, 09 Mar 2022 13:00:41 +0000 swh-loader-svn (1.2.0-1~swh2) unstable-swh; urgency=medium * Bump new release -- Antoine R. Dumont (@ardumont) Thu, 17 Feb 2022 12:46:20 +0100 swh-loader-svn (1.2.0-1~swh1) unstable-swh; urgency=medium * New upstream release 1.2.0 - (tagged by Antoine Lambert on 2022-02-11 17:19:45 +0100) * Upstream changes: - version 1.2.0 -- Software Heritage autobuilder (on jenkins-debian1) Fri, 11 Feb 2022 16:23:08 +0000 swh-loader-svn (1.1.1-1~swh1) unstable-swh; urgency=medium * New upstream release 1.1.1 - (tagged by Antoine Lambert on 2022-01-28 11:42:12 +0100) * Upstream changes: - version 1.1.1 -- Software Heritage autobuilder (on jenkins-debian1) Fri, 28 Jan 2022 10:44:57 +0000 swh-loader-svn (1.1.0-1~swh1) unstable-swh; urgency=medium * New upstream release 1.1.0 - (tagged by Antoine Lambert on 2022-01-24 17:57:36 +0100) * Upstream changes: - version 1.1.0 -- Software Heritage autobuilder (on jenkins-debian1) Mon, 24 Jan 2022 17:01:15 +0000 swh-loader-svn (1.0.0-1~swh1) unstable-swh; urgency=medium * New upstream release 1.0.0 - (tagged by Antoine Lambert on 2022-01-19 16:51:43 +0100) * Upstream changes: - version 1.0.0 -- Software Heritage autobuilder (on jenkins-debian1) Wed, 19 Jan 2022 15:54:56 +0000 swh-loader-svn (0.10.2-1~swh1) unstable-swh; urgency=medium * New upstream release 0.10.2 - (tagged by Antoine Lambert on 2021-11-29 14:36:35 +0100) * Upstream changes: - version 0.10.2 -- Software Heritage autobuilder (on jenkins-debian1) Mon, 29 Nov 2021 13:40:41 +0000 swh-loader-svn (0.10.1-1~swh1) unstable-swh; urgency=medium * New upstream release 0.10.1 - (tagged by Antoine Lambert on 2021-11-25 15:20:27 +0100) * Upstream changes: - version 0.10.1 -- Software Heritage autobuilder (on jenkins-debian1) Thu, 25 Nov 2021 14:26:34 +0000 swh-loader-svn (0.10.0-1~swh1) unstable-swh; urgency=medium * New upstream release 0.10.0 - (tagged by Antoine Lambert on 2021-11-19 11:58:43 +0100) * Upstream changes: - version 0.10.0 -- Software Heritage autobuilder (on jenkins-debian1) Fri, 19 Nov 2021 11:03:18 +0000 swh-loader-svn (0.9.1-1~swh1) unstable-swh; urgency=medium * New upstream release 0.9.1 - (tagged by Antoine R. Dumont (@ardumont) on 2021-11-18 14:19:23 +0100) * Upstream changes: - v0.9.1 - ra: Prevent erroneous removing of file state -- Software Heritage autobuilder (on jenkins-debian1) Thu, 18 Nov 2021 13:22:06 +0000 swh-loader-svn (0.9.0-1~swh1) unstable-swh; urgency=medium * New upstream release 0.9.0 - (tagged by Antoine Lambert on 2021-11-17 15:11:56 +0100) * Upstream changes: - version 0.9.0 -- Software Heritage autobuilder (on jenkins-debian1) Wed, 17 Nov 2021 14:14:34 +0000 swh-loader-svn (0.8.0-1~swh1) unstable-swh; urgency=medium * New upstream release 0.8.0 - (tagged by Antoine R. Dumont (@ardumont) on 2021-11-09 12:25:09 +0100) * Upstream changes: - v0.8.0 - SvnLoaderFromRemoteDump: Drop dump when svn repository is mounted - loader: Let log statement do the formatting - svn: Modify default loader to use the same as production task -- Software Heritage autobuilder (on jenkins-debian1) Tue, 09 Nov 2021 11:27:49 +0000 swh-loader-svn (0.7.3-1~swh1) unstable-swh; urgency=medium * New upstream release 0.7.3 - (tagged by Antoine R. Dumont (@ardumont) on 2021-11-08 17:29:05 +0100) * Upstream changes: - v0.7.3 - loader: Implement post_load to check for revision divergence - ra: Fix export of non link file with svn:special property set - loader: Fix error when first revision number is not one - loader: Perform a complete reloading when detecting altered history - ra: Handle invalid values for svn:eol-style property - ra: Handle unsetting svn:special property on svn links - ra: Do not process end of lines for svn links - ra: Fix edge case in svn:eol-style property handling - loader: Rename start_from_scratch parameter to incremental - loader: Let logging instructions do the formatting - loader: Fix SvnLoaderFromDumpArchive and add test - Remove reference to deprecated swh.model.identifiers module -- Software Heritage autobuilder (on jenkins-debian1) Mon, 08 Nov 2021 16:32:19 +0000 swh-loader-svn (0.7.2-1~swh1) unstable-swh; urgency=medium * New upstream release 0.7.2 - (tagged by Antoine R. Dumont (@ardumont) on 2021-09-30 10:07:44 +0200) * Upstream changes: - v0.7.2 - SvnLoaderFromRemoteDump: Fix failed visit which should be an uneventful visit - svn: Capture svnrdump failure as not_found instead of failed - mypy: Fix errors with release >= v0.900 -- Software Heritage autobuilder (on jenkins-debian1) Thu, 30 Sep 2021 08:10:27 +0000 swh-loader-svn (0.7.1-1~swh1) unstable-swh; urgency=medium * New upstream release 0.7.1 - (tagged by Antoine Lambert on 2021-04-29 14:31:33 +0200) * Upstream changes: - version 0.7.1 -- Software Heritage autobuilder (on jenkins-debian1) Thu, 29 Apr 2021 12:34:51 +0000 swh-loader-svn (0.7.0-1~swh1) unstable-swh; urgency=medium * New upstream release 0.7.0 - (tagged by Antoine R. Dumont (@ardumont) on 2021-02-17 18:19:35 +0100) * Upstream changes: - v0.7.0 - loader: Expect visit_date as an optional date in constructors - Rework loader instantiation logic according to loader core api -- Software Heritage autobuilder (on jenkins-debian1) Wed, 17 Feb 2021 17:23:16 +0000 swh-loader-svn (0.6.0-1~swh2) unstable-swh; urgency=medium * Update dependencies -- Antoine R. Dumont (@ardumont) Fri, 12 Feb 2021 18:05:59 +0100 swh-loader-svn (0.6.0-1~swh1) unstable-swh; urgency=medium * New upstream release 0.6.0 - (tagged by Antoine R. Dumont (@ardumont) on 2021-02-12 17:31:53 +0100) * Upstream changes: - v0.6.0 - svn.loader: Mark visit status as not_found when relevant - svn.loader: Mark visit status as failed - Drop the retrying dependency - tox.ini: pin black to the pre-commit version (19.10b0) to avoid flip-flops -- Software Heritage autobuilder (on jenkins-debian1) Fri, 12 Feb 2021 16:33:45 +0000 swh-loader-svn (0.5.0-1~swh1) unstable-swh; urgency=medium * New upstream release 0.5.0 - (tagged by Antoine R. Dumont (@ardumont) on 2020-10-02 14:16:50 +0200) * Upstream changes: - v0.5.0 - svn.loader: Migrate away from SWHConfig mixin - tests: Don't check the number of created 'person' objects - python: Reorder imports with isort - pre- commit: Add isort hook and configuration - pre-commit: Update flake8 hook configuration -- Software Heritage autobuilder (on jenkins-debian1) Fri, 02 Oct 2020 12:17:49 +0000 swh-loader-svn (0.4.1-1~swh1) unstable-swh; urgency=medium * New upstream release 0.4.1 - (tagged by Antoine Lambert on 2020-09-08 17:48:55 +0200) * Upstream changes: - version 0.4.1 -- Software Heritage autobuilder (on jenkins-debian1) Tue, 08 Sep 2020 15:53:11 +0000 swh-loader-svn (0.4.0-1~swh1) unstable-swh; urgency=medium * New upstream release 0.4.0 - (tagged by Antoine R. Dumont (@ardumont) on 2020-09-04 14:05:14 +0200) * Upstream changes: - v0.4.0 - Adapt storage.revision_get calls according to latest api change - Tell pytest not to recurse in dotdirs. -- Software Heritage autobuilder (on jenkins-debian1) Fri, 04 Sep 2020 12:07:00 +0000 swh-loader-svn (0.3.3-1~swh1) unstable-swh; urgency=medium * New upstream release 0.3.3 - (tagged by Antoine R. Dumont (@ardumont) on 2020-08-24 16:00:11 +0200) * Upstream changes: - v0.3.3 - svn.loader: Simplify and align incremental visit algorithm -- Software Heritage autobuilder (on jenkins-debian1) Mon, 24 Aug 2020 14:01:22 +0000 swh-loader-svn (0.3.2-1~swh1) unstable-swh; urgency=medium * New upstream release 0.3.2 - (tagged by Antoine R. Dumont (@ardumont) on 2020-07-28 08:07:12 +0200) * Upstream changes: - v0.3.2 - Migrate to setuptools-scm - Add missing conftest.py in MANIFEST.in -- Software Heritage autobuilder (on jenkins-debian1) Tue, 28 Jul 2020 06:09:53 +0000 swh-loader-svn (0.3.1-1~swh1) unstable-swh; urgency=medium * New upstream release 0.3.1 - (tagged by Antoine R. Dumont (@ardumont) on 2020-07-28 07:50:03 +0200) * Upstream changes: - v0.3.1 - loader: Update swh.storage.origin_get call to latest api change - tests: Reuse pytest fixtures from swh.loader.core - tests: Check against snapshot model object - svn.loader: Drop `build_swh_snapshot` function, oneliner used once - Fix branches types in tests - Clean up the swh.scheduler / swh.storage pytest plugin imports -- Software Heritage autobuilder (on jenkins-debian1) Tue, 28 Jul 2020 05:52:35 +0000 swh-loader-svn (0.3.0-1~swh1) unstable-swh; urgency=medium * New upstream release 0.3.0 - (tagged by David Douard on 2020-07-08 17:18:02 +0200) * Upstream changes: - v0.3.0 -- Software Heritage autobuilder (on jenkins-debian1) Wed, 08 Jul 2020 15:22:12 +0000 swh-loader-svn (0.2.1-1~swh1) unstable-swh; urgency=medium * New upstream release 0.2.1 - (tagged by Antoine R. Dumont (@ardumont) on 2020-07-03 15:17:44 +0200) * Upstream changes: - v0.2.1 - svn.loader: Fix uneventful visit case - svn.loader: Fix edge case on mistyped snapshot - tests: Refactor to use pytest - Reuse swh.model.from_disk.iter_directory function - Migrate to Use the object's object_type field when computing objects -- Software Heritage autobuilder (on jenkins-debian1) Fri, 03 Jul 2020 13:20:20 +0000 swh-loader-svn (0.2.0-1~swh1) unstable-swh; urgency=medium * New upstream release 0.2.0 - (tagged by Antoine R. Dumont (@ardumont) on 2020-06-23 15:25:21 +0200) * Upstream changes: - v0.2.0 - loader: Read snapshot out of the last origin visit status - tests: Refactor tests to use assert_last_visit_matches -- Software Heritage autobuilder (on jenkins-debian1) Tue, 23 Jun 2020 13:26:50 +0000 swh-loader-svn (0.1.2-1~swh1) unstable-swh; urgency=medium * New upstream release 0.1.2 - (tagged by Antoine R. Dumont (@ardumont) on 2020-06-09 11:03:56 +0200) * Upstream changes: - v0.1.2 - test_loader: assert returned loader status is what we expect - Adapt to swh.model 0.3 -- Software Heritage autobuilder (on jenkins-debian1) Tue, 09 Jun 2020 09:06:01 +0000 swh-loader-svn (0.1.1-1~swh3) unstable-swh; urgency=medium * Enable build for python3.8 (Debian ships a patched subvertpy.) -- Nicolas Dandrimont Wed, 03 Jun 2020 16:27:53 +0200 swh-loader-svn (0.1.1-1~swh2) unstable-swh; urgency=medium * Force removing __init__.py files. -- Nicolas Dandrimont Wed, 03 Jun 2020 16:13:31 +0200 swh-loader-svn (0.1.1-1~swh1) unstable-swh; urgency=medium * New upstream release 0.1.1 - (tagged by Antoine Lambert on 2020-06-03 11:49:31 +0200) * Upstream changes: - version 0.1.1 -- Software Heritage autobuilder (on jenkins-debian1) Wed, 03 Jun 2020 09:53:23 +0000 swh-loader-svn (0.1.0-1~swh1) unstable-swh; urgency=medium * New upstream release 0.1.0 - (tagged by Nicolas Dandrimont on 2020-06-02 18:54:30 +0200) * Upstream changes: - Release swh.loader.svn v0.1.0 - Blacken all files - Fix compatibility with swh.loader.core v0.1.0 - Fix parameter ordering for loader tasks -- Software Heritage autobuilder (on jenkins-debian1) Tue, 02 Jun 2020 16:58:55 +0000 swh-loader-svn (0.0.54-1~swh1) unstable-swh; urgency=medium * New upstream release 0.0.54 - (tagged by Antoine R. Dumont (@ardumont) on 2020-03-27 07:52:30 +0100) * Upstream changes: - v0.0.54 - svn.loader: Let core loader update snapshot & visit at the same time - test_loader: Add missing assertions on visit status - Fix crash on None snapshot -- Software Heritage autobuilder (on jenkins-debian1) Fri, 27 Mar 2020 06:57:15 +0000 swh-loader-svn (0.0.53-1~swh1) unstable-swh; urgency=medium * New upstream release 0.0.53 - (tagged by Antoine R. Dumont (@ardumont) on 2020-03-16 13:38:29 +0100) * Upstream changes: - v0.0.53 - Migrate to latest swh-loader- core api change - Move Person parsing to swh-model. -- Software Heritage autobuilder (on jenkins-debian1) Mon, 16 Mar 2020 12:41:14 +0000 swh-loader-svn (0.0.52-1~swh1) unstable-swh; urgency=medium * New upstream release 0.0.52 - (tagged by Antoine R. Dumont (@ardumont) on 2020-03-02 15:39:28 +0100) * Upstream changes: - v0.0.52 - loader.svn: Use swh.model objects within the loader - tox.ini: Add debugging dev tool in dedicated environment - converters: Clean up some more dead code - converters: Clean up dead code -- Software Heritage autobuilder (on jenkins-debian1) Mon, 02 Mar 2020 14:42:36 +0000 swh-loader-svn (0.0.51-1~swh1) unstable-swh; urgency=medium * New upstream release 0.0.51 - (tagged by Nicolas Dandrimont on 2020-02-19 20:01:31 +0100) * Upstream changes: - Release swh.loader.svn v0.0.51 - Ensure snapshots are properly linked by origin_visits - Update tests for swh.storage v0.0.174 -- Software Heritage autobuilder (on jenkins-debian1) Wed, 19 Feb 2020 19:20:03 +0000 swh-loader-svn (0.0.50-1~swh1) unstable-swh; urgency=medium * New upstream release 0.0.50 - (tagged by Antoine R. Dumont (@ardumont) on 2020-02-06 18:45:10 +0100) * Upstream changes: - v0.0.50 - loader.svn: Call storage's (skipped_)content_add endpoints - Fix sphinx warnings -- Software Heritage autobuilder (on jenkins-debian1) Thu, 06 Feb 2020 17:57:08 +0000 swh-loader-svn (0.0.49-1~swh1) unstable-swh; urgency=medium * New upstream release 0.0.49 - (tagged by Antoine R. Dumont (@ardumont) on 2020-01-15 15:59:52 +0100) * Upstream changes: - v0.0.49 - svn.loader: Adapt according to latest loader-core simplification -- Software Heritage autobuilder (on jenkins-debian1) Wed, 15 Jan 2020 15:03:50 +0000 swh-loader-svn (0.0.48-1~swh1) unstable-swh; urgency=medium * New upstream release 0.0.48 - (tagged by Antoine R. Dumont (@ardumont) on 2019-12-12 14:14:12 +0100) * Upstream changes: - v0.0.48 - svn.loader: Migrate to new buffer/filter behavior -- Software Heritage autobuilder (on jenkins-debian1) Thu, 12 Dec 2019 13:17:31 +0000 swh-loader-svn (0.0.47-1~swh1) unstable-swh; urgency=medium * New upstream release 0.0.47 - (tagged by Antoine R. Dumont (@ardumont) on 2019-12-12 11:18:45 +0100) * Upstream changes: - v0.0.47 - tasks: Enforce kwargs use in task message -- Software Heritage autobuilder (on jenkins-debian1) Thu, 12 Dec 2019 10:21:55 +0000 swh-loader-svn (0.0.46-1~swh2) unstable-swh; urgency=medium * Fix build for python3.7 only -- Antoine R. Dumont (@ardumont) Sat, 16 Feb 2019 02:43:37 +0100 swh-loader-svn (0.0.46-1~swh1) unstable-swh; urgency=medium * New upstream release 0.0.46 - (tagged by Antoine R. Dumont (@ardumont) on 2019-12-10 10:30:35 +0100) * Upstream changes: - v0.0.46 - tests: Migrate to use pytest- mock's mocker fixture - tasks: Use celery's shared_task decorator - loader.svn: Register svn worker - svn.tasks: Rename tasks according to production's - tasks: Adapt tasks according to the constructor unification - svn: Unify loader constructor with url as parameter - Fix a typo reported by codespell - Add a pre-commit config file - Migrate tox.ini to extras = xxx instead of deps = .[testing] - De-specify testenv:py3 - Include all requirements in MANIFEST.in -- Software Heritage autobuilder (on jenkins-debian1) Tue, 10 Dec 2019 09:38:45 +0000 swh-loader-svn (0.0.45-1~swh1) unstable-swh; urgency=medium * New upstream release 0.0.45 - (tagged by Stefano Zacchiroli on 2019-10-10 14:43:18 +0200) * Upstream changes: - v0.0.45 - * typing: minimal changes to make a no-op mypy run pass - * tox.ini: Fix py3 environment to use packaged tests - * Add attribute visit_type. - * Fix warning about pytest.mark.fs. - * add code of conduct document - * CONTRIBUTORS: add Ishan Bhanuka - * Remove unnecessary noqa - * Update dependency on swh-storage. - * Update argument name. - * Use origin urls instead of origin ids. - * update requirements - * Update coverage gitignore - * SvnLoaderFromRemoteDump: Add some debug output when svnrdump is running - * Remove debian packaging from master branch -- Software Heritage autobuilder (on jenkins-debian1) Thu, 10 Oct 2019 12:46:37 +0000 swh-loader-svn (0.0.44-1~swh3) unstable-swh; urgency=low * New upstream release (fixing the distribution) -- Antoine Romain Dumont Sat, 16 Feb 2019 02:43:37 +0100 swh-loader-svn (0.0.44-1~swh2) unstable; urgency=low * New upstream release to fix debian packaging -- Antoine Romain Dumont Sat, 16 Feb 2019 02:19:27 +0100 swh-loader-svn (0.0.44-1~swh1) unstable-swh; urgency=medium * New upstream release 0.0.44 - (tagged by David Douard on 2019-02-07 17:35:43 +0100) * Upstream changes: - v0.0.44 -- Software Heritage autobuilder (on jenkins-debian1) Thu, 07 Feb 2019 16:41:45 +0000 swh-loader-svn (0.0.42-1~swh1) unstable-swh; urgency=medium * v0.0.43 * loader: Rename default branch as HEAD * svn.tests: Refactor using loader-core mixins * setup: prepare for pypi upload * Add requirements-test.txt * docs: add title and brief module description -- Antoine R. Dumont (@ardumont) Thu, 11 Oct 2018 14:52:54 +0200 swh-loader-svn (0.0.41-1~swh1) unstable-swh; urgency=medium * v0.0.41 * Fix UnicodeDecodeError when decoding user-defined svn properties * preventing the origin ingestion to finish (T946) * Fix CR/LF issue preventing the origin ingestion to finish (T570) * svn.loader: Add more efficient loader based on remote dumps * svn.loader: Refactoring (align loader with other, name conventions, * improve maintenance, simplify some code, etc...) -- Antoine R. Dumont (@ardumont) Fri, 28 Sep 2018 12:16:31 +0200 swh-loader-svn (0.0.40-1~swh1) unstable-swh; urgency=medium * v0.0.40 * svn/loader: Remove wrong parameter name in dangling clean up call * svn/loader: Refactor: Reuse loader.core.utils.clean_dangling_folders * svn/tasks: Explicit tasks' arguments * svn/loader: Add pre-cleanup step to clean potential dangling folders * d/control: Bump to latest python3-swh.loader.core -- Antoine R. Dumont (@ardumont) Fri, 09 Mar 2018 14:51:09 +0100 swh-loader-svn (0.0.39-1~swh1) unstable-swh; urgency=medium * v0.0.39 * Improve origin_visit initialization step * Properly sandbox the prepare statement so that if it breaks, we can * update appropriately the visit with the correct status -- Antoine R. Dumont (@ardumont) Wed, 07 Mar 2018 11:31:34 +0100 swh-loader-svn (0.0.38-1~swh1) unstable-swh; urgency=medium * v0.0.38 * In failure mode, try harder to make snapshot -- Antoine R. Dumont (@ardumont) Fri, 09 Feb 2018 14:13:30 +0100 swh-loader-svn (0.0.37-1~swh1) unstable-swh; urgency=medium * v0.0.37 * swh.loader.svn: Detect eol inconsistency and make the loading fail * swh.loader.svn: Reduce log verbosity * swh.loader.svn: Migrate exception to their specific module -- Antoine R. Dumont (@ardumont) Thu, 08 Feb 2018 17:57:15 +0100 swh-loader-svn (0.0.36-1~swh1) unstable-swh; urgency=medium * v0.0.36 * swh.loader.svn: Fix corner edge case on symbolic link * swh.loader.svn: Deal with empty svn repository edge case -- Antoine R. Dumont (@ardumont) Wed, 07 Feb 2018 12:36:45 +0100 swh-loader-svn (0.0.35-1~swh1) unstable-swh; urgency=medium * Release swh.loader.svn v0.0.35 * Update to use snapshots instead of occurrences * Properly return loader status to scheduler -- Nicolas Dandrimont Tue, 06 Feb 2018 14:40:28 +0100 swh-loader-svn (0.0.34-1~swh1) unstable-swh; urgency=medium * v0.0.34 * Unify temporary directory naming -- Antoine R. Dumont (@ardumont) Fri, 15 Dec 2017 12:26:50 +0100 swh-loader-svn (0.0.33-1~swh1) unstable-swh; urgency=medium * v0.0.33 * swh.loader.svn: Add option to load a repository from scratch * swh.loader.svn.loader: Fix special symlink case -- Antoine R. Dumont (@ardumont) Fri, 08 Dec 2017 17:38:37 +0100 swh-loader-svn (0.0.32-1~swh1) unstable-swh; urgency=medium * v0.0.32 * d/control: Bump dependency to latest swh-loader-core * tests: Add commits with wrong symbolic links (broken, empty space) * ra: Fix not cleaned up path leading to file exists error * docs: add absolute anchor to documentation index -- Antoine R. Dumont (@ardumont) Wed, 08 Nov 2017 13:22:42 +0100 swh-loader-svn (0.0.31-1~swh1) unstable-swh; urgency=medium * v0.0.31 * swh.loader.svn.ra: Fix blank space in symlink path split problem * swh.loader.svn.ra: Fix missing case about existing directory * swh.loader.svn.ra: Explicit the closure * swh.loader.svn: Deal with origin creation inhibition in base class * swh.loader.svn: Remove unneeded instruction * swh.loader.svn: Fix initializing the origin multiple times * swh.loader.svn: Remove unneeded except clause * swh.loader.svn: uneventful visit is not an error -- Antoine R. Dumont (@ardumont) Tue, 24 Oct 2017 16:35:01 +0200 swh-loader-svn (0.0.30-1~swh1) unstable-swh; urgency=medium * Release swh.loader.svn version 0.0.30 * Update packaging runes -- Nicolas Dandrimont Thu, 12 Oct 2017 18:07:58 +0200 swh-loader-svn (0.0.29-1~swh1) unstable-swh; urgency=medium * v0.0.29 * swh.loader.svn.loader: Fix missing revision id key (which can lead * to an empty partial visit for example in the case of a repository * holding an svn:externals property). -- Antoine R. Dumont (@ardumont) Mon, 09 Oct 2017 16:02:23 +0200 swh-loader-svn (0.0.28-1~swh1) unstable-swh; urgency=medium * Release swh.loader.svn v0.0.28 * Replace swh.model.git with swh.model.from_disk -- Nicolas Dandrimont Fri, 06 Oct 2017 17:18:57 +0200 swh-loader-svn (0.0.27-1~swh1) unstable-swh; urgency=medium * v0.0.27 * d/control: Bump dependency to latest swh.loader.core * swh.loader.svn: Add args to raised exception in edge cases * swh-hashtree: Fix no longer existing swh.core.hashutil import * docs/: add sphinx apidoc generation skeleton -- Antoine R. Dumont (@ardumont) Tue, 03 Oct 2017 19:01:26 +0200 swh-loader-svn (0.0.26-1~swh1) unstable-swh; urgency=medium * Release swh.loader.svn 0.0.26 * update tasks to new swh.scheduler API -- Nicolas Dandrimont Mon, 12 Jun 2017 18:25:40 +0200 swh-loader-svn (0.0.25-1~swh1) unstable-swh; urgency=medium * v0.0.25 * Add blake2s256 new hash computation on content * Use gzip instead of pigz * Migrate from swh.core.hashutil to swh.model.hashutil -- Antoine R. Dumont (@ardumont) Tue, 04 Apr 2017 14:18:57 +0200 swh-loader-svn (0.0.24-1~swh1) unstable-swh; urgency=medium * v0.0.24 * Simplify loader's logic -- Antoine R. Dumont (@ardumont) Wed, 22 Feb 2017 14:09:15 +0100 swh-loader-svn (0.0.23-1~swh1) unstable-swh; urgency=medium * Release swh.loader.svn v0.0.23 * Return timestamps as pairs of integers (Close T680) -- Nicolas Dandrimont Tue, 14 Feb 2017 19:40:27 +0100 swh-loader-svn (0.0.22-1~swh1) unstable-swh; urgency=medium * v0.0.22 * Pass optionally the visit date to producer -- Antoine R. Dumont (@ardumont) Tue, 10 Jan 2017 15:03:45 +0100 swh-loader-svn (0.0.21-1~swh1) unstable-swh; urgency=medium * v0.0.21 * Use the dump's fetch date as visit date -- Antoine R. Dumont (@ardumont) Tue, 10 Jan 2017 15:03:24 +0100 swh-loader-svn (0.0.20-1~swh1) unstable-swh; urgency=medium * v0.0.20 * Fix function call -- Antoine R. Dumont (@ardumont) Fri, 06 Jan 2017 15:38:14 +0100 swh-loader-svn (0.0.19-1~swh1) unstable-swh; urgency=medium * v0.0.19 * Rename task_queue adequately * Fix - Remove empty temporary directory in corner cases * Fix generator issue when using local storage -- Antoine R. Dumont (@ardumont) Fri, 06 Jan 2017 14:10:19 +0100 swh-loader-svn (0.0.18-1~swh1) unstable-swh; urgency=medium * v0.0.18 * Add check revision hash computation divergence during loading * Add task to load a svn repository from an archive dump and load the * repository * Raise error when svn:externals keyword is encountered (T610) since * it's not dealt with yet. * Revert modifications related to svn:eol-style since no good policy has * been found yet to deal with it -- Antoine R. Dumont (@ardumont) Thu, 15 Dec 2016 10:57:26 +0100 swh-loader-svn (0.0.17-1~swh1) unstable-swh; urgency=medium * v0.0.17 * Force eol conversion when needed -- Antoine R. Dumont (@ardumont) Thu, 08 Dec 2016 18:25:55 +0100 swh-loader-svn (0.0.16-1~swh1) unstable-swh; urgency=medium * v0.0.16 * Improve origin_visit policy -- Antoine R. Dumont (@ardumont) Fri, 26 Aug 2016 15:59:31 +0200 swh-loader-svn (0.0.15-1~swh1) unstable-swh; urgency=medium * v0.0.15 * Update svn loader to register origin_visit's state -- Antoine R. Dumont (@ardumont) Wed, 24 Aug 2016 14:56:54 +0200 swh-loader-svn (0.0.14-1~swh1) unstable-swh; urgency=medium * v0.0.14 * Update svn loader to register origin_visit's state -- Antoine R. Dumont (@ardumont) Tue, 23 Aug 2016 16:38:16 +0200 swh-loader-svn (0.0.13-1~swh1) unstable-swh; urgency=medium * v0.0.13 -- Antoine R. Dumont (@ardumont) Thu, 18 Aug 2016 10:30:13 +0200 swh-loader-svn (0.0.12-1~swh1) unstable-swh; urgency=medium * v0.0.12 * Inhibit keyword expansion during export phase (svn update) -- Antoine R. Dumont (@ardumont) Wed, 06 Jul 2016 16:17:51 +0200 swh-loader-svn (0.0.11-1~swh1) unstable-swh; urgency=medium * v0.0.11 * Reschedule when error on loading an svn repository * Start from last known revision * Permit to load local mirror with remote mirror origin -- Antoine R. Dumont (@ardumont) Fri, 01 Jul 2016 16:51:37 +0200 swh-loader-svn (0.0.10-1~swh1) unstable-swh; urgency=medium * v0.0.10 * Add retry policy around britle action (connection to remote svn server) -- Antoine R. Dumont (@ardumont) Sat, 25 Jun 2016 11:30:34 +0200 swh-loader-svn (0.0.9-1~swh1) unstable-swh; urgency=medium * v0.0.9 * Restrict loader to 2 possible policies: swh, git-svn * Improve coverage * Update README -- Antoine R. Dumont (@ardumont) Fri, 24 Jun 2016 13:56:54 +0200 swh-loader-svn (0.0.8-1~swh1) unstable-swh; urgency=medium * v0.0.8 * Use remote-access approach to hash and compute hashes from svn * repository (migrate major dependency from pysvn to subvertpy) -- Antoine R. Dumont (@ardumont) Sat, 11 Jun 2016 19:55:54 +0200 swh-loader-svn (0.0.7-1~swh1) unstable-swh; urgency=medium * v0.0.7 * d/control: Bump dependency version to latest swh-model -- Antoine R. Dumont (@ardumont) Thu, 26 May 2016 16:10:32 +0200 swh-loader-svn (0.0.6-1~swh1) unstable-swh; urgency=medium * v0.0.6 * d/control: Bump swh-model dependency * Simplify ignore folder corner cases * Rework log -- Antoine R. Dumont (@ardumont) Wed, 25 May 2016 23:53:10 +0200 swh-loader-svn (0.0.5-1~swh1) unstable-swh; urgency=medium * v0.0.5 * Add svn update behavior as option (default to True) * d/control: Bump dependency version to swh-loader-core -- Antoine R. Dumont (@ardumont) Wed, 25 May 2016 12:44:35 +0200 swh-loader-svn (0.0.4-1~swh1) unstable-swh; urgency=medium * v0.0.4 * Add options for git-svn like behavior (git svn clone --no- metadata) * Ignore empty folder * Add extra-line in svn commit message * No revision metadata (beware that this break the update repo * mechanism) * Also, use @ pattern for committer/author -- Antoine R. Dumont (@ardumont) Tue, 24 May 2016 17:04:40 +0200 swh-loader-svn (0.0.3-1~swh1) unstable-swh; urgency=medium * v0.0.3 * Improve filesystem cleanup (before: left empty directory) * Use pysvn to extract uuid information (before: subprocess with subversion call) * Keep the working copy's name on the local checkout -- Antoine R. Dumont (@ardumont) Fri, 15 Apr 2016 16:10:51 +0200 swh-loader-svn (0.0.2-1~swh1) unstable-swh; urgency=medium * v0.0.2 * Update to the right swh dependencies. -- Antoine R. Dumont (@ardumont) Fri, 15 Apr 2016 13:02:04 +0200 swh-loader-svn (0.0.1-1~swh1) unstable-swh; urgency=medium * Initial release * v0.0.1 -- Antoine R. Dumont (@ardumont) Wed, 13 Apr 2016 16:46:37 +0200 diff --git a/swh.loader.svn.egg-info/PKG-INFO b/swh.loader.svn.egg-info/PKG-INFO index 4001d4a..423ffc0 100644 --- a/swh.loader.svn.egg-info/PKG-INFO +++ b/swh.loader.svn.egg-info/PKG-INFO @@ -1,57 +1,57 @@ Metadata-Version: 2.1 Name: swh.loader.svn -Version: 1.3.3 +Version: 1.3.4 Summary: Software Heritage Loader SVN Home-page: https://forge.softwareheritage.org/diffusion/DLDSVN Author: Software Heritage developers Author-email: swh-devel@inria.fr Project-URL: Bug Reports, https://forge.softwareheritage.org/maniphest Project-URL: Funding, https://www.softwareheritage.org/donate Project-URL: Source, https://forge.softwareheritage.org/source/swh-loader-svn Project-URL: Documentation, https://docs.softwareheritage.org/devel/swh-loader-svn/ Classifier: Programming Language :: Python :: 3 Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3) Classifier: Operating System :: OS Independent Classifier: Development Status :: 5 - Production/Stable Requires-Python: >=3.7 Description-Content-Type: text/markdown Provides-Extra: testing License-File: LICENSE License-File: AUTHORS swh-loader-svn ============== The Software Heritage SVN Loader is a tool and a library to walk a remote svn repository and inject into the SWH dataset all contained files that weren't known before. The main entry points are - :class:`swh.loader.svn.loader.SvnLoader` for the main svn loader which ingests content out of a remote svn repository - :class:`swh.loader.svn.loader.SvnLoaderFromDumpArchive` which mounts a repository out of a svn dump prior to ingest it. - :class:`swh.loader.svn.loader.SvnLoaderFromRemoteDump` which mounts a repository with svnrdump prior to ingest its content. # CLI run With the configuration: /tmp/loader_svn.yml: ``` storage: cls: remote args: url: http://localhost:5002/ ``` Run: ``` swh loader --config-file /tmp/loader_svn.yml \ run svn ``` diff --git a/swh/loader/svn/tests/test_utils.py b/swh/loader/svn/tests/test_utils.py index a41a8f4..ccc3c2a 100644 --- a/swh/loader/svn/tests/test_utils.py +++ b/swh/loader/svn/tests/test_utils.py @@ -1,416 +1,428 @@ # Copyright (C) 2016-2022 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information import logging import os import pty import shutil from subprocess import Popen import pytest from swh.loader.svn import utils def test_outputstream(): stdout_r, stdout_w = pty.openpty() echo = Popen(["echo", "-e", "foo\nbar\nbaz"], stdout=stdout_w) os.close(stdout_w) stdout_stream = utils.OutputStream(stdout_r) lines = [] while True: current_lines, readable = stdout_stream.read_lines() lines += current_lines if not readable: break echo.wait() os.close(stdout_r) assert lines == ["foo", "bar", "baz"] def test_init_svn_repo_from_dump(datadir, tmp_path): """Mounting svn repository out of a dump is ok""" dump_name = "penguinsdbtools2018.dump.gz" dump_path = os.path.join(datadir, dump_name) tmp_repo, repo_path = utils.init_svn_repo_from_dump( dump_path, gzip=True, cleanup_dump=False, root_dir=tmp_path ) assert os.path.exists(dump_path), "Dump path should still exists" assert os.path.exists(repo_path), "Repository should exists" def test_init_svn_repo_from_dump_and_cleanup(datadir, tmp_path): """Mounting svn repository with a dump cleanup after is ok""" dump_name = "penguinsdbtools2018.dump.gz" dump_ori_path = os.path.join(datadir, dump_name) dump_path = os.path.join(tmp_path, dump_name) shutil.copyfile(dump_ori_path, dump_path) assert os.path.exists(dump_path) assert os.path.exists(dump_ori_path) tmp_repo, repo_path = utils.init_svn_repo_from_dump( dump_path, gzip=True, root_dir=tmp_path ) assert not os.path.exists(dump_path), "Dump path should no longer exists" assert os.path.exists(repo_path), "Repository should exists" assert os.path.exists(dump_ori_path), "Original dump path should still exists" def test_init_svn_repo_from_dump_and_cleanup_already_done( datadir, tmp_path, mocker, caplog ): """Mounting svn repository out of a dump is ok""" caplog.set_level(logging.INFO, "swh.loader.svn.utils") dump_name = "penguinsdbtools2018.dump.gz" dump_ori_path = os.path.join(datadir, dump_name) mock_remove = mocker.patch("os.remove") mock_remove.side_effect = FileNotFoundError dump_path = os.path.join(tmp_path, dump_name) shutil.copyfile(dump_ori_path, dump_path) assert os.path.exists(dump_path) assert os.path.exists(dump_ori_path) tmp_repo, repo_path = utils.init_svn_repo_from_dump( dump_path, gzip=True, root_dir=tmp_path ) assert os.path.exists(repo_path), "Repository should exists" assert os.path.exists(dump_ori_path), "Original dump path should still exists" assert len(caplog.record_tuples) == 1 assert "Failure to remove" in caplog.record_tuples[0][2] assert mock_remove.called def test_init_svn_repo_from_archive_dump(datadir, tmp_path): """Mounting svn repository out of an archive dump is ok""" dump_name = "penguinsdbtools2018.dump.gz" dump_path = os.path.join(datadir, dump_name) tmp_repo, repo_path = utils.init_svn_repo_from_archive_dump( dump_path, cleanup_dump=False, root_dir=tmp_path ) assert os.path.exists(dump_path), "Dump path should still exists" assert os.path.exists(repo_path), "Repository should exists" def test_init_svn_repo_from_archive_dump_and_cleanup(datadir, tmp_path): """Mounting svn repository out of a dump is ok""" dump_name = "penguinsdbtools2018.dump.gz" dump_ori_path = os.path.join(datadir, dump_name) dump_path = os.path.join(tmp_path, dump_name) shutil.copyfile(dump_ori_path, dump_path) assert os.path.exists(dump_path) assert os.path.exists(dump_ori_path) tmp_repo, repo_path = utils.init_svn_repo_from_archive_dump( dump_path, root_dir=tmp_path ) assert not os.path.exists(dump_path), "Dump path should no longer exists" assert os.path.exists(repo_path), "Repository should exists" assert os.path.exists(dump_ori_path), "Original dump path should still exists" @pytest.mark.parametrize( "base_url, paths_to_join, expected_result", [ ( "https://svn.example.org", ["repos", "test"], "https://svn.example.org/repos/test", ), ( "https://svn.example.org/", ["repos", "test"], "https://svn.example.org/repos/test", ), ( "https://svn.example.org/foo", ["repos", "test"], "https://svn.example.org/foo/repos/test", ), ( "https://svn.example.org/foo/", ["/repos", "test/"], "https://svn.example.org/foo/repos/test", ), ( "https://svn.example.org/foo", ["../bar"], "https://svn.example.org/bar", ), ], ) def test_svn_urljoin(base_url, paths_to_join, expected_result): assert utils.svn_urljoin(base_url, *paths_to_join) == expected_result @pytest.mark.parametrize( "external, dir_path, repo_url, expected_result", [ # subversion < 1.5 ( "third-party/sounds http://svn.example.com/repos/sounds", "trunk/externals", "http://svn.example.org/repos/test", ("third-party/sounds", "http://svn.example.com/repos/sounds", None, False), ), ( "third-party/skins -r148 http://svn.example.com/skinproj", "trunk/externals", "http://svn.example.org/repos/test", ("third-party/skins", "http://svn.example.com/skinproj", 148, False), ), ( "third-party/skins/toolkit -r21 http://svn.example.com/skin-maker", "trunk/externals", "http://svn.example.org/repos/test", ( "third-party/skins/toolkit", "http://svn.example.com/skin-maker", 21, False, ), ), # subversion >= 1.5 ( " http://svn.example.com/repos/sounds third-party/sounds", "trunk/externals", "http://svn.example.org/repos/test", ("third-party/sounds", "http://svn.example.com/repos/sounds", None, False), ), ( "-r148 http://svn.example.com/skinproj third-party/skins", "trunk/externals", "http://svn.example.org/repos/test", ("third-party/skins", "http://svn.example.com/skinproj", 148, False), ), ( "-r 21 http://svn.example.com/skin-maker third-party/skins/toolkit", "trunk/externals", "http://svn.example.org/repos/test", ( "third-party/skins/toolkit", "http://svn.example.com/skin-maker", 21, False, ), ), ( "http://svn.example.com/repos/sounds third-party/sounds", "trunk/externals", "http://svn.example.org/repos/test", ("third-party/sounds", "http://svn.example.com/repos/sounds", None, False), ), ( "http://svn.example.com/skinproj@148 third-party/skins", "trunk/externals", "http://svn.example.org/repos/test", ("third-party/skins", "http://svn.example.com/skinproj", 148, False), ), ( "http://anon:anon@svn.example.com/skin-maker@21 third-party/skins/toolkit", "trunk/externals", "http://svn.example.org/repos/test", ( "third-party/skins/toolkit", "http://anon:anon@svn.example.com/skin-maker", 21, False, ), ), ( "-r21 http://anon:anon@svn.example.com/skin-maker third-party/skins/toolkit", # noqa "trunk/externals", "http://svn.example.org/repos/test", ( "third-party/skins/toolkit", "http://anon:anon@svn.example.com/skin-maker", 21, False, ), ), ( "-r21 http://anon:anon@svn.example.com/skin-maker@21 third-party/skins/toolkit", # noqa "trunk/externals", "http://svn.example.org/repos/test", ( "third-party/skins/toolkit", "http://anon:anon@svn.example.com/skin-maker", 21, False, ), ), # subversion >= 1.5, relative external definitions ( "^/sounds third-party/sounds", "trunk/externals", "http://svn.example.org/repos/test", ( "third-party/sounds", "http://svn.example.org/repos/test/sounds", None, False, ), ), ( "/skinproj@148 third-party/skins", "trunk/externals", "http://svn.example.org/repos/test", ("third-party/skins", "http://svn.example.org/skinproj", 148, True), ), ( "//svn.example.com/skin-maker@21 third-party/skins/toolkit", "trunk/externals", "http://svn.example.org/repos/test", ( "third-party/skins/toolkit", "http://svn.example.com/skin-maker", 21, True, ), ), ( "^/../../skin-maker@21 third-party/skins/toolkit", "trunk/externals", "http://svn.example.org/repos/test", ( "third-party/skins/toolkit", "http://svn.example.org/skin-maker", 21, True, ), ), ( "../skins skins", "trunk/externals", "http://svn.example.org/repos/test", ("skins", "http://svn.example.org/repos/test/trunk/skins", None, False), ), ( "../skins skins", "trunk/externals", "http://svn.example.org/repos/test", ("skins", "http://svn.example.org/repos/test/trunk/skins", None, False), ), # subversion >= 1.6 ( 'http://svn.thirdparty.com/repos/My%20Project "My Project"', "trunk/externals", "http://svn.example.org/repos/test", ("My Project", "http://svn.thirdparty.com/repos/My%20Project", None, False), ), ( 'http://svn.thirdparty.com/repos/My%20%20%20Project "My Project"', "trunk/externals", "http://svn.example.org/repos/test", ( "My Project", "http://svn.thirdparty.com/repos/My%20%20%20Project", None, False, ), ), ( 'http://svn.thirdparty.com/repos/%22Quotes%20Too%22 \\"Quotes\\ Too\\"', "trunk/externals", "http://svn.example.org/repos/test", ( '"Quotes Too"', "http://svn.thirdparty.com/repos/%22Quotes%20Too%22", None, False, ), ), ( 'http://svn.thirdparty.com/repos/%22Quotes%20%20%20Too%22 \\"Quotes\\ \\ \\ Too\\"', # noqa "trunk/externals", "http://svn.example.org/repos/test", ( '"Quotes Too"', "http://svn.thirdparty.com/repos/%22Quotes%20%20%20Too%22", None, False, ), ), # edge cases ( '-r1 http://svn.thirdparty.com/repos/test "trunk/PluginFramework"', "trunk/externals", "http://svn.example.org/repos/test", ("trunk/PluginFramework", "http://svn.thirdparty.com/repos/test", 1, False), ), ( "external -r 9 http://svn.thirdparty.com/repos/test", "tags", "http://svn.example.org/repos/test", ("external", "http://svn.thirdparty.com/repos/test", 9, False), ), ( "./external http://svn.thirdparty.com/repos/test", "tags", "http://svn.example.org/repos/test", ("external", "http://svn.thirdparty.com/repos/test", None, False), ), ( ".external http://svn.thirdparty.com/repos/test", "tags", "http://svn.example.org/repos/test", (".external", "http://svn.thirdparty.com/repos/test", None, False), ), ( "external/ http://svn.thirdparty.com/repos/test", "tags", "http://svn.example.org/repos/test", ("external", "http://svn.thirdparty.com/repos/test", None, False), ), ( "external ttp://svn.thirdparty.com/repos/test", "tags", "http://svn.example.org/repos/test", ("external", "ttp://svn.thirdparty.com/repos/test", None, False), ), ( "external http//svn.thirdparty.com/repos/test", "tags", "http://svn.example.org/repos/test", ("external", "http//svn.thirdparty.com/repos/test", None, False), ), ( "C:\\code\\repo\\external http://svn.thirdparty.com/repos/test", "tags", "http://svn.example.org/repos/test", ("C:coderepoexternal", "http://svn.thirdparty.com/repos/test", None, False), ), ( "C:\\\\code\\\\repo\\\\external http://svn.thirdparty.com/repos/test", "tags", "http://svn.example.org/repos/test", ( "C:\\code\\repo\\external", "http://svn.thirdparty.com/repos/test", None, False, ), ), + ( + "-r 123 http://svn.example.com/repos/sounds@100 third-party/sounds", + "trunk/externals", + "http://svn.example.org/repos/test", + ("third-party/sounds", "http://svn.example.com/repos/sounds", 123, False), + ), + ( + "-r 123 http://svn.example.com/repos/sounds@150 third-party/sounds", + "trunk/externals", + "http://svn.example.org/repos/test", + ("third-party/sounds", "http://svn.example.com/repos/sounds", 123, False), + ), ], ) def test_parse_external_definition(external, dir_path, repo_url, expected_result): assert ( utils.parse_external_definition(external, dir_path, repo_url) == expected_result ) diff --git a/swh/loader/svn/utils.py b/swh/loader/svn/utils.py index 3fbe9fe..3319efe 100644 --- a/swh/loader/svn/utils.py +++ b/swh/loader/svn/utils.py @@ -1,322 +1,325 @@ # Copyright (C) 2016-2022 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information import errno import logging import os import re import shutil from subprocess import PIPE, Popen, call import tempfile from typing import Optional, Tuple from urllib.parse import quote, urlparse, urlunparse logger = logging.getLogger(__name__) class OutputStream: """Helper class to read lines from a program output while it is running Args: fileno (int): File descriptor of a program output stream opened in text mode """ def __init__(self, fileno): self._fileno = fileno self._buffer = "" def read_lines(self): """ Read available lines from the output stream and return them. Returns: Tuple[List[str], bool]: A tuple whose first member is the read lines and second member a boolean indicating if there are still some other lines available to read. """ try: output = os.read(self._fileno, 1000).decode() except OSError as e: if e.errno != errno.EIO: raise output = "" output = output.replace("\r\n", "\n") lines = output.split("\n") lines[0] = self._buffer + lines[0] if output: self._buffer = lines[-1] return (lines[:-1], True) else: self._buffer = "" if len(lines) == 1 and not lines[0]: lines = [] return (lines, False) def init_svn_repo_from_dump( dump_path: str, prefix: Optional[str] = None, suffix: Optional[str] = None, root_dir: str = "/tmp", gzip: bool = False, cleanup_dump: bool = True, ) -> Tuple[str, str]: """Given a path to a svn dump, initialize an svn repository with the content of said dump. Args: dump_path: The dump to the path prefix: optional prefix file name for the working directory suffix: optional suffix file name for the working directory root_dir: the root directory where the working directory is created gzip: Boolean to determine whether we treat the dump as compressed or not. cleanup_dump: Whether we want this function call to clean up the dump at the end of the repository initialization. Raises: ValueError in case of failure to run the command to uncompress and load the dump. Returns: A tuple: - temporary folder: containing the mounted repository - repo_path: path to the mounted repository inside the temporary folder """ project_name = os.path.basename(os.path.dirname(dump_path)) temp_dir = tempfile.mkdtemp(prefix=prefix, suffix=suffix, dir=root_dir) try: repo_path = os.path.join(temp_dir, project_name) # create the repository that will be loaded with the dump cmd = ["svnadmin", "create", repo_path] r = call(cmd) if r != 0: raise ValueError( "Failed to initialize empty svn repo for %s" % project_name ) read_dump_cmd = ["cat", dump_path] if gzip: read_dump_cmd = ["gzip", "-dc", dump_path] with Popen(read_dump_cmd, stdout=PIPE) as dump: # load dump and bypass properties validation as Unicode decoding errors # are already handled in loader implementation (see _ra_codecs_error_handler # in ra.py) cmd = ["svnadmin", "load", "-q", "--bypass-prop-validation", repo_path] r = call(cmd, stdin=dump.stdout) if r != 0: raise ValueError( "Failed to mount the svn dump for project %s" % project_name ) return temp_dir, repo_path except Exception as e: shutil.rmtree(temp_dir) raise e finally: if cleanup_dump: try: # At this time, the temporary svn repository is mounted from the dump or # the svn repository failed to mount. Either way, we can drop the dump. os.remove(dump_path) assert not os.path.exists(dump_path) except OSError as e: logger.warn("Failure to remove the dump %s: %s", dump_path, e) def init_svn_repo_from_archive_dump( archive_path: str, prefix: Optional[str] = None, suffix: Optional[str] = None, root_dir: str = "/tmp", cleanup_dump: bool = True, ) -> Tuple[str, str]: """Given a path to an archive containing an svn dump, initializes an svn repository with the content of the uncompressed dump. Args: archive_path: The archive svn dump path prefix: optional prefix file name for the working directory suffix: optional suffix file name for the working directory root_dir: the root directory where the working directory is created gzip: Boolean to determine whether we treat the dump as compressed or not. cleanup_dump: Whether we want this function call to clean up the dump at the end of the repository initialization. Raises: ValueError in case of failure to run the command to uncompress and load the dump. Returns: A tuple: - temporary folder: containing the mounted repository - repo_path: path to the mounted repository inside the temporary folder """ return init_svn_repo_from_dump( archive_path, prefix=prefix, suffix=suffix, root_dir=root_dir, gzip=True, cleanup_dump=cleanup_dump, ) def svn_urljoin(base_url: str, *args) -> str: """Join a base URL and a list of paths in a SVN way. For instance: - svn_urljoin("http://example.org", "foo", "bar") will return "https://example.org/foo/bar - svn_urljoin("http://example.org/foo", "../bar") will return "https://example.org/bar Args: base_url: Base URL to join paths with args: path components Returns: The joined URL """ parsed_url = urlparse(base_url) path = os.path.abspath( os.path.join(parsed_url.path or "/", *[arg.strip("/") for arg in args]) ) return f"{parsed_url.scheme}://{parsed_url.netloc}{path}" def parse_external_definition( external: str, dir_path: str, repo_url: str ) -> Tuple[str, str, Optional[int], bool]: """Parse a subversion external definition. Args: external: an external definition, extracted from the lines split of a svn:externals property value dir_path: The path of the directory in the subversion repository where the svn:externals property was set repo_url: URL of the subversion repository Returns: A tuple with the following members: - path relative to dir_path where the external should be exported - URL of the external to export - optional revision of the external to export - boolean indicating if the external URL is relative to the repository URL and targets a path not in the repository """ path = "" external_url = "" revision = None relative_url = False prev_part = None # turn multiple spaces into a single one and split on space for external_part in external.split(): if prev_part == "-r": # parse revision in the form "-r XXX" revision = int(external_part) elif external_part.startswith("-r") and external_part != "-r": # parse revision in the form "-rXXX" revision = int(external_part[2:]) elif external_part.startswith("^/"): # URL relative to the root of the repository in which the svn:externals # property is versioned external_url = svn_urljoin(repo_url, external_part[2:]) relative_url = not external_url.startswith(repo_url) elif external_part.startswith("//"): # URL relative to the scheme of the URL of the directory on which the # svn:externals property is set scheme = urlparse(repo_url).scheme external_url = f"{scheme}:{external_part}" relative_url = not external_url.startswith(repo_url) elif external_part.startswith("/"): # URL relative to the root URL of the server on which the svn:externals # property is versioned parsed_url = urlparse(repo_url) root_url = f"{parsed_url.scheme}://{parsed_url.netloc}" external_url = svn_urljoin(root_url, external_part) relative_url = not external_url.startswith(repo_url) elif external_part.startswith("../"): # URL relative to the URL of the directory on which the svn:externals # property is set external_url = svn_urljoin(repo_url, dir_path, external_part) relative_url = not external_url.startswith(repo_url) elif re.match(r"^.*:*//.*", external_part): # absolute external URL external_url = external_part # subversion >= 1.6 added a quoting and escape mechanism to the syntax so # that the path of the external working copy may contain whitespace. elif external_part.startswith('\\"'): external_split = external.split('\\"') path = [ e.replace("\\ ", " ") for e in external_split if e.startswith(external_part[2:]) ][0] path = f'"{path}"' elif external_part.endswith('\\"'): continue elif external_part.startswith('"'): external_split = external.split('"') path_prefix = external_part.strip('"') path = next(iter([e for e in external_split if e.startswith(path_prefix)])) elif external_part.endswith('"'): continue elif not external_part.startswith("\\") and external_part != "-r": # path of the external relative to dir_path path = external_part.replace("\\\\", "\\") if path == external_part: path = external_part.replace("\\", "") if path.startswith("./"): path = path.replace("./", "", 1) prev_part = external_part if "@" in external_url: # try to extract revision number if external URL is in the form # http://svn.example.org/repos/test/path@XXX url, revision_s = external_url.rsplit("@", maxsplit=1) try: - revision = int(revision_s) + # ensure revision_s can be parsed to int + rev = int(revision_s) + # -r XXX takes priority over @XXX + revision = revision or rev external_url = url except ValueError: # handle URL like http://user@svn.example.org/ pass return (path.rstrip("/"), external_url, revision, relative_url) def is_recursive_external( origin_url: str, dir_path: str, external_path: str, external_url: str ) -> bool: """ Check if an external definition can lead to a recursive subversion export operation (https://issues.apache.org/jira/browse/SVN-1703). Args: origin_url: repository URL dir_path: path of the directory where external is defined external_path: path of the external relative to the directory external_url: external URL Returns: Whether the external definition is recursive """ parsed_origin_url = urlparse(origin_url) parsed_external_url = urlparse(external_url) external_url = urlunparse( parsed_external_url._replace(scheme=parsed_origin_url.scheme) ) return svn_urljoin(origin_url, quote(dir_path), quote(external_path)).startswith( external_url )