Skip to content
Snippets Groups Projects
Commit d0c30990 authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

New upstream version 0.0.60

parents 6021cfcb fc4a3298
No related branches found
Tags debian/upstream/0.0.60
No related merge requests found
Metadata-Version: 1.0
Name: swh.deposit
Version: 0.0.59
Version: 0.0.60
Summary: Software Heritage Deposit Server
Home-page: https://forge.softwareheritage.org/source/swh-deposit/
Author: Software Heritage developers
......
......@@ -2,10 +2,6 @@
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:codemeta="https://doi.org/10.5063/SCHEMA/CODEMETA-2.0"
xmlns:swh="swh.xsd">
"{http://www.w3.org/2005/Atom}author": {
"{http://www.w3.org/2005/Atom}email": "hal@ccsd.cnrs.fr",
"{http://www.w3.org/2005/Atom}name": "HAL"
},
<author>
<name>HAL</name>
<email>hal@ccsd.cnrs.fr</email>
......
......@@ -6,7 +6,7 @@ Goal
A client wishes to deposit only metadata about an object in the Software
Heritage archive.
The meta-deposit is a special deposit where no content is
The metadata-deposit is a special deposit where no content is
provided and the data transfered to Software Heritage is only
the metadata about an object or several objects in the archive.
......@@ -14,7 +14,8 @@ Requirements
------------
The scope of the meta-deposit is different than the
sparse-deposit. While a sparse-deposit creates a revision with referenced
directories and content files, the meta-deposit references one of the following:
directories and content files, the metadata-deposit references one of the
following:
- origin
- snapshot
......@@ -25,7 +26,8 @@ directories and content files, the meta-deposit references one of the following:
A complete metadata example
---------------------------
The reference element is included in the metadata xml atomEntry under the
swh namespace:
swh namespace (a link for the published schema will be provided during
the implementation of the metadata deposit):
.. code:: xml
......@@ -63,11 +65,22 @@ swh namespace:
Examples by target type
^^^^^^^^^^^^^^^^^^^^^^^
Reference an origin:
With ${type} in {snp (snapshot), rev (revision), rel (release) }:
.. code:: xml
<swh:deposit>
<swh:reference>
<swh:origin url="swh:1:${type}:aaaaaaaaaaaaaa..."/>
</swh:reference>
</swh:deposit>
Reference a snapshot, revision or release:
.. code:: xml
With ${type} in {snp (snapshot), rev (revision), rel (release) }:
<swh:deposit>
<swh:reference>
<swh:object id="swh:1:${type}:aaaaaaaaaaaaaa..."/>
......@@ -79,6 +92,7 @@ With ${type} in {snp (snapshot), rev (revision), rel (release) }:
Loading procedure
------------------
In this case, the meta-deposit will be injected as a metadata entry at the
appropriate level (origin_metadata, revision_metadata, etc.). Contrary to the
complete and sparse deposit, there will be no object creation.
In this case, the metadata-deposit will be injected as a metadata entry at the
appropriate level (origin_metadata, revision_metadata, etc.) with the information
about the contributor of the deposit. Contrary to the complete and sparse
deposit, there will be no object creation.
......@@ -27,7 +27,8 @@ part of the identified object.
A concrete example
------------------
The manifest list is included in the metadata xml atomEntry under the
swh namespace:
swh namespace (a link for the published schema will be provided during
the implementation of the sparse deposit):
.. code:: xml
......
nose
setup.py 100644 → 100755
#!/usr/bin/env python3
import os
from setuptools import setup, find_packages
def parse_requirements():
def parse_requirements(name=None):
if name:
reqf = 'requirements-%s.txt' % name
else:
reqf = 'requirements.txt'
requirements = []
for reqf in ('requirements.txt', 'requirements-swh.txt'):
with open(reqf) as f:
for line in f.readlines():
line = line.strip()
if not line or line.startswith('#'):
continue
requirements.append(line)
if not os.path.exists(reqf):
return requirements
with open(reqf) as f:
for line in f.readlines():
line = line.strip()
if not line or line.startswith('#'):
continue
requirements.append(line)
return requirements
......@@ -21,7 +32,8 @@ setup(
url='https://forge.softwareheritage.org/source/swh-deposit/',
packages=find_packages(),
scripts=['bin/swh-deposit'], # scripts to package
install_requires=parse_requirements(),
install_requires=parse_requirements() + parse_requirements('swh'),
test_requires=parse_requirements('test'),
extras_require={},
setup_requires=['vcversioner'],
vcversioner={},
......
Metadata-Version: 1.0
Name: swh.deposit
Version: 0.0.59
Version: 0.0.60
Summary: Software Heritage Deposit Server
Home-page: https://forge.softwareheritage.org/source/swh-deposit/
Author: Software Heritage developers
......
......@@ -6,6 +6,7 @@ Makefile
Makefile.local
README.md
requirements-swh.txt
requirements-test.txt
requirements.txt
setup.py
version.txt
......
......@@ -44,24 +44,22 @@ def convert_status_detail(status_detail):
if not status_detail:
return None
def _str_fields(data):
fields = data.get('fields')
if not fields:
return ''
return ' (%s)' % ', '.join(map(str, fields))
msg = []
for key in ['metadata', 'archive']:
_detail = status_detail.get(key)
if _detail:
for data in _detail:
suffix_msg = ''
fields = data.get('fields')
if fields:
suffix_msg = ' (%s)' % ', '.join(fields)
msg.append('- %s%s\n' % (data['summary'], suffix_msg))
msg.append('- %s%s\n' % (data['summary'], _str_fields(data)))
_detail = status_detail.get('url')
if _detail:
fields = _detail.get('fields')
suffix_msg = ''
if fields:
suffix_msg = ' (%s)' % ', '.join(fields)
msg.append('- %s%s\n' % (_detail['summary'], suffix_msg))
msg.append('- %s%s\n' % (_detail['summary'], _str_fields(_detail)))
if not msg:
return None
......
......@@ -218,6 +218,41 @@ class DepositStatusTestCase(APITestCase, WithAuthTestCase, BasicTestCase,
actual_status_detail = convert_status_detail(status_detail)
self.assertEqual(actual_status_detail, expected_status_detail)
@istest
def convert_status_detail_edge_case(self):
status_detail = {
'url': {
'summary': 'At least one compatible url field. Failed',
'fields': ['testurl'],
},
'metadata': [
{
'summary': 'Mandatory fields missing',
'fields': ['9', 10, 1.212],
},
],
'archive': [
{
'summary': 'Invalid archive',
'fields': ['3'],
},
{
'summary': 'Unsupported archive',
'fields': [2],
}
],
}
expected_status_detail = '''- Mandatory fields missing (9, 10, 1.212)
- Invalid archive (3)
- Unsupported archive (2)
- At least one compatible url field. Failed (testurl)
'''
actual_status_detail = convert_status_detail(status_detail)
self.assertEqual(actual_status_detail, expected_status_detail)
@istest
def status_on_deposit_rejected(self):
_status = DEPOSIT_STATUS_REJECTED
......
v0.0.59-0-g19ca52e
\ No newline at end of file
v0.0.60-0-gfc4a329
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment