Skip to content

Commit

Permalink
Preserve Chorus env vars, ensure chg can find hg
Browse files Browse the repository at this point in the history
  • Loading branch information
rmunn committed Nov 9, 2024
1 parent 1325a27 commit 93416ec
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions docker/scripts/create-installation-tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ install -d ${DBDESTDIR}/${LIB}/Mercurial/mercurial/utils
install -d ${DBDESTDIR}/${LIB}/Mercurial/mercurial/upgrade_utils
install -d ${DBDESTDIR}/${LIB}/MercurialExtensions
install -d ${DBDESTDIR}/${LIB}/MercurialExtensions/fixutf8
install -m 755 Mercurial/chg ${DBDESTDIR}/${LIB}/Mercurial
install -m 755 Mercurial/hg ${DBDESTDIR}/${LIB}/Mercurial
install -m 644 Mercurial/mercurial.ini ${DBDESTDIR}/${LIB}/Mercurial
install -m 644 Mercurial/hgdemandimport/*.* ${DBDESTDIR}/${LIB}/Mercurial/hgdemandimport
Expand Down
2 changes: 1 addition & 1 deletion lfmergeqm-background.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

while :
do
sudo -H -u www-data lfmergeqm
sudo -H --preserve-env=CHORUS_HG_EXE -u www-data lfmergeqm
sleep 86400
done
4 changes: 2 additions & 2 deletions lfmergeqm-looping.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trap "exit" TERM
# This is expected to run as the CMD, launched by the entry point.

while inotifywait -e close_write /var/lib/languageforge/lexicon/sendreceive/syncqueue; do
sudo -H -u www-data lfmergeqm
sudo -H --preserve-env=CHORUS_HG_EXE -u www-data lfmergeqm
# Run it again just to ensure that any initial clones that missed a race condition have a chance to get noticed
sudo -H -u www-data lfmergeqm
sudo -H --preserve-env=CHORUS_HG_EXE -u www-data lfmergeqm
done
3 changes: 3 additions & 0 deletions src/LfMerge/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public static int Main(string[] args)
MainClass.Logger.Notice("LfMerge {2} (database {0}) starting with args: {1}",
MainClass.ModelVersion, string.Join(" ", args), MainClass.GetVersionInfo("SemVer"));

// chg internal logic for finding hg trips up on LfMerge's unconvential path to hg, so we need to tell it where to find hg
Environment.SetEnvironmentVariable("CHGHG", $"/usr/lib/lfmerge/{MainClass.ModelVersion}/Mercurial/hg");

if (string.IsNullOrEmpty(options.ProjectCode))
{
MainClass.Logger.Error("Command line doesn't contain project code - exiting.");
Expand Down
2 changes: 1 addition & 1 deletion src/LfMergeQueueManager/QueueManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void Main(string[] args)
if (options == null)
return;

MainClass.Logger.Notice("LfMergeQueueManager starting with args: {0}", string.Join(" ", args));
MainClass.Logger.Notice("LfMergeQueueManager starting with CHORUS_HG_EXE value \"{1}\" and args: {0}", string.Join(" ", args), Environment.GetEnvironmentVariable("CHORUS_HG_EXE") ?? "<null>");

// initialize the SLDR
Sldr.Initialize();
Expand Down

0 comments on commit 93416ec

Please sign in to comment.