您现在的位置是:首页 >技术交流 >Available-Python-Tuf网站首页技术交流
Available-Python-Tuf
简介Available-Python-Tuf
一、Pyhon-tuf
向该Pyhton-tuf的repo server上传包不会持久化保存到本地,是个demo级别的demo。
二、安装方法
1.下载Python-tuf
git clone git@github.com:theupdateframework/python-tuf.git
2.使用python 的virtualenv环境,这样不会污染我们的OS环境
sudo apt-get install -y virtualenv
3.安装依赖的pip包
pip securesystemslib[crypto,pynacl] tuf
4.使用python虚拟环境–virtualenv
$ virtualenv venv #venv为虚拟环境目录名,目录名自定义
$ source venv/bin/activate #激活环境
$ . venv/bin/deactivate #停用环境
5.上述依赖包安装完毕后,不能启动,需要重新将新版的securesystemslib和tub的包覆盖到/home/wangji/Updater/python-tuf/venv/lib/python3.8/site-packages/
目录下
移除上面旧的securesystemslib和tuf包:
(venv) wangji@script-wang:~/Updater/python-tuf$ mv /home/wangji/Updater/python-tuf/venv/lib/python3.8/site-packages/securesystemslib
(venv) wangji@script-wang:~/Updater/python-tuf$ mv /home/wangji/Updater/python-tuf/venv/lib/python3.8/site-packages/securesystemslib_bak
/home/wangji/Updater/python-tuf/venv/lib/python3.8/site-packages/tuf /home/wangji/Updater/python-tuf/venv/lib/python3.8/site-packages/tuf_bak
拷贝新的securesystemslib
(venv) wangji@script-wang:~/Updater/python-tuf$ git clone (venv) wangji@script-wang:~/Updater/python-tuf$ git@github.com:secure-systems-lab/securesystemslib.git
(venv) wangji@script-wang:~/Updater/python-tuf$ cp -rf securesystemslib/securesystemslib /home/wangji/Updater/python-tuf/venv/lib/python3.8/site-packages/
拷贝新的tuf
(venv) wangji@script-wang:~/Updater/python-tuf$ !cp
(venv) wangji@script-wang:~/Updater/python-tuf$ cp -rf tuf /home/wangji/Updater/python-tuf/venv/lib/python3.8/site-packages/
三、启动
repository
(venv) wangji@script-wang:~/Updater/python-tuf/examples/repository$ ./repo
INFO:__main__:Now serving. Root v1 at http://127.0.0.1:8001/metadata/1.root.json
client
(venv) wangji@script-wang:~/Updater/python-tuf/examples/client$ ./client -h
upload packages
- 上传的包,如果repository重启,则会丢失
(venv) wangji@script-wang:~/Updater/python-tuf/examples/uploader$ ./uploader
ref:Installation,python虚拟环境–virtualenv
四、一个可用的Python-Tuf
git clone git@github.com:Jiwangreal/avaliable-python-tuf.git
wangji@script-wang:~/Updater/python-tuf$ cd avaliable-python-tuf
wangji@script-wang:~/Updater/python-tuf$ source venv/bin/activate
reference:
风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。