とりあえず日記

VIM→秀丸エディタ→VIM→秀丸エディタ→VIM→秀丸エディタ→VIM→秀丸エディタ→VIM→秀丸エディタ→VIM→秀丸エディタ(いまここ🍄)

CentO7にonedrive-devをインストールしてみた

CentOS7でOneDriveを利用するために、onedrived-devのパッケージをインストールしたときの作業メモです。

結果

onedrived-devを手作業でインストールしてOneDriveのアカウント追加まで行いました。
ローカルドライブとクラウド側のOneDriveとファイルを同期するには、ngrokのインストールとアカウント登録が必要らしいので、
面倒になって絶賛放置中です。


以下、作業メモです。

CentOSのイメージ

CentOS-7-x86_64-Minimal-1708.iso

手順

yum -y install git

yum install -y https://centos7.iuscommunity.org/ius-release.rpm
yum install -y python34 python34-libs python34-devel python34-pip python34-dbus python34-tools
yum install -y gccngrok - secure introspectable tunnels to localhost

yum search libssl-devは見つからず。

yum search libssl-dev
snip
警告: 一致するものが見つかりません: libssl-dev
No match found

libssl-devはOpenSSLだと思うのでインストール

yum -y install openssl-libs openssl-devel

yum -y install inotify-tools

build-essentialは、

To install those dependencies on Ubuntu, use apt-get command:
# Install gcc and other C-level pre-requisites.
$ sudo apt-get install build-essential python3-dev libssl-dev inotify-tools python3-dbus

build-essentialは、多分Ubuntuで必要なパッケージなので、CentOSでは無視していいかも。
私はとりあえず以下ページを参考にしてCentOSにインストールしました。
http://blog.64p.org/entry/2013/07/22/142457

yum groupinstall "Development Tools"
yum install kernel-devel kernel-headers

sudo pip3 install -U keyrings.alt
Collecting keyrings.alt
Downloading keyrings.alt-2.3-py2.py3-none-any.whl
Requirement already up-to-date: six in /root/.local/lib/python3.4/site-packages (from keyrings.alt)
Installing collected packages: keyrings.alt
Successfully installed keyrings.alt-2.3

Install onedrived

pip3 install --user git+https://github.com/xybu/onedrived-dev.git

checking for DBUS... no
configure: error: Package requirements (dbus-1 >= 1.6) were not met:

No package 'dbus-1' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables DBUS_CFLAGS
and DBUS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-sh0vgtxc/dbus-python/setup.py", line 106, in 'build_ext': BuildExt,
File "/root/.local/lib/python3.4/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib64/python3.4/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib64/python3.4/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib64/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/root/.local/lib/python3.4/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib64/python3.4/distutils/command/install.py", line 539, in run self.run_command('build')
File "/usr/lib64/python3.4/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-build-sh0vgtxc/dbus-python/setup.py", line 62, in run
cwd=builddir)
File "/usr/lib64/python3.4/subprocess.py", line 558, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/tmp/pip-build-sh0vgtxc/dbus-python/configure', '--disable-maintainer-mode', 'PYTHON=/usr/bin/python3.4', '--prefix=/tmp/pip-build-sh0vgtxc/dbus-python/build/temp.linux-x86_64-3.4/prefix']' returned non-zero exit status 1

----------------------------------------
Command "/usr/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_fpfln70/dbus-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-bfx2au8s-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-_fpfln70/dbus-python/
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

え〜〜〜〜

configure: error: Package requirements (dbus-1 >= 1.6) were not met:

エラーは、No package 'dbus-1' found なので、yumdbus-1をインストール。

yum install dbus-devel

pip3 install --user git+https://github.com/xybu/onedrived-dev.git
configure: error: Package requirements (dbus-glib-1 >= 0.70) were not met:

No package 'dbus-glib-1' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables DBUS_GLIB_CFLAGS
and DBUS_GLIB_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-zrls2wle/dbus-python/setup.py", line 106, in
'build_ext': BuildExt,
snip

今度は、dbus-glib-1が見つからないのでyumで追加インストールして、pip3...を再実行。

yum install dbus-glib-devel
pip3 install --user git+https://github.com/xybu/onedrived-dev.git

snip

Installing collected packages: dbus-python, onedrived
Running setup.py install for dbus-python ... done
Running setup.py install for onedrived ... done
Successfully installed dbus-python-1.2.4 onedrived-2.0.0
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

今度は成功!!

Install from source manually

git clone https://github.com/xybu/onedrived-dev.git
cd onedrived-dev

python3 ./setup.py test

snip

Traceback (most recent call last):
File "./setup.py", line 63, in
zip_safe=False
File "/usr/lib64/python3.4/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib64/python3.4/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib64/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib/python3.4/site-packages/setuptools/command/test.py", line 148, in run
self.distribution.install_requires)
File "/usr/lib/python3.4/site-packages/setuptools/dist.py", line 312, in fetch_build_eggs
replace_conflicting=True,
File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 846, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 1084, in best_match
dist = working_set.find(req)
File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 721, in find
raise VersionConflict(dist, req)
pkg_resources.VersionConflict: (setuptools 19.2 (/usr/lib/python3.4/site-packages), Requirement.parse('setuptools>=30.0.0'))

setuptoolのバージョンが古いという旨のエラーが出力されるので、setuptoolのバージョンを更新する

wget https://pypi.python.org/packages/6c/54/f7e9cea6897636a04e74c3954f0d8335cc38f7d01e27eec98026b049a300/setuptools-38.5.1.zip
sudo pip3 install ./setuptools-33.1.1.zip

再度テストを実行。

python3 ./setup.py test

snip

No package 'libffi' found
c/_cffi_backend.c:15:17: 致命的エラー: ffi.h: そのようなファイルやディレクトリはありません
#include
^
コンパイルを停止しました。
error: Setup script exited with error: command 'gcc' failed with exit status 1

libffiが見つからないのでインストール。

sudo yum -y install libffi-devel

再度、テストを実行

python3 ./setup.py test

snip

Running requests-mock-1.4.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-peaamvum/requests-mock-1.4.0/egg-dist-tmp-xtmm2215
Download error on https://pypi.python.org/simple/pbr/: [Errno -2] Name or service not known -- Some packages may not be found!
Couldn't find index page for 'pbr' (maybe misspelled?)
No local packages or working download links found for pbr
error: Could not find suitable distribution for Requirement.parse('pbr')

pbrが見つからないのでインストール。

sudo pip3 install pbr

再度、テストを実行

python3 ./setup.py test

snip

test_handle_update (tests.test_tasks.TestUpdateSubscriptionTask) ... ok
test_lifecycle (tests.test_threads.TestTaskWorkerThread) ... ok
test_recognize_event_patterns (tests.test_watcher.TestLocalRepositoryWatcher) ... ok
test_execution (tests.test_webhook_worker.TestWebhookWorker) ... ERROR:root:Unknown subscription ID "233".
ok

                                                                                                                                          • -

Ran 86 tests in 2.858s

OK

テストに合格しました!!長かった・・・

途中ですが

マニュアルに従ってインストールを行いましたが、
ngrokのインストールとアカウント登録が必要らしいので、
面倒になって絶賛放置中です。