Add publishing to IPFS option
This commit is contained in:
parent
6124caf341
commit
467e211a23
|
@ -268,6 +268,18 @@
|
|||
# awssecretkey: {env: awssecretkey}
|
||||
|
||||
|
||||
# To deploy to IPFS you need the ipfs command line utility in $PATH and have a
|
||||
# `ipfs daemon` running. To serve the repo permanently, you either need to keep
|
||||
# the daemon running or use a pinning service.
|
||||
#
|
||||
# You can specify a ipnfs key per repo section. Make sure to generate the keys
|
||||
# before the first run, using: `ipfs key gen <key>`.
|
||||
#
|
||||
# ipfs:
|
||||
# repo: fdroid
|
||||
# archive: fdroid_archive
|
||||
|
||||
|
||||
# If you want to force 'fdroid server' to use a non-standard serverwebroot.
|
||||
# This will allow you to have 'serverwebroot' entries which do not end in
|
||||
# '/fdroid'. (Please note that some client features expect repository URLs
|
||||
|
|
|
@ -467,7 +467,7 @@ def read_config(opts=None):
|
|||
for k, v in dictvalue.items():
|
||||
new[str(k)] = v
|
||||
config[configname] = new
|
||||
elif configname in ('ndk_paths', 'java_paths', 'char_limits', 'keyaliases'):
|
||||
elif configname in ('ndk_paths', 'java_paths', 'char_limits', 'keyaliases', 'ipfs'):
|
||||
continue
|
||||
elif isinstance(dictvalue, dict):
|
||||
for k, v in dictvalue.items():
|
||||
|
|
|
@ -328,6 +328,22 @@ def sync_from_localcopy(repo_section, local_copy_dir):
|
|||
push_binary_transparency(offline_copy, online_copy)
|
||||
|
||||
|
||||
def update_ipfs(repo_section, ipns_key):
|
||||
"""Upload using the CLI tool ipfs."""
|
||||
logging.debug(
|
||||
_('adding {section} to ipfs and publish with ipns key {key}').format(
|
||||
section=repo_section, key=ipns_key
|
||||
)
|
||||
)
|
||||
|
||||
final_hash = subprocess.check_output(
|
||||
['ipfs', 'add', '-r', '-Q', repo_section], text=True
|
||||
).strip()
|
||||
subprocess.check_call(
|
||||
['ipfs', 'name', 'publish', '--key', ipns_key, '/ipfs/{}'.format(final_hash)]
|
||||
)
|
||||
|
||||
|
||||
def update_localcopy(repo_section, local_copy_dir):
|
||||
"""Copy data from offline to the "local copy dir" filesystem.
|
||||
|
||||
|
@ -795,10 +811,11 @@ def main():
|
|||
and not config.get('androidobservatory') \
|
||||
and not config.get('binary_transparency_remote') \
|
||||
and not config.get('virustotal_apikey') \
|
||||
and not config.get('ipfs') \
|
||||
and local_copy_dir is None:
|
||||
logging.warning(_('No option set! Edit your config.yml to set at least one of these:')
|
||||
+ '\nserverwebroot, servergitmirrors, local_copy_dir, awsbucket, '
|
||||
+ 'virustotal_apikey, androidobservatory, or binary_transparency_remote')
|
||||
+ 'virustotal_apikey, androidobservatory, binary_transparency_remote, or ipfs')
|
||||
sys.exit(1)
|
||||
|
||||
repo_sections = ['repo']
|
||||
|
@ -831,6 +848,8 @@ def main():
|
|||
upload_to_android_observatory(repo_section)
|
||||
if config.get('virustotal_apikey'):
|
||||
upload_to_virustotal(repo_section, config.get('virustotal_apikey'))
|
||||
if config.get('ipfs', {}).get(repo_section):
|
||||
update_ipfs(repo_section, config.get('ipfs')[repo_section])
|
||||
|
||||
binary_transparency_remote = config.get('binary_transparency_remote')
|
||||
if binary_transparency_remote:
|
||||
|
|
Loading…
Reference in New Issue