diff --git a/PKG-INFO b/PKG-INFO index 628a4159867e78e0582770d0a54825a0e9d11118..46302db643da4b6196e972dcf9233e04573bfedf 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: swh.deposit -Version: 0.0.38 +Version: 0.0.39 Summary: Software Heritage Deposit Server Home-page: https://forge.softwareheritage.org/source/swh-deposit/ Author: Software Heritage developers diff --git a/docs/getting-started.md b/docs/getting-started.md index 319b8c1e9d2cd97ca3c0eab4786cc777a9277db7..f7d3eab1ae52dc0f442a9794bc10a578f503a244 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -5,7 +5,7 @@ a shell client. The api is rooted at https://deposit.softwareheritage.org. -For more details, see the [main README](./README.md). +For more details, see the [main documentation](./index.html). ## Requirements @@ -235,7 +235,7 @@ but it will be answered with a 403 forbidden answer. ### Multi-steps deposit -1. Create a deposit +#### Create a deposit We will use the collection IRI again as the starting point. @@ -262,7 +262,7 @@ curl -i --user <client-name>:<pass> \ The expected answer is the same as the previous sample. -2. Update deposit's metadata +#### Update deposit's metadata To update a deposit, we can either add some more archives, some more metadata or replace existing ones. @@ -307,7 +307,7 @@ Content-Type: application/xml </entry> ``` -3. Check the deposit's state +#### Check the deposit's state You need to check the STATE-IRI endpoint (/1/<collection-name>/10/status/). diff --git a/swh.deposit.egg-info/PKG-INFO b/swh.deposit.egg-info/PKG-INFO index 628a4159867e78e0582770d0a54825a0e9d11118..46302db643da4b6196e972dcf9233e04573bfedf 100644 --- a/swh.deposit.egg-info/PKG-INFO +++ b/swh.deposit.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: swh.deposit -Version: 0.0.38 +Version: 0.0.39 Summary: Software Heritage Deposit Server Home-page: https://forge.softwareheritage.org/source/swh-deposit/ Author: Software Heritage developers diff --git a/swh/deposit/api/private/deposit_check.py b/swh/deposit/api/private/deposit_check.py index b78850223f9a4c9af501218bb8951ef9fce090de..e3875c481a7fd01f067234db798f65777b0301ee 100644 --- a/swh/deposit/api/private/deposit_check.py +++ b/swh/deposit/api/private/deposit_check.py @@ -63,22 +63,16 @@ class SWHChecksDeposit(SWHGetDepositAPI, SWHPrivateAPIView): True if metadata is ok, False otherwise. """ - must_meta = ['url', 'external_identifier', ['name', 'title'], 'author'] - # checks only for must metadata on all metadata requests - for mm in must_meta: - found = False - for k in metadata: - if isinstance(mm, list): - for p in mm: - if p in k: - found = True - break - elif mm in k: - found = True - break - if not found: - return False - return True + required_fields = (('url',), + ('external_identifier',), + ('name', 'title'), + ('author',)) + + result = all(any(name in field + for field in metadata + for name in possible_names) + for possible_names in required_fields) + return result def process_get(self, req, collection_name, deposit_id): """Build a unique tarball from the multiple received and stream that @@ -95,6 +89,7 @@ class SWHChecksDeposit(SWHGetDepositAPI, SWHPrivateAPIView): """ deposit = Deposit.objects.get(pk=deposit_id) all_metadata = {} + archives_status = False # will check each deposit request for the deposit for dr in self.deposit_requests(deposit): if dr.type.name == ARCHIVE_TYPE: diff --git a/swh/deposit/models.py b/swh/deposit/models.py index fd0f4694c85de491a72c689029bfed6b5879f9f6..3270bef10f7b725b47711523b26bf97a78a4b8de 100644 --- a/swh/deposit/models.py +++ b/swh/deposit/models.py @@ -52,18 +52,20 @@ DEPOSIT_STATUS = [ """Possible status and the detailed meaning.""" DEPOSIT_STATUS_DETAIL = { - DEPOSIT_STATUS_PARTIAL: 'Deposit is new or partially received since it can' - ' be done in multiple requests', + DEPOSIT_STATUS_PARTIAL: 'Deposit is partially received. To finalize it, ' + 'In-Progress header should be false', 'expired': 'Deposit has been there too long and is now ' 'deemed ready to be garbage collected', DEPOSIT_STATUS_READY_FOR_CHECKS: 'Deposit is ready for additional checks ' - '(tarball ok, etc...)', + '(tarball ok, metadata, etc...)', DEPOSIT_STATUS_READY: 'Deposit is fully received, checked, and ' 'ready for loading', 'rejected': 'Deposit failed the checks', 'loading': "Loading is ongoing on swh's side", - DEPOSIT_STATUS_LOAD_SUCCESS: 'Loading is successful', - DEPOSIT_STATUS_LOAD_FAILURE: 'Loading is a failure', + DEPOSIT_STATUS_LOAD_SUCCESS: 'The deposit has been successfully ' + 'loaded into the Software Heritage archive', + DEPOSIT_STATUS_LOAD_FAILURE: 'The deposit loading into the ' + 'Software Heritage archive failed', } diff --git a/version.txt b/version.txt index 2cbb505c79a656d6ad01c9c7f6f02ba9334680de..b67d3fa4ae82c72700b9db1ce5b51d2687ce6687 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v0.0.38-0-geff3391 \ No newline at end of file +v0.0.39-0-g5214a45 \ No newline at end of file