Skip to content

Commit

Permalink
remove svn dependencies: change variables, different tool for changel…
Browse files Browse the repository at this point in the history
…og, load external extensions repository, use fifferent version numbering #3
  • Loading branch information
matyaskopp committed May 27, 2024
1 parent e082823 commit 804dd57
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 58 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extensions
local_www
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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}
21 changes: 14 additions & 7 deletions admin/env_refactored.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/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


# Installation prefix -- documentation goes to $INSTALL_BASE/doc,
# 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)
Expand All @@ -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=""
Expand Down Expand Up @@ -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

[email protected]: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
Expand All @@ -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

Expand All @@ -104,4 +111,4 @@ CHANGELOG_TO_RSS=${ADMIN_DIR}/changelog2rss.pl
[email protected]
MAC_TRED_INSTALLATION='~/tred_installation'
MAC_TRED_INSTALLATION_OLD='~/tred_installation_old'
MAC_SVN_DIR='~/TrEd'
MAC_GIT_DIR='~/TrEd'
9 changes: 5 additions & 4 deletions admin/make-changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 && \
Expand Down
43 changes: 9 additions & 34 deletions admin/prereq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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`
Expand Down
11 changes: 7 additions & 4 deletions admin/update-dist-dir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/ && \

Expand Down
11 changes: 3 additions & 8 deletions tred_refactored/devel/update_version.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit 804dd57

Please sign in to comment.