Creating GitHub Pull Requests - Gentoo wiki
Jump to: content Creating GitHub Pull Requests From Gentoo Wiki (Redirected from Github Pull Requests ) This article has been flagged for not conforming to the wiki guidelines . Please help Gentoo out by starting fixing things. Resources Gentoo Pull Requests GitHub PR help This article explains how to contribute to Gentoo by creating pull requests on GitHub . Workflow of a user contribution. The green arrows show the path of contribution.
Grey arrows are optional, possible access directions. How to make a pull request Making a pull request is explained at length in the various how-tos put together by the GitHub folks, here are three must-read how-tos: Fork the Gentoo repository Syncing the fork Using pull requests Important Currently new packages are added via proxy-maint project and the current manpower isn't enough to handle the flood of new packages.
We recommend contributing to GURU overlay instead for now, where interesting and popular packages are pulled to ::gentoo. Read more: https://archives.gentoo.org/gentoo-proxy-maint/message/44f7712fb49850288cd840c3541f6d7e Configuration Repository's remote configuration Variant a: User configures a local repository Clone the github mirror of the Gentoo repository under the remote name "origin" into the path/to/save directory (substitute path/to/save with the directory of choice): user $ git clone -o origin https://github.com/gentoo/gentoo.git path/to/save Step into the new directory, then view the 'remote' settings user $ cd $_ user $ git remote -v origin https://github.com/gentoo/gentoo.git (fetch) origin https://github.com/gentoo/gentoo.git (push) Fork the Gentoo repository on GitHub Add it under the remote name "github" to your local repository. user $ git remote add github <UrlOfYourFork.git> Verify the repository's remote settings user $ git remote -v github https://github.com/<github user>/gentoo (fetch) github https://github.com/<github user>/gentoo (push) origin https://github.com/gentoo/gentoo.git (fetch) origin https://github.com/gentoo/gentoo.git (push) Variant b: Using the git repository as the ::gentoo repository Warning This setup is not fully functional since the plain developer repository as obtained from github lacks the metadata generated for the official ::gentoo repository. root # mkdir /etc/portage/repos.conf/ Add the following to the file: FILE /etc/portage/repos.conf/gentoo.conf [gentoo] location = /var/db/repos/gentoo sync-type = git sync-uri = https://github.com/gentoo/gentoo.git auto-sync = yes sync-user = portage:portage Add the following, substitute <dev_user_name> with your username as appropriate in the script below.
FILE /etc/portage/postsync.d/99-user-dev-perms #!/bin/bash DEV_USER_NAME = <dev_user_name> find /var/db/repos/gentoo/ -type d -exec setfacl -m u: $DEV_USER_NAME :rwx {} \; find /var/db/repos/gentoo/ -type f -exec setfacl -m u: $DEV_USER_NAME :rw {} \; find /var/db/repos/gentoo/.git -type d -exec setfacl -m u: $DEV_USER_NAME :rwx {} \; find /var/db/repos/gentoo/.git -type f -exec setfacl -m u: $DEV_USER_NAME :rw {} \; root # chmod +x /etc/portage/postsync.d/99-user-dev-perms Then sync the repository. root # emerge --sync Fork the Gentoo repository on GitHub Add it under the remote name "github" to your local repository. user $ cd /var/db/repos/gentoo user $ git remote add github <UrlOfYourFork.git> Repository's user configuration Configure git to use the target key for code signing and to properly sign-off all your commits (a more detailed description of how to create the signingkey is given in the next section ): user $ git config --local user.name "Your Full Name" user $ git config --local user.email "example@domain.tld" user $ git config --local user.signingkey KEY-FINGERPRINT user $ git config --local commit.gpgsign 1 Add helpful optional settings: user $ git config --local pull.ff only user $ git config --local pull.rebase merges user $ git config --local push.default simple user $ git config --local push.gpgsign 0 Verify the settings: user $ git config --local --list GPG configuration Add the following to gpg.conf : FILE ~/.gnupg/gpg.conf General GPG Setup keyserver hkps://keys.gentoo.org keyserver-options no-honor-keyserver-url cert-digest-algo SHA512 default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed Now to generate the key: user $ gpg --full-generate-key Select the algorithm.
Set the key size. Specify how long the key should be valid (No more than 5 years). Confirm the information is correct. Set your name. Set your passphrase, and confirm it. It might take some time if you've chosen a high bit length key. Retrieve your GPG public keyID via the following command: user $ gpg --list-public-keys --keyid-format 0xlong example@domain.tld The key id is the portion after the <algorithm>/ on the line beginning with pub as shown in bold below.
If you have more than one key with the specified UID you will need to select the correct key yourself from the list of returned keys. pub rsa4096/ KEY-FINGERPRINT Upload your key to the keyserver: user $ gpg --keyserver keys.openpgp.org --send-key KEY-FINGERPRINT Usage Step 1: User updates the local repository user $ git checkout master user $ git pull origin master Step 2: User changes a package Say you are making changes to package app-foo/bar .
Create a local branch with the changes: user $ git checkout -b <branch name> master Make the changes and make sure to run pkgcheck to check for basic errors: user $ git add . user $ pkgdev manifest user $ pkgcheck scan --net --commits Then commit the changes, preferably using pkgdev . user $ pkgdev commit --signoff Tip If pkgdev commit fails with an error like "error: gpg failed to sign the data", run the command again as GIT_TRACE=1 pkgdev commit ... and run the gpg command which fails manually to find the real error.
If that still doesn't work then check the Troubleshooting section pkgdev can also be configured to always put signoff automatically . If the commit is to close or comment bugs on Bugzilla, these should be mentioned in the commit message as suggested by GLEP66 . pkgdev supports this through the --bug and --closes options. user $ pkgdev commit --closes NNNNNN --signoff Step 3: User makes a pull request Now that the changes have been made and the local branch updated, it is time to send it off to GitHub and make a PR (Pull Request) for the Gentoo Developers.
Start by pushing the branch with the changes to your GitHub repository: user $ git push github <branch name> Then create a pull request from your GitHub repository's local branch to the Gentoo repository's master branch. When the changes have been merged, you may delete the local repository's branch with: user $ git checkout master user $ git branch -d <branch name> user $ git push github :<branch name> Links to bug report(s) A bot automatically picks up bug reports if the link(s) to the bug in question appear(s) in the body of the commit message.
The bot then writes a message in the bug report and/or closes it. That way, other users quickly get to know a patch or a fix has landed in the tree. This feature helps Gentoo developers save time as they don't have to switch back and forth between Bugzilla, GitHub, and their terminal to figure out which bug reports may be closed. How does it work? The bot can parse two types of header: Bug: https://bugs.gentoo.org/123456 will automatically write a message in the bug report without closing it.
Closes: https://bugs.gentoo.org/123456 will automatically write a message in the bug report, change the status of the bug report to RESOLVED and the resolution to FIXED. If the commit involves several bug reports, they can be mentioned and stack the links. The bot will write a message in each bug report: Bug: https://bugs.gentoo.org/123456 Bug: https://bugs.gentoo.org/456789 Bug: https://bugs.gentoo.org/101010 It also works with the Closes: header: Closes: https://bugs.gentoo.org/123456 Closes: https://bugs.gentoo.org/456789 Clo
The rest of this page is on the live site.