From 804dd57476666845339b1947161bcb2971b6de4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Kopp?= Date: Mon, 27 May 2024 17:12:55 +0200 Subject: [PATCH] remove svn dependencies: change variables, different tool for changelog, load external extensions repository, use fifferent version numbering #3 --- .gitignore | 2 ++ Makefile | 9 +++++- admin/env_refactored.sh | 21 ++++++++---- admin/make-changelog.sh | 9 +++--- admin/prereq.sh | 43 ++++++------------------- admin/update-dist-dir.sh | 11 ++++--- tred_refactored/devel/update_version.pl | 11 ++----- 7 files changed, 48 insertions(+), 58 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..c144831ea --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +extensions +local_www \ No newline at end of file diff --git a/Makefile b/Makefile index 9cb05c7db..b9cbac436 100644 --- a/Makefile +++ b/Makefile @@ -133,7 +133,7 @@ make-changelog: # - TrEd version number (based on SVN revision) # - compile the documentation from DocBook and POD (tred/devel/make_manual) # - updated extensions dir (SVN working copy) -update-dist-dir: make-changelog +update-dist-dir: make-changelog extensions cd admin && ./update-dist-dir.sh @@ -184,3 +184,10 @@ compile-treex-pml-dist: install-treex-pml: cd admin && ./install-treex-pml.sh + + +#### Extensions repository +extensions: + GIT_DIR=`pwd` && \ + . admin/env.sh && \ + git clone $${TRED_GIT_EXT} $${TRED_EXT_DIR} \ No newline at end of file diff --git a/admin/env_refactored.sh b/admin/env_refactored.sh index b3443310e..fb4dc1de9 100644 --- a/admin/env_refactored.sh +++ b/admin/env_refactored.sh @@ -1,8 +1,8 @@ #!/bin/bash # Root dir of the SVN checkout. All dirs are derived from this one -if [ -z "$SVN_DIR" ]; then - SVN_DIR=$(dirname $(dirname $(dirname $(readlink -fen $0)))) +if [ -z "$GIT_DIR" ]; then + GIT_DIR=$(dirname $(dirname $(readlink -fen $0))) fi @@ -10,10 +10,10 @@ fi # binaries go to $INSTALL_BASE/exec, # libraries go to $INSTALL_BASE/lib, # extensions to $INSTALL_BASE/share -INSTALL_BASE=${SVN_DIR}/local_install +INSTALL_BASE=${GIT_DIR}/local_install # Local (source) web tree -WWW=${SVN_DIR}/local_www +WWW=${GIT_DIR}/local_www export TREDWWW=$WWW # Remote web tree (of the testbed) @@ -24,12 +24,13 @@ REMOTE_WWW=${TESTING_SERVER}:/var/www/tred/testbed # The selected user should log there without password (by certificate) LOGIN_NAME=tred +PYTHON_ENV=${GIT_DIR}/virtualenv # TrEd project direcotry (from which Makefile is executed) -PROJECT_DIR=${SVN_DIR}/trunk +PROJECT_DIR=${GIT_DIR} # Log for svn checkouts and exports during make -LOG=$SVN_DIR/trunk/make_log +LOG=$GIT_DIR/make_log TRED_HOME_URL="http://ufallab.ms.mff.cuni.cz:24080/tred/testbed" TRED_EXTENSIONS_URL="" @@ -68,6 +69,10 @@ TRED_SVN_EXT=${TRED_SVN}/extensions TREEX_PML_REPO=https://svn.ms.mff.cuni.cz/svn/perl_libs/trunk/distribution/Treex-PML WIN32_DIST_REPO=https://svn.ms.mff.cuni.cz/svn/perl_libs/trunk/distribution/win32_build_script +TRED_GIT_EXT=git@github.com:ufal/TrEd-extensions.git +# https://github.com/ufal/TrEd-extensions.git + + # PROJECT_DIR=/net/work/projects/tred ADMIN_DIR=${PROJECT_DIR}/admin DIST_DIR=${PROJECT_DIR}/dist @@ -91,6 +96,8 @@ LRC_CMD=${ADMIN_DIR}/run_on_lrc # SVN to ChangeLog conversion SVN_TO_CHANGELOG=${ADMIN_DIR}/svn2cl/svn2cl.sh +# GIT to ChangeLog conversion +GIT_TO_CHANGELOG=${PYTHON_ENV}/bin/git-changelog # ChangeLog to RSS conversion CHANGELOG_TO_RSS=${ADMIN_DIR}/changelog2rss.pl @@ -104,4 +111,4 @@ CHANGELOG_TO_RSS=${ADMIN_DIR}/changelog2rss.pl MAC_RELEASER=kopp@manfred.ms.mff.cuni.cz MAC_TRED_INSTALLATION='~/tred_installation' MAC_TRED_INSTALLATION_OLD='~/tred_installation_old' -MAC_SVN_DIR='~/TrEd' \ No newline at end of file +MAC_GIT_DIR='~/TrEd' \ No newline at end of file diff --git a/admin/make-changelog.sh b/admin/make-changelog.sh index 9d58d3d50..fa7e1cbb9 100755 --- a/admin/make-changelog.sh +++ b/admin/make-changelog.sh @@ -3,10 +3,11 @@ EXTDIR=`dirname $(readlink -fen $0)` . "$EXTDIR"/env.sh +. ${PYTHON_ENV}/bin/activate echo "Generating changelog" && \ -echo "Updating svn..." && \ -svn update ${TRED_SRC_DIR} >> $LOG && \ +echo "Updating git..." && \ +git pull >> $LOG && \ echo "done" && \ # find the current revision number of svn @@ -24,8 +25,8 @@ echo "done" && \ ## echo "LAST_COMMIT_IN_CHANGELOG = $LAST_COMMIT_IN_CHANGELOG" # if [ "$LAST_COMMIT_IN_CHANGELOG" == 0 ]; then - echo "Transforming svn log --> ChangeLog (this takes a while)..." && \ - cd ${TRED_SRC_DIR} && ${SVN_TO_CHANGELOG} --include-rev -o ChangeLog && \ + echo "Transforming git log --> ChangeLog (this takes a while)..." && \ + cd ${TRED_SRC_DIR} && ${GIT_TO_CHANGELOG} > ChangeLog && \ # else # echo "ChangeLog is already up to date." # fi && \ diff --git a/admin/prereq.sh b/admin/prereq.sh index a62331e4f..2fbf1aff3 100755 --- a/admin/prereq.sh +++ b/admin/prereq.sh @@ -27,37 +27,6 @@ function perl_module_presence_and_version_test { fi } -# This funcition downloads current version of svn2cl script from web, -# compares its MD5 sum to the MD5 sum found on the web and -# unpacks it, if the MD5 sum is correct -function get_svn2cl { - ### svn2cl - SVN2CL_URL="https://arthurdejong.org/svn2cl/" - SVN2CL_FILE_DL="svn2cl.tar.gz" - wget ${SVN2CL_URL}downloads.html -O web >> $LOG - - NEWEST_SVN2CL=`grep -o "svn2cl-[0-9.]\+tar.gz" web | head -n 1` - wget -nv ${SVN2CL_URL}${NEWEST_SVN2CL} -O $SVN2CL_FILE_DL >> $LOG - wget -nv ${SVN2CL_URL}${NEWEST_SVN2CL}.md5 -O ${SVN2CL_FILE_DL}.md5 >> $LOG - - SVN2CL_MD5_WEB=`cut -d ' ' -f 1 $SVN2CL_FILE_DL.md5` - SVN2CL_MD5_LOCAL=`md5sum $SVN2CL_FILE_DL | cut -d ' ' -f 1` - - if [ "$SVN2CL_MD5_WEB" == "$SVN2CL_MD5_LOCAL" ]; then - echo "MD5 sum ok, extracting svn2cl.." - tar xvzf $SVN2CL_FILE_DL -C $ADMIN_DIR - # remove the version of the svn2cl from dir name - mv ${ADMIN_DIR}/svn2cl*/ ${ADMIN_DIR}/svn2cl - echo "done" - else - echo "MD5 sum error, please download and unpack svn2cl to dir $ADMIN_DIR/svn2cl manually..." - exit 1; - fi - rm $SVN2CL_FILE_DL - rm -f web - rm -f ${SVN2CL_FILE_DL}.md5 -} - # This function downloads 7zip and unpacks it, if the MD5 sum of the downloaded # package is correct function get_7zExtra { @@ -124,10 +93,16 @@ else fi -if [ -x "$SVN_TO_CHANGELOG" ]; then - echo "svn2cl found, OK." +if [ ! -x "$PYTHON_ENV/bin/activate" ]; then + python -m venv ${PYTHON_ENV} +fi +. ${PYTHON_ENV}/bin/activate + + +if [ -x "$GIT_TO_CHANGELOG" ]; then + echo "git-changelog found, OK." else - get_svn2cl + pip install git-changelog fi BIN_7Z=`which 7z` diff --git a/admin/update-dist-dir.sh b/admin/update-dist-dir.sh index 62b931961..7e4714df1 100755 --- a/admin/update-dist-dir.sh +++ b/admin/update-dist-dir.sh @@ -12,14 +12,17 @@ if [ -e ${TRED_DIST_DIR}.new ]; then exit 1; fi && \ -echo "Exporting svn" && \ -svn export ${TRED_SVN_REPO} ${TRED_DIST_DIR}.new >> $LOG && \ +echo "Exporting git" && \ +##svn export ${TRED_SVN_REPO} ${TRED_DIST_DIR}.new >> $LOG && \ +git -C ${TRED_SRC_DIR} archive --output ${TRED_DIST_DIR}.new.zip HEAD >> $LOG && \ +unzip ${TRED_DIST_DIR}.new.zip -d ${TRED_DIST_DIR}.new >> $LOG && \ # updates TrEd version in dist/tred.new/tredlib/TrEd/Version.pm according to svn version to 1.#svn_version# ${TRED_DIST_DIR}.new/devel/update_version.pl ${TRED_SVN_REPO} && \ -echo "Updating extensions" && \ +echo "WARN: Skipping updating extensions" && \ +#echo "Updating extensions" && \ # perform pre-updates, update svn, then some post-updates for extension (currently only for tmt) according to extension/.make.d directory -${TRED_EXT_DIR}/update && \ +#${TRED_EXT_DIR}/update && \ cp ${TRED_SRC_DIR}/ChangeLog ${TRED_DIST_DIR}.new/ && \ diff --git a/tred_refactored/devel/update_version.pl b/tred_refactored/devel/update_version.pl index 978d12a3c..6bf058dcd 100755 --- a/tred_refactored/devel/update_version.pl +++ b/tred_refactored/devel/update_version.pl @@ -34,14 +34,9 @@ my $version_file = File::Spec->rel2abs('../tredlib/TrEd/Version.pm',$rb); die "Did not find $version_file!" if !-f $version_file; -# You'd better pass an arg to set this or this may fail in the future -my $REPO = shift || 'https://svn.ms.mff.cuni.cz/svn/TrEd_refactored/tred_refactored/'; - -my $svn_version = `svn info "$REPO" |grep "^Revision:" |cut -f2 -d:`; -my $updated_version = sprintf("%04d", $svn_version); -my $VER = '2.' . $updated_version; -chomp $VER; -$VER=~s/\s+//g; + +my $git_date = `git log -1 --date=format:"\%Y\%m\%d" --format="%ad"`; +my $VER = '3.' . $git_date; print $VER,"\n" unless $opts{'quiet'}; print STDERR "TrEd::Version: $version_file\n" if $opts{debug};