Fedora - Python Development: RPMs, Repos, and GitHub

SUMMARY
When I started coding up Pyconnmgr and Pyscreenie, I was at a loss on how I was going to get that into a repo or even a RPM. I wanted to make sure I had something that I could easily install across all my desktops, servers, and virtual installs. After some searching, this is the process I came up with that best suits my needs.

INSTRUCTIONS
1.) We start with GitHub. I wanted to have my code available on a familiar platform. GitHub seemed like the popular choice, and very easy and straight forward to use. There are tons of tutorials out there on how to setup and use Git, so there is no reason for me to go into details. I got my account setup, and familiarized myself with the process and common commands. The initial set of commands I ran were:

mkdir -p ~/projects/python/pyconnmgrDEV
cd ~/projects/python/pyconnmgrDEV

My directory structure usually looks like this:

AUTHORS
ChangeLog
COPYING
glade
INSTALL
LICENSE
MANIFEST
MANIFEST.in
pyconnmgr.1.gz
pyconnmgr.desktop
pyconnmgr.spec
README
README.md
setup.cfg
setup.py
src
tools

Each of the above files are important, and it took some research and Googling to figure out how to get things like pyconnmgr.spec and setup.py correct. Otherwise, the below rpmbuild process would constantly fail. For the details on each of those files, the best way to see the source is by going directly to my GitHub page: https://github.com/TheLupine

After the above initial files are in place, I ran:

git init
git add --all
git commit -m "4.0.0 initial Fedora20 release"
git tag v4.0.0
git remote add origin git@github.com:TheLupine/pyconnmgr.git
git push -u origin master

Again, the above commands only needed to be run once, at the very beginning of development.

2.) Another initial step I had to do at the beginning, was prep my repo. I have my own www server, obviously, so I decided to use that. But first, I needed to prep the rpm/repo environment, and make sure thing were all gpg signed. Again, not going into details with this, as there is far better documentation out there. The main steps/points are the following:

gpg --gen-key

...this created my gpg key under ~/.gnupg

gpg --export -a 'TheLupine' > RPM-GPG-KEY-TheLupine

...this created my rpm key file which I uploaded to my repo site, which is just a "repos" folder in the root of my www site.
Next I created my ~/.rpmmacros file:

%_signature gpg
%_gpg_path /home/danny/.gnupg
%_gpg_name TheLupine (TheLupine - Fedora GnuPG) 
%_gpgbin /usr/bin/gpg

Finally, the last file I needed to create/upload was: http://www.thelupine.com/repos/thelupine.repo

That's it for all the initial steps. Everything else below is what I commonly do for day to day updates.

4.) Once I've completed all the coding/updates I want to do for the day, I run the following Git commands

git add --all
git commit -m "4.0.5 xfreerdp working correctly now"
git tag v4.0.5
git push origin master

5.) With all the code update, it was time for me to build the rpm, and upload to my repo:

cd ~/projects/python/
cp -av pyconnmgrDEV pyconnmgr-4.0.5
rm -rf pyconnmgr-4.0.5/.git
tar -cvzf ~/rpmbuild/SOURCES/pyconnmgr-4.0.5.tar.gz pyconnmgr-4.0.5
cd pyconnmgr-4.0.5
rpmbuild -bi pyconnmgr.spec
rpmbuild -ba pyconnmgr.spec
rpm --addsign ~/rpmbuild/RPMS/noarch/pyconnmgr-4.0.5-1.fc19.noarch.rpm
rpm --addsign ~/rpmbuild/SRPMS/pyconnmgr-4.0.5-1.fc19.src.rpm
rsync -av ~/rpmbuild/RPMS ~/rpmbuild/repos/
rsync -av ~/rpmbuild/SRPMS ~/rpmbuild/repos/
createrepo --database ~/rpmbuild/repos/
rsync -av ~/rpmbuild/repos thelupin@www.thelupine.com:/home/thelupin/public_html/

CONCLUSION
That is about it. Obviously, there are more details and more thorough documentation out there. However, I just wanted to make sure I had the basic steps and initial setup process documented, as it is always good for a reference.

Pages