New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
version based on git #229
version based on git #229
Conversation
Just for my understanding, where do you see the cutting line of installation procedure and the repository which will be installed? On the long run, we want to isolate all the installation scripts (e.g. ./utils/searx.sh) from the SearXNG repository. Lets imagine we have a command line named install_searxng and it's usage is like:
With I can suppose two installation types:
Now my question is: where does GIT_URL and GIT_BRANCH belongs to? Should these values in the repository or should this values stored somewhere in the installation? If I understand this Draft correct, these values are stored in a new file Having both installation types (from above) and an update process in mind, I always revolve around this point and can't get any further. Can you describe what scenarios you have in mind and what solution you suppose. |
That is the point of this PR : Actually, there are two modes:
If you run searxng from your fork,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dalf thanks for your explanation / sounds good to me .. but to be true I need some practice to see if there is a trap I don't see right now. Anyway, lets go into this direction ... I made some remarks in my review .. I think the version.py can be improved.
If you want, I can try to improve the implementation .. but I cant promise you when.
searx/version.py
Outdated
def call_subprocess(cmd, cwd="."): | ||
if os.name == "posix" and not isinstance(cmd, (list, tuple)): | ||
cmd = shlex.split(cmd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry if I'm being annoying :-) .. What use case (OS) do you have in mind for non posix .. and what happens with the sub process call when os.name != "posix"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My take was setup_scm has most probably dealt with various platforms.
But, more in detail, from https://docs.python.org/3/library/subprocess.html#subprocess.Popen :
On Windows, if args is a sequence, it will be converted to a string in a manner described in Converting an argument sequence to a string on Windows. This is because the underlying CreateProcess() operates on strings.
And according to https://stackoverflow.com/questions/1854/python-what-os-am-i-running-on os.name != 'posix'
only on Windows (and Jython which is out of scope and perhaps some other implementation I'm not aware of, yes it should be os.name != 'nt'
according to what I understand even in setup_scm).
But anyway searx/version.py
works on Windows even with the commit 7710c94
FYI: alternative version.py implementation (including last patches from here) https://github.com/return42/searxng/commits/version-from-git |
Hm, now I see what I missed .. this is run-time, but I asked for the installation-time:
What I have tried / with the fixes in my branch 1.1. clone
2.1. clone (e.g.)
How to proceed? I would suggest to reset your branch to the state of mine. Otherwise I have to repeat all tests in your branch (I do not have more time today). My branch is based on your e5d1cd3 and includes your patch 2d60d80 (and 7710c94 is not needed in my version.py). What I mean, everything from your branch (except 93e3e3f) is in my fully tested branch. I prefer my branch since 93e3e3f in your branch means that I have to repeat all my tests. Is it OK for you to reset your branch with mine? Afterwards we can squash some commits / I think. |
I would like to know how to test? Just the command you have provided? (I'm installing a VM to run the scripts) |
my branch starts at your commit e5d1cd3 and places some patches on top. In detail:
Until here both branches are more or less identical, while 93e3e3f is untested return42@5d7757d is tested. The next commits are not in your branch, they are only in my branch, fixing some issues I had at installation time ...
Sorry if this is a mess of two branches but we developed parallel in two branches. You merged parts from mine and I merged parts from yours :-) |
This commit remove the need to update the brand for GIT_URL and GIT_BRANCH: there are read from the git repository. It is possible to call python -m searx.version freeze to freeze the current version. Useful when the code is installed outside git (distro package, docker, etc...)
The first import of names from the searx package implies loading the settings.yml. Before this is done, the enviroment variables must be unset to not overwrite the values from the settings.yml Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Fix the quotation marks in the command line to run python -m searx.version Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
If you think PR is ready to review, remove the "Draft" tag .. then I will run my tests this evening. |
Yes. Frst I create a LXC:
Then I jump in the container ..
in this bash in the container I run the installation procedures shown in #229 (comment) I have tested only in archlinux but others should be the same. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works flawless / lets merge.
BTW: Thank you for your patience with me :-)
@paulgoio, since this PR has merged, it seems you have to copy all the files from this repository to update your fork? |
You said:
Can the command python -m searxng.version freeze be in the documentation? |
What does this PR do?
This commit removes:
searxng/searx/settings.yml
Lines 13 to 16 in ed0db4d
these values are read from the git repository: it requires the directory to be git repository.
It is possible to call
python -m searx.version freeze
to freeze the current version (it creates thesearx/version_frozen.py
file)It is useful when the code is install outside git (distro package, docker, etc...)
The code is based on setuptool_scm: it calls the
git
command line to retrieve the values. Seesearx/version.py
.Why is this change important?
make docker.build
: this PR fixes a possible inconsistency in the master branch:searxng/manage
Lines 274 to 278 in ed0db4d
With the change, the footer is always up to date without additional configuration:
1.0.0-590-f2979c72
comes fromgit describe
-dirty
shows that there are some uncommited changes.How to test this PR locally?
make run
: check the version at the bottom of the page is the right one.python -m searx.version freeze
make docker
:make docs
utils/searx.sh
to install the apputils/searx.sh update
worksAuthor's checklist
Related issues
Closes: #36