Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Correct petalinux prepare script
Browse files Browse the repository at this point in the history
  • Loading branch information
xlz-jbleclere committed Mar 25, 2022
1 parent a2e6b6c commit 2933512
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions petalinux/gen_rpm/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

SCRIPT_DIR = dirname(realpath(__file__))

DRM_DIR = join(SCRIPT_DIR, pardir, pardir)

run_args = dict(stdout=PIPE, stderr=PIPE, universal_newlines=True)

def run_git(git_cmd, from_dir=None):
Expand Down Expand Up @@ -51,19 +53,19 @@ def run_git(git_cmd, from_dir=None):
from_dir = abspath(SCRIPT_DIR)

# Get Version in CMakeLists.txt
cmake_file = join(SCRIPT_DIR, pardir, 'CMakeLists.txt')
cmake_file = join(DRM_DIR, 'CMakeLists.txt')
with open(cmake_file, 'rt') as f:
cmake_str = f.read()
cmake_version_str = re.search(r'ACCELIZEDRM_VERSION\s+([^)]+)', cmake_str).group(1)
print('CMakeFiles version =', cmake_version_str)
m = re.match(r'(\d+\.\d+\.\d+)(-.*)?', cmake_version_str)
cmake_ver = m.group(1)
cmake_rev = m.group(2)
if cmake_rev.startswith('-'):
if cmake_rev and cmake_rev.startswith('-'):
cmake_rev = cmake_rev[1:].replace('.','')

# Compute LICENSE MD5
license_file = join(SCRIPT_DIR, pardir, 'LICENSE')
license_file = join(DRM_DIR, 'LICENSE')
with open(license_file, 'rt') as f:
license_str = f.read()
md5 = hashlib.md5(license_str.encode()).hexdigest()
Expand Down Expand Up @@ -91,7 +93,7 @@ def run_git(git_cmd, from_dir=None):
git_tag = run_git('git tag --points-a HEAD', from_dir=from_dir)
if git_tag:
print('GIT tag =', git_tag)
assert cmake_version_str == git_tag, 'Tag must match version in CMakeLists.txt'
assert f'v{cmake_version_str}' == git_tag, 'Tag must match version in CMakeLists.txt'
git_options += f';tag={git_tag}'

# Create PV variable
Expand Down

0 comments on commit 2933512

Please sign in to comment.