1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-08-15 10:50:09 +02:00

common.get_head_commit_id() to get string commit ID from HEAD

This commit is contained in:
Hans-Christoph Steiner 2020-02-18 10:36:28 +01:00
parent fafaa8f81f
commit 5459a461db
No known key found for this signature in database
GPG Key ID: 3E177817BA1B9BFA
2 changed files with 9 additions and 4 deletions

View File

@ -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)

View File

@ -17,7 +17,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
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)