diff --git a/fdroidserver/common.py b/fdroidserver/common.py index ccd65f5a..7fffabb0 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -670,6 +670,14 @@ def get_build_dir(app): return os.path.join('build', app.id) +def get_head_commit_id(git_repo): + """Get git commit ID for HEAD as a str + + repo.head.commit.binsha is a bytearray stored in a str + """ + return hexlify(bytearray(git_repo.head.commit.binsha)).decode() + + def setup_vcs(app): '''checkout code from VCS and return instance of vcs and the build dir''' build_dir = get_build_dir(app) diff --git a/fdroidserver/import.py b/fdroidserver/import.py index 68520881..42ba55e3 100644 --- a/fdroidserver/import.py +++ b/fdroidserver/import.py @@ -17,7 +17,6 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -import binascii import git import glob import json @@ -266,9 +265,7 @@ def main(): raise FDroidException("Specify project url.") app.UpdateCheckMode = 'Tags' - - # repo.head.commit.binsha is a bytearray stored in a str - build.commit = binascii.hexlify(bytearray(git_repo.head.commit.binsha)).decode() + build.commit = common.get_head_commit_id(git_repo) # Extract some information... paths = get_all_gradle_and_manifests(tmp_importer_dir)