From ed94680e9c6675e6531ca617d4242b706a08e802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E8=B5=AB=E7=84=B6?= Date: Mon, 9 Dec 2019 11:58:08 +0800 Subject: [PATCH 1/3] Fix find deleted api --- server/repo-op.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/repo-op.c b/server/repo-op.c index 427155d..7c43048 100644 --- a/server/repo-op.c +++ b/server/repo-op.c @@ -6001,7 +6001,7 @@ find_deleted_recursive (SeafRepo *repo, add_deleted_entry (repo, entries, dent2, base, child, parent); } else if (S_ISDIR(dent1->mode) && strcmp(dent1->id, dent2->id) != 0) { SeafDir *n1 = seaf_fs_manager_get_seafdir_sorted (seaf->fs_mgr, - repo->id, + repo->store_id, repo->version, dent1->id); if (!n1) { @@ -6010,7 +6010,7 @@ find_deleted_recursive (SeafRepo *repo, } SeafDir *n2 = seaf_fs_manager_get_seafdir_sorted (seaf->fs_mgr, - repo->id, + repo->store_id, repo->version, dent2->id); if (!n2) { @@ -6054,7 +6054,7 @@ find_deleted (SeafRepo *repo, int ret = 0; d1 = seaf_fs_manager_get_seafdir_sorted_by_path (seaf->fs_mgr, - repo->id, + repo->store_id, repo->version, child->root_id, base); if (!d1) { @@ -6062,7 +6062,7 @@ find_deleted (SeafRepo *repo, } d2 = seaf_fs_manager_get_seafdir_sorted_by_path (seaf->fs_mgr, - repo->id, + repo->store_id, repo->version, parent->root_id, base); if (!d2) { From e09f6261e5aea3c369225f3689642a8b70442af6 Mon Sep 17 00:00:00 2001 From: ly1217 Date: Mon, 13 Jan 2020 21:49:03 -0800 Subject: [PATCH 2/3] Use github action as ci test. --- .github/workflows/ci.yml | 20 ++++++++++++++++++++ .travis.yml | 39 --------------------------------------- ci/install-deps.sh | 13 ++++++------- ci/run.py | 36 +++++++++++++++++++++++++++++------- ci/serverctl.py | 4 ++-- ci/utils.py | 4 ++-- 6 files changed, 59 insertions(+), 57 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..16acca8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,20 @@ +name: Seafile CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - uses: actions/setup-python@v1 + with: + python-version: "2.7" + - name: install dependencies and test + run: | + cd $GITHUB_WORKSPACE + ./ci/install-deps.sh + ./ci/run.py diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e6d7540..0000000 --- a/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -sudo: false -# Must set language to python so we can install custom python pacakges in -# docker-based travis builds -language: python -python: -- "2.7" -services: -- mysql -compiler: -- gcc -addons: - apt: - packages: - - valac - - uuid-dev - - libevent-dev - - libarchive-dev - - intltool - - libjansson-dev - - libonig-dev - - libfuse-dev - - net-tools -cache: - directories: - - "$HOME/.cache/pip" - - "$HOME/.ccache" -before_install: -- ccache -s -- export PATH=/usr/lib/ccache:${PATH} -install: -- "./ci/install-deps.sh" -script: -- "./ci/run.py" -notifications: - slack: - rooms: - secure: 3H6mh5PPPKo0wuwzZybDwnHOya0/IiW8jn/g9ZUFna5P5IqmuuFacZi+lS5Ffgrv/vRYbv9ebjDvIApk2CDc0KzA2vUwr79BjlfPqm1buf75dPf1aINhNjMT1g16afyxciMbdV5QtzSoiyYn+P4026SU40jmJXGL2u/O01HH/dF8Aw8/rpWjhZp1PjhRC40iilVe/q38E9biGsi9lKzJVXumhm3IYyZLsH7aqr2rTg67U1j2bB8OwTaJx4vZdpf6gxKLpwrumkLT1lNFvhOYieuxqNvBw752bB++FImswCwZ2t9ejX2jW1GjTdIJ1FpkHEVF2cz9AeRL5xeBz4bHtG3490PpfqcPLjQ39MI/FP6QRupAi0EUufbHpfx30kdqqBEyztcF66vR4hA42uDopIoF0HIIFyzgTnmN5SKmyhmOaE+hmfgWNtCm79ZYEx/PB8BvUyR2IV6UvQy2kHznNk8UnDnO2shP/2sOn3IUvZQ99y0UUk5LmJMQNOCiB31N1AFESbVKzAqR4ZKN+5K7CwEUQ1uaJgMmwuutrpgR+x6QvN3+zPHiLLunx6zTAJW6PWiHx5+Gxzt2Xi8iEtsmBOWu4o5kvAkjFMtYlzgd+12waQm4HpZaJ+xMbnZEG0jR3CUn7pXjKZhTxiFgXunYkalKWIIITFF5YUWgQJVrfng= - on_success: change - on_failure: always diff --git a/ci/install-deps.sh b/ci/install-deps.sh index 7953e5d..158bea4 100755 --- a/ci/install-deps.sh +++ b/ci/install-deps.sh @@ -8,11 +8,10 @@ SETUP_DIR=${TESTS_DIR}/ci cd $SETUP_DIR -pip install -r requirements.txt +sudo apt-get update +sudo apt-get install -y intltool libarchive-dev libcurl4-openssl-dev libevent-dev \ +libfuse-dev libglib2.0-dev libjansson-dev libmysqlclient-dev libonig-dev \ +sqlite3 libsqlite3-dev libtool net-tools uuid-dev valac mysql-client -# download precompiled libevhtp -# TODO(lins05): we should consider build from source with https://github.com/criticalstack/libevhtp in the future -libevhtp_bin=libevhtp-bin_1.2.0.tar.gz -wget https://dl.bintray.com/lins05/generic/libevhtp-bin/$libevhtp_bin -# tar xvf $libevhtp_bin --strip-components=3 -C /usr -tar xf $libevhtp_bin -C $HOME +pip install wheel +pip install -r requirements.txt diff --git a/ci/run.py b/ci/run.py index 0ba2d83..fc4dac7 100755 --- a/ci/run.py +++ b/ci/run.py @@ -18,14 +18,14 @@ import termcolor from serverctl import ServerCtl from utils import ( - cd, chdir, debug, green, info, lru_cache, mkdirs, on_travis, red, + cd, chdir, debug, green, info, lru_cache, mkdirs, on_github_actions, red, setup_logging, shell, warning ) logger = logging.getLogger(__name__) TOPDIR = abspath(join(os.getcwd(), '..')) -if on_travis(): +if on_github_actions(): PREFIX = expanduser('~/opt/local') else: PREFIX = os.environ.get('SEAFILE_INSTALL_PREFIX', '/usr/local') @@ -53,6 +53,8 @@ def make_build_env(): _env_add('LDFLAGS', '-L%s' % join(PREFIX, 'lib64'), seperator=' ') _env_add('PATH', join(PREFIX, 'bin')) + if on_github_actions(): + _env_add('PYTHONPATH', join(os.environ.get('RUNNER_TOOL_CACHE'), 'Python/2.7.16/x64/lib/python2.7/site-packages')) _env_add('PYTHONPATH', join(PREFIX, 'lib/python2.7/site-packages')) _env_add('PKG_CONFIG_PATH', join(PREFIX, 'lib', 'pkgconfig')) _env_add('PKG_CONFIG_PATH', join(PREFIX, 'lib64', 'pkgconfig')) @@ -157,18 +159,38 @@ class SeafileServer(Project): def __init__(self): super(SeafileServer, self).__init__('seafile-server') +class Libevhtp(Project): + def __init__(self): + super(Libevhtp, self).__init__('libevhtp') + + def branch(self): + return 'master' + + @chdir + def compile_and_install(self): + cmds = [ + 'cmake -DEVHTP_DISABLE_SSL=ON -DEVHTP_BUILD_SHARED=OFF', + 'make', + 'sudo make install', + 'sudo ldconfig', + ] + + for cmd in cmds: + shell(cmd) def fetch_and_build(): libsearpc = Libsearpc() + libevhtp = Libevhtp() ccnet = CcnetServer() seafile = SeafileServer() libsearpc.clone() - libsearpc.compile_and_install() - + libevhtp.clone() ccnet.clone() - ccnet.compile_and_install() + libsearpc.compile_and_install() + libevhtp.compile_and_install() + ccnet.compile_and_install() seafile.compile_and_install() @@ -184,9 +206,9 @@ def main(): mkdirs(INSTALLDIR) os.environ.update(make_build_env()) args = parse_args() - if on_travis() and not args.test_only: + if on_github_actions() and not args.test_only: fetch_and_build() - if on_travis(): + if on_github_actions(): dbs = ('sqlite3', 'mysql') else: dbs = ('sqlite3',) diff --git a/ci/serverctl.py b/ci/serverctl.py index 4121c33..a70f8b2 100755 --- a/ci/serverctl.py +++ b/ci/serverctl.py @@ -170,7 +170,7 @@ connection_charset = utf8 seafile_sql_path = join(self.sql_dir, 'mysql', 'seafile.sql') sql = '''USE ccnet; source {}; USE seafile; source {};'''.format(ccnet_sql_path, seafile_sql_path) - shell('mysql -u root', inputdata=sql, wait=False) + shell('sudo mysql -u root -proot', inputdata=sql, wait=False) else: config_sql_path = join(self.sql_dir, 'sqlite', 'config.sql') groupmgr_sql_path = join(self.sql_dir, 'sqlite', 'groupmgr.sql') @@ -261,4 +261,4 @@ GRANT ALL PRIVILEGES ON `ccnet`.* to `seafile`@localhost; GRANT ALL PRIVILEGES ON `seafile`.* to `seafile`@localhost; ''' - shell('mysql -u root', inputdata=sql) + shell('sudo mysql -u root -proot', inputdata=sql) diff --git a/ci/utils.py b/ci/utils.py index 0e908c5..f9e0fb5 100644 --- a/ci/utils.py +++ b/ci/utils.py @@ -95,8 +95,8 @@ def mkdirs(*paths): if not exists(path): os.mkdir(path) -def on_travis(): - return 'TRAVIS_BUILD_NUMBER' in os.environ +def on_github_actions(): + return 'GITHUB_ACTIONS' in os.environ @contextmanager def cd(path): From 13e406a169c1fd4a92e7dfa8473d9387c542bc46 Mon Sep 17 00:00:00 2001 From: caixiangyue Date: Mon, 3 Feb 2020 17:17:55 +0800 Subject: [PATCH 3/3] fixed computing repo size crash problem --- server/size-sched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/size-sched.c b/server/size-sched.c index 4058b70..a3edeff 100644 --- a/server/size-sched.c +++ b/server/size-sched.c @@ -320,11 +320,12 @@ compute_repo_size (void *vjob) goto out; } - if (info){ + if (info) old_head = seaf_commit_manager_get_commit (sched->seaf->commit_mgr, repo->id, repo->version, info->head_id); + if (info && old_head){ gint64 change_size = 0; gint64 change_file_count = 0; GList *diff_entries = NULL;