Skip to content

Commit

Permalink
Normalize path names for maintainer scripts in Git repositories
Browse files Browse the repository at this point in the history
Previously if the PKGBUILD specified something like './postinst' for say, the 'postinst' script, the update script wouldn't be able to find the file. Now we normalize path names so prefixes like './' are removed.
  • Loading branch information
hwittenborn committed Apr 14, 2022
1 parent 0e4b427 commit 150bfac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion aurweb/git/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def main(): # noqa: C901
)
script = srcinfo.get_variable(script_name)[0]

if script not in commit.tree:
if os.path.normpath(script) not in commit.tree:
die_commit(f"Missing {script_name} file {script}.", str(commit.id))

# Check sources.
Expand Down
5 changes: 4 additions & 1 deletion test/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,13 @@ def test_basic_push():
f"source_amd64 = {source_url_prefix}/source6",
f"focal_source_amd64 = {source_url_prefix}/source7",
f"focal_source_amd64 = {source_url_prefix}/source8",
"postinst = ./testfile",
],
)

repo.add(["PKGBUILD", ".SRCINFO"])
write_file("testfile", [])

repo.add(["PKGBUILD", ".SRCINFO", "testfile"])
repo.commit()
repo.push()

Expand Down

0 comments on commit 150bfac

Please sign in to comment.