Lines 729-738
if installation.TYPE == installation.TYPES.SOURCE:
Link Here
|
729 |
BASH_BINARY, |
729 |
BASH_BINARY, |
730 |
"-c", |
730 |
"-c", |
731 |
( |
731 |
( |
732 |
f"cd {_shell_quote(PORTAGE_BASE_PATH)} ; git describe --match 'portage-*' || exit $? ; " |
732 |
f"cd {_shell_quote(PORTAGE_BASE_PATH)} ; git describe --dirty --match 'portage-*' || exit $? ; " |
733 |
'if [ -n "`git diff-index --name-only --diff-filter=M HEAD`" ] ; ' |
|
|
734 |
"then echo modified ; git rev-list --format=%%ct -n 1 HEAD ; fi ; " |
735 |
"exit 0" |
736 |
), |
733 |
), |
737 |
] |
734 |
] |
738 |
cmd = [ |
735 |
cmd = [ |
Lines 744-776
if installation.TYPE == installation.TYPES.SOURCE:
Link Here
|
744 |
output = _unicode_decode(proc.communicate()[0], encoding=encoding) |
741 |
output = _unicode_decode(proc.communicate()[0], encoding=encoding) |
745 |
status = proc.wait() |
742 |
status = proc.wait() |
746 |
if os.WIFEXITED(status) and os.WEXITSTATUS(status) == os.EX_OK: |
743 |
if os.WIFEXITED(status) and os.WEXITSTATUS(status) == os.EX_OK: |
747 |
output_lines = output.splitlines() |
744 |
VERSION = output.lstrip('portage-').strip() |
748 |
if output_lines: |
745 |
else: |
749 |
version_split = output_lines[0].split("-") |
746 |
VERSION = "HEAD" |
750 |
if len(version_split) > 1: |
|
|
751 |
VERSION = version_split[1] |
752 |
patchlevel = False |
753 |
if len(version_split) > 2: |
754 |
patchlevel = True |
755 |
VERSION = f"{VERSION}_p{version_split[2]}" |
756 |
if len(output_lines) > 1 and output_lines[1] == "modified": |
757 |
head_timestamp = None |
758 |
if len(output_lines) > 3: |
759 |
try: |
760 |
head_timestamp = int(output_lines[3]) |
761 |
except ValueError: |
762 |
pass |
763 |
timestamp = int(time.time()) |
764 |
if ( |
765 |
head_timestamp is not None |
766 |
and timestamp > head_timestamp |
767 |
): |
768 |
timestamp = timestamp - head_timestamp |
769 |
if not patchlevel: |
770 |
VERSION = f"{VERSION}_p0" |
771 |
VERSION = f"{VERSION}_p{timestamp}" |
772 |
return VERSION |
773 |
VERSION = "HEAD" |
774 |
return VERSION |
747 |
return VERSION |
775 |
|
748 |
|
776 |
VERSION = _LazyVersion() |
749 |
VERSION = _LazyVersion() |
777 |
- |
|
|