Skip to content

Instantly share code, notes, and snippets.

@decathorpe
Created December 20, 2021 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save decathorpe/9d128982cb00e2d345d9e397372538ec to your computer and use it in GitHub Desktop.
Save decathorpe/9d128982cb00e2d345d9e397372538ec to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
# Add @rust-sig group with "commit" access to one or multiple packages
# Script accepts package names as command line arguments (and strips ","
# characters from arguments, so copy-pasting comma-separated lists of package
# names from report emails is supported, as well).
import sys
import requests
TOKEN = "PASTE-YOUR-src.fedoraproject.org-TOKEN-with-Modify-an-existing-project-access-HERE"
def main():
packages = [package.strip(",") for package in sys.argv[1:]]
for package in packages:
print(f" - adding @rust-sig to {package} ...")
url = f"https://src.fedoraproject.org/api/0/rpms/{package}/git/modifyacls"
data = {
"user_type": "group",
"name": "rust-sig",
"acl": "commit",
}
headers = {
"Authorization": f"token {TOKEN}",
"Content-Type": "application/x-www-form-urlencoded",
}
response = requests.post(url, data=data, headers=headers)
response.raise_for_status()
return 0
if __name__ == "__main__":
exit(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment