Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • anlambert/swh-model
  • lunar/swh-model
  • franckbret/swh-model
  • douardda/swh-model
  • olasd/swh-model
  • swh/devel/swh-model
  • Alphare/swh-model
  • samplet/swh-model
  • marmoute/swh-model
  • rboyer/swh-model
10 results
Show changes
Commits on Source (92)
*~
build
.coverage
dist
*.egg-info/
.eggs/
.hypothesis
*.pyc
__pycache__
.pytest_cache
*.sw?
.tox
version.txt
Copyright (C) 2015 The Software Heritage developers
See http://www.softwareheritage.org/ for more information.
This diff is collapsed.
FLAG=-v
NOSEFLAGS=-v -s
Metadata-Version: 2.1
Name: swh.model
Version: 0.0.31
Summary: Software Heritage data model
Home-page: https://forge.softwareheritage.org/diffusion/DMOD/
Author: Software Heritage developers
Author-email: swh-devel@inria.fr
License: UNKNOWN
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-model
Description: swh-model
=========
Implementation of the Data model of the Software Heritage project, used to
archive source code artifacts.
This module defines the notion of Persistent Identifier (PID) and provides
tools to compute them:
```sh
$ swh-identify fork.c kmod.c sched/deadline.c
swh:1:cnt:2e391c754ae730bd2d8520c2ab497c403220c6e3 fork.c
swh:1:cnt:0277d1216f80ae1adeed84a686ed34c9b2931fc2 kmod.c
swh:1:cnt:57b939c81bce5d06fa587df8915f05affbe22b82 sched/deadline.c
$ swh-identify --no-filename /usr/src/linux/kernel/
swh:1:dir:f9f858a48d663b3809c9e2f336412717496202ab
```
Platform: UNKNOWN
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
Description-Content-Type: text/markdown
Provides-Extra: testing
#!/usr/bin/env bash
# Use
# git-revhash 'tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\nparent 22c0fa5195a53f2e733ec75a9b6e9d1624a8b771\nauthor seanius <seanius@3187e211-bb14-4c82-9596-0b59d67cd7f4> 1138341044 +0000\ncommitter seanius <seanius@3187e211-bb14-4c82-9596-0b59d67cd7f4> 1138341044 +0000\n\nmaking dir structure...\n' # noqa
# output: 17a631d474f49bbebfdf3d885dcde470d7faafd7
echo -ne $* | git hash-object --stdin -t commit
#!/usr/bin/env python3
# Use sample:
# swh-hashtree --path . --ignore '.svn' --ignore '.git-svn' \
# --ignore-empty-folders
# 38f8d2c3a951f6b94007896d0981077e48bbd702
import click
import os
from swh.model import from_disk, hashutil
def combine_filters(*filters):
"""Combine several ignore filters"""
if len(filters) == 0:
return from_disk.accept_all_directories
elif len(filters) == 1:
return filters[0]
def combined_filter(*args, **kwargs):
return all(filter(*args, **kwargs) for filter in filters)
return combined_filter
@click.command()
@click.option('--path', default='.',
help='Optional path to hash.')
@click.option('--ignore-empty-folder', is_flag=True, default=False,
help='Ignore empty folder.')
@click.option('--ignore', multiple=True,
help='Ignore pattern.')
def main(path, ignore_empty_folder=False, ignore=None):
filters = []
if ignore_empty_folder:
filters.append(from_disk.ignore_empty_directories)
if ignore:
filters.append(
from_disk.ignore_named_directories(
[os.fsencode(name) for name in ignore]
)
)
try:
d = from_disk.Directory.from_disk(path=os.fsencode(path),
dir_filter=combine_filters(*filters))
hash = d.hash
except Exception as e:
print(e)
return
else:
print(hashutil.hash_to_hex(hash))
if __name__ == '__main__':
main()
#!/usr/bin/env python3
# Use:
# swh-revhash 'tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\nparent 22c0fa5195a53f2e733ec75a9b6e9d1624a8b771\nauthor seanius <seanius@3187e211-bb14-4c82-9596-0b59d67cd7f4> 1138341044 +0000\ncommitter seanius <seanius@3187e211-bb14-4c82-9596-0b59d67cd7f4> 1138341044 +0000\n\nmaking dir structure...\n' # noqa
# output: 17a631d474f49bbebfdf3d885dcde470d7faafd7
# To compare with git:
# git-revhash 'tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\nparent 22c0fa5195a53f2e733ec75a9b6e9d1624a8b771\nauthor seanius <seanius@3187e211-bb14-4c82-9596-0b59d67cd7f4> 1138341044 +0000\ncommitter seanius <seanius@3187e211-bb14-4c82-9596-0b59d67cd7f4> 1138341044 +0000\n\nmaking dir structure...\n' # noqa
# output: 17a631d474f49bbebfdf3d885dcde470d7faafd7
import sys
from swh.model import identifiers, hashutil
def revhash(revision_raw):
"""Compute the revision hash.
"""
if b'\\n' in revision_raw: # HACK: string have somehow their \n
# expanded to \\n
revision_raw = revision_raw.replace(b'\\n', b'\n')
h = hashutil.hash_git_data(revision_raw, 'commit')
return identifiers.identifier_to_str(h)
if __name__ == '__main__':
revision_raw = sys.argv[1].encode('utf-8')
print(revhash(revision_raw))
swh-model (0.0.30-1~swh1) unstable-swh; urgency=medium
* New upstream release 0.0.30 - (tagged by David Douard
<david.douard@sdfa3.org> on 2019-01-08 12:28:35 +0100)
* Upstream changes: - v0.0.30
-- Software Heritage autobuilder (on jenkins-debian1) <jenkins@jenkins-debian1.internal.softwareheritage.org> Wed, 09 Jan 2019 17:31:53 +0000
swh-model (0.0.29-1~swh1) unstable-swh; urgency=medium
* Release swh.model v0.0.29
* Reference iPRES paper in PID documentation
* Remove deprecated swh.model.hashutil.hash_* functions
* Split debian packaging to separate branch
-- Nicolas Dandrimont <nicolas@dandrimont.eu> Wed, 31 Oct 2018 18:26:32 +0100
swh-model (0.0.28-1~swh1) unstable-swh; urgency=medium
* v0.0.28
* setup: prepare for pypi upload
* tests: Initialize tox use
* tests: Migrate to pytest
* docs: Improve basic repository information
* docs: document PID resolution possibilities other than Web UI /
* hashutil: Migrate towards MultiHash api
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Tue, 23 Oct 2018 16:24:21 +0200
swh-model (0.0.27-1~swh1) unstable-swh; urgency=medium
* v0.0.27
* Refactor: Add MultiHash class to improve hash computations
* swh.model.hashutil: Improve and clarify docstrings
* swh.model.hashutil: Mark hash_* function as deprecated
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Mon, 17 Sep 2018 12:07:59 +0200
swh-model (0.0.26-1~swh1) unstable-swh; urgency=medium
* v0.0.26
* swh.model.identifiers: Open metadata in persistent_identifier method
* refactor CLI tests to avoid duplicate assertion pairs
* swh-identify: follow symlinks for CLI arguments (by default)
* cli.py: prefer os.fsdecode() over manual fiddling with
locale.getpref...
* swh-identify: add support for passing multiple CLI arguments
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Mon, 23 Jul 2018 14:29:54 +0200
swh-model (0.0.25-1~swh1) unstable-swh; urgency=medium
* version 0.0.25
-- Antoine Lambert <antoine.lambert@inria.fr> Fri, 29 Jun 2018 11:49:25 +0200
swh-model (0.0.24-1~swh1) unstable-swh; urgency=medium
* v0.0.24
* swh.model.cli: Catch specific exception during identifiers check
* identifiers: Validate input
* identifiers: Raise when error during parsing persistent identifiers
* Update blake2 support to be less Debian-specific
* add swh-identify CLI tool to compute persistent identifiers
* docs: Update high-level documentation (Merkle DAG description,
* contextual information for persistent IDs, etc...)
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Fri, 22 Jun 2018 15:38:32 +0200
swh-model (0.0.23-1~swh1) unstable-swh; urgency=medium
* version 0.0.23
-- Antoine Lambert <antoine.lambert@inria.fr> Tue, 29 May 2018 14:08:45 +0200
swh-model (0.0.22-1~swh1) unstable-swh; urgency=medium
* version 0.0.22
-- Antoine Pietri <antoine.pietri1@gmail.com> Tue, 30 Jan 2018 18:22:42 +0100
swh-model (0.0.21-1~swh1) unstable-swh; urgency=medium
* v0.0.21
* swh.model.identifiers: Add persistent identifier function
* docs: document the naming scheme for persistent identifiers
* bin/swh-hash-file: new binary to compute SWH-style content
identifiers
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Wed, 17 Jan 2018 11:06:33 +0100
swh-model (0.0.20-1~swh1) unstable-swh; urgency=medium
* v0.0.20
* swh.model.hashutil.hash_data: Optionally integrate length in result
* hashutil: add `snapshot` object type for git hashes
* docs: add absolute anchor to documentation index
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Wed, 20 Dec 2017 10:47:10 +0100
swh-model (0.0.19-1~swh1) unstable-swh; urgency=medium
* Release swh.model version 0.0.19
* Update packaging runes
-- Nicolas Dandrimont <nicolas@dandrimont.eu> Thu, 12 Oct 2017 18:07:59 +0200
swh-model (0.0.18-1~swh1) unstable-swh; urgency=medium
* Release swh.model v0.0.18
* Replace swh.model.git with swh.model.from_disk (T709).
* Clean up documentation
-- Nicolas Dandrimont <nicolas@dandrimont.eu> Thu, 05 Oct 2017 20:48:29 +0200
swh-model (0.0.17-1~swh1) unstable-swh; urgency=medium
* Release swh.model v0.0.17
* Clean up pyblake2 requirement for Python 3.5+
-- Nicolas Dandrimont <nicolas@dandrimont.eu> Mon, 26 Jun 2017 14:41:49 +0200
swh-model (0.0.16-1~swh1) unstable-swh; urgency=medium
* Release swh.model v0.0.16
* Make sure we generate proper permissions in directories
-- Nicolas Dandrimont <nicolas@dandrimont.eu> Fri, 07 Apr 2017 14:32:34 +0200
swh-model (0.0.15-1~swh1) unstable-swh; urgency=medium
* v0.0.15
* Add possibility to compute new blake2 hashes
* Add blake2s256 hash as default new hash computation algorithm
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Fri, 24 Mar 2017 16:32:35 +0100
swh-model (0.0.14-1~swh1) unstable-swh; urgency=medium
* v0.0.14
* Migrate functions from swh.core.hashutil to swh.model.hashutil
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Wed, 15 Mar 2017 16:00:56 +0100
swh-model (0.0.13-1~swh1) unstable-swh; urgency=medium
* Release swh.model v0.0.13
* Timestamps are now fully integer values
-- Nicolas Dandrimont <nicolas@dandrimont.eu> Tue, 14 Feb 2017 19:32:24 +0100
swh-model (0.0.12-1~swh1) unstable-swh; urgency=medium
* Release swh.model v0.0.12
* Add more tests to git tree hash computations
-- Nicolas Dandrimont <nicolas@dandrimont.eu> Tue, 14 Jun 2016 17:08:20 +0200
swh-model (0.0.11-1~swh1) unstable-swh; urgency=medium
* v0.0.11
* Open git.children_hashes api
* Rename git.walk_and_compute_sha1_from_directory_2 to
git.compute_hashes_from_directory
* Remove dead code
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Sat, 11 Jun 2016 02:23:19 +0200
swh-model (0.0.10-1~swh1) unstable-swh; urgency=medium
* v0.0.10
* Add objects_per_type api
* Open a new walk_and_compute_sha1_from_directory_2 api
* Improve internal api regarding directory and tree hash computations
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Wed, 08 Jun 2016 15:54:59 +0200
swh-model (0.0.9-1~swh1) unstable-swh; urgency=medium
* v0.0.9
* Add coverage on edge case
* Optimize git hash walk
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Thu, 26 May 2016 12:56:17 +0200
swh-model (0.0.8-1~swh1) unstable-swh; urgency=medium
* v0.0.8
* Add coverage on edge case
* Optimize git hash walk
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Thu, 26 May 2016 12:33:59 +0200
swh-model (0.0.7-1~swh1) unstable-swh; urgency=medium
* v0.0.7
* Improve corner case policy about walking and computing hash tree (+
update)
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Wed, 25 May 2016 23:47:19 +0200
swh-model (0.0.6-1~swh1) unstable-swh; urgency=medium
* v0.0.6
* Improve corner case on git hash memory update function
* debian packaging: Ignore fs tests for packaging
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Tue, 24 May 2016 17:01:06 +0200
swh-model (0.0.5-1~swh1) unstable-swh; urgency=medium
* v0.0.5
* Add update git hash computation from existing data
* Add revision identifier data for hash identifier computation (extra-
headers)
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Fri, 15 Apr 2016 12:51:21 +0200
swh-model (0.0.4-1~swh1) unstable-swh; urgency=medium
* v0.0.4
* Migrate swh.loader.dir.git module to swh.model.git
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Mon, 21 Mar 2016 15:20:28 +0100
swh-model (0.0.3-1~swh1) unstable-swh; urgency=medium
* v0.0.3
* Release name is now in bytes
-- Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Wed, 27 Jan 2016 15:50:08 +0100
swh-model (0.0.2-1~swh1) unstable-swh; urgency=medium
* Prepare release of v0.0.2
* Import the rest of swh.core.hashutil
-- Nicolas Dandrimont <nicolas@dandrimont.eu> Wed, 16 Dec 2015 18:30:12 +0100
swh-model (0.0.1-1~swh1) unstable-swh; urgency=medium
* Initial release
* Prepare swh.model release v0.0.1
-- Nicolas Dandrimont <nicolas@dandrimont.eu> Mon, 07 Dec 2015 18:26:58 +0100
9
Source: swh-model
Maintainer: Software Heritage developers <swh-devel@inria.fr>
Section: python
Priority: optional
Build-Depends: debhelper (>= 9),
dh-python (>= 2),
python3 (>= 3.5) | python3-pyblake2,
python3-all,
python3-click,
python3-pytest,
python3-setuptools,
python3-vcversioner
Standards-Version: 3.9.6
Homepage: https://forge.softwareheritage.org/diffusion/DMOD/
Package: python3-swh.model
Architecture: all
Depends: ${misc:Depends}, ${python3:Depends}
Breaks: python3-swh.loader.core (<< 0.0.16~),
python3-swh.loader.dir (<< 0.0.28~),
python3-swh.loader.svn (<< 0.0.28~)
Description: Software Heritage data model
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Files: *
Copyright: 2015 The Software Heritage developers
License: GPL-3+
License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General Public
License version 3 can be found in `/usr/share/common-licenses/GPL-3'.
[DEFAULT]
upstream-branch=debian/upstream
upstream-tag=debian/upstream/%(version)s
upstream-vcs-tag=v%(version)s
debian-branch=debian/unstable-swh
pristine-tar=True
#!/usr/bin/make -f
export PYBUILD_NAME=swh.model
export export PYBUILD_TEST_ARGS=-m 'not db and not fs'
%:
dh $@ --with python3 --buildsystem=pybuild
override_dh_install:
dh_install
rm -v $(CURDIR)/debian/python3-*/usr/lib/python*/dist-packages/swh/__init__.py
3.0 (quilt)
_build/
apidoc/
*-stamp
include ../../swh-docs/Makefile.sphinx
-include Makefile.local
sphinx/html: images
sphinx/clean: clean-images
assets: images
images:
make -C images/
clean-images:
make -C images/ clean
.PHONY: images clean-images
# Local Variables:
# mode: makefile
# End: