Dear developers,

attached is a patch, which works for me under ubuntu and cmake.
The basic idea:
version.py gets a neutral function getRevision, which is called by the
library installers.
This new function tries to call gitDescribe. If this fails, it calls
parseConfigFile to figure out the version from config.h.

Regards, Harald

Am 18.12.18 um 20:35 schrieb Jakob Erdmann:
> Dear Harald,
> thank you for reporting this (now tracked at
> https://github.com/eclipse/sumo/issues/4946).
> Your proposal reflects how things ought to be but we broke it during
> our ongoing migration from autotools to cmake.
> best regards,
> Jakob
>
>
> Am Di., 18. Dez. 2018 um 20:09 Uhr schrieb Harald Schaefer
> <[email protected] <mailto:[email protected]>>:
>
>     Dear developers,
>
>     it is not possible to install the latest release 1.1.0 build from
>     the sumo-all tar ball without errors.
>
>     The install process has three errors like this
>
>         - Up-to-date: /usr/local/share/sumo/tools/xml/xsd.py
>         fatal: Kein Git-Repository (oder irgendein Elternverzeichnis
>         bis zum Einhängepunkt /)
>         Stoppe bei Dateisystemgrenze (GIT_DISCOVERY_ACROSS_FILESYSTEM
>         nicht gesetzt).
>         Traceback (most recent call last):
>           File
>         "/dosd/src/opensource/Sumo/sumo-1.1.0/tools/build/setup-sumolib.py",
>         line 21, in <module>
>             SUMO_VERSION = version.gitDescribe()[1:-11].replace("_",
>         ".").replace("+", ".")
>           File
>         "/dosd/src/opensource/Sumo/sumo-1.1.0/tools/build/version.py",
>         line 41, in gitDescribe
>             d = subprocess.check_output(command,
>         universal_newlines=True).strip()
>           File "/usr/lib/python2.7/subprocess.py", line 223, in
>         check_output
>             raise CalledProcessError(retcode, cmd, output=output)
>         subprocess.CalledProcessError: Command '['git', 'describe',
>         '--long', '--always', 'HEAD']' returned non-zero exit status 128
>
>     It seems that the install routines calls version.py, which in turn
>     calls some git routines, which failed.
>
>     My understanding is:
>
>     If you create a tar-file for a release x.y.z, i would assume that
>
>     the version string x.y.z is hardcoded in one or more files or
>
>     the files to compute the version number are included in this tar ball.
>
>     You should be able to compile and install from a tar-src file
>     without git or svn or whatever is currently the version management
>     system used.
>
>     The generated sumo executable has no version
>
>         harald@nyc> ../../bin/sumo --version
>         Eclipse SUMO Version UNKNOWN
>          Build features: Linux-4.18.0-12-generic x86_64 GNU 8.2.0
>         Release Proj GUI GDAL OSG GL2PS SWIG
>          Copyright (C) 2001-2018 German Aerospace Center (DLR) and
>         others; http://sumo.dlr.de
>
>     If I build sumo (version 1.0.1) the same way, it has a version string:
>
>         harald@nyc> ../../bin/sumo --version
>         Eclipse SUMO Version 1.0.1
>          Build features: Linux-4.18.0-12-generic Proj GUI GDAL OSG
>         GL2PS SWIG
>          Copyright (C) 2001-2018 German Aerospace Center (DLR) and
>         others; http://sumo.dlr.de
>
>     My proposal is:
>
>     When creating a tar file from git, you should copy a file
>     containing the official version for this file (e.g. 1.1.0 or
>     1.1.0+xxxxxxxxx).
>
>     The script version.py reads this file, if it exists, and sets the
>     correct version.
>
>     Best regards
>
>     Harald
>
>
>
>     _______________________________________________
>     sumo-dev mailing list
>     [email protected] <mailto:[email protected]>
>     To change your delivery options, retrieve your password, or
>     unsubscribe from this list, visit
>     https://www.eclipse.org/mailman/listinfo/sumo-dev
>
>
> _______________________________________________
> sumo-dev mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe from 
> this list, visit
> https://www.eclipse.org/mailman/listinfo/sumo-dev


Diff <tar> sumo-1.1.0/tools/build/version.py
*** /tmp/tardiff2_20749	2018-12-20 11:35:48.036185116 +0100
--- sumo-1.1.0/tools/build/version.py	2018-12-20 10:41:19.228794400 +0100
***************
*** 29,31 ****
--- 29,33 ----
  import subprocess
+ import re
  from os.path import dirname, exists, getmtime, join
+ from os import getcwd

***************
*** 35,36 ****
--- 37,57 ----

+ def parseConfig(configFile):
+     """ get the sumo version encoded in config.h """
+     for l in open(configFile, 'rb'):
+         m = re.search('#define VERSION_STRING "([^"]*)"', l)
+         if m:
+             d = m.group(1)
+             break
+     return d
+
+ def getRevision(commit="HEAD", gitDir=None):
+     """ get the version number either from git or from a config.h file
+         in the form x.y.z+nnn """
+     d = UNKNOWN_REVISION;
+     try:
+         d = gitDescribe(commit, gitDir)[1:-11]
+     except:
+         d = parseConfig('src/config.h')
+         #print(getcwd())
+     return d


Diff <tar> sumo-1.1.0/tools/build/setup-libsumo.py
*** /tmp/tardiff2_20749	2018-12-20 11:35:58.240371249 +0100
--- sumo-1.1.0/tools/build/setup-libsumo.py	2018-12-19 19:28:45.725329400 +0100
***************
*** 20,22 ****

! SUMO_VERSION = version.gitDescribe()[1:-11].replace("_", ".").replace("+", ".")
  package_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
--- 20,22 ----

! SUMO_VERSION = version.getRevision().replace("_", ".").replace("+", ".")
  package_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))

Diff <tar> sumo-1.1.0/tools/build/setup-sumolib.py
*** /tmp/tardiff2_20749	2018-12-20 11:36:08.416551406 +0100
--- sumo-1.1.0/tools/build/setup-sumolib.py	2018-12-19 18:22:56.885958300 +0100
***************
*** 20,22 ****

! SUMO_VERSION = version.gitDescribe()[1:-11].replace("_", ".").replace("+", ".")
  package_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
--- 20,22 ----

! SUMO_VERSION = version.getRevision().replace("_", ".").replace("+", ".")
  package_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))

Diff <tar> sumo-1.1.0/tools/build/setup-traci.py
*** /tmp/tardiff2_20749	2018-12-20 11:35:37.887994330 +0100
--- sumo-1.1.0/tools/build/setup-traci.py	2018-12-19 19:26:39.935909000 +0100
***************
*** 20,22 ****

! SUMO_VERSION = version.gitDescribe()[1:-11].replace("_", ".").replace("+", ".")
  package_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
--- 20,22 ----

! SUMO_VERSION = version.getRevision().replace("_", ".").replace("+", ".")
  package_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
sumo-dev mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-dev

Reply via email to