Custom Search
Showing posts with label Debian Packaging. Show all posts
Showing posts with label Debian Packaging. Show all posts
Tuesday, May 27, 2014
Saturday, April 5, 2014
How to Download Modify Build and Install a Debian Source Package of Python Application
1)
Download the source and packaging script
#sudo apt-get source python-heatclient
2)
Extract the source and packaging script
3)
Modify the source ad packaging script
4)
Build the package again
#dpkg-buildpackage -b
5)
Show how to create new folder and config file like "/etc/projectname/projectconfig.conf" while installing a package. We should specify this while creating the package.
Download the source and packaging script
#sudo apt-get source python-heatclient
2)
Extract the source and packaging script
3)
Modify the source ad packaging script
4)
Build the package again
#dpkg-buildpackage -b
5)
Show how to create new folder and config file like "/etc/projectname/projectconfig.conf" while installing a package. We should specify this while creating the package.
Thursday, April 3, 2014
How to Create Debian Package for Python Application
1)
Clone the project
#git clone https://github.com/sajuptpm/python-smpplib.git
#cd python-smpplib
2)
Create "debian" folder
#mkdir debian
3)
Create "debian/changelog" file
#dch --create
4)
Create an empty copyright File
#vim debian/copyright
5)
Create an empty compat File
#vim debian/compat
6)
Create an empty rules File
#vim debian/rules
7)
Create an empty rules File
#vim debian/control
8)
Try to build the package
#dpkg-buildpackage -b
9)
Edit control File and add following lines
#vim debian/control
Source: python-smpplib
Maintainer: Developer
Package: python-smpplib
Architecture: all
10)
Try to build the package
#dpkg-buildpackage -b
11)
Edit rules file and add following lines
#vim debian/rules
#!/usr/bin/make -f
%:
dh $@ --with python2
12)
Try to build the package
#dpkg-buildpackage -b
13)
Edit compat file add add following line
#vim debian/compat
10
14)
Try to build the package
#dpkg-buildpackage -b
15)
Try to install the application from resultant debian Package
#cd ../
#dpkg -i python-smpplib_1_all.deb
#python
>>> import smpplib
16)
Remove/Uninstall the installed application
#sudo dpkg --purge python-smpplib
#python
>>> import smpplib
17)
Try Install the application using setup.py command
#sudo python setup.py install
#python
>>> import smpplib
18)
Remove/Uninstall the installed application
#sudo pip uninstall python-smpplib
#python
>>> import smpplib
Clone the project
#git clone https://github.com/sajuptpm/python-smpplib.git
#cd python-smpplib
2)
Create "debian" folder
#mkdir debian
3)
Create "debian/changelog" file
#dch --create
4)
Create an empty copyright File
#vim debian/copyright
5)
Create an empty compat File
#vim debian/compat
6)
Create an empty rules File
#vim debian/rules
7)
Create an empty rules File
#vim debian/control
8)
Try to build the package
#dpkg-buildpackage -b
9)
Edit control File and add following lines
#vim debian/control
Source: python-smpplib
Maintainer: Developer
Package: python-smpplib
Architecture: all
10)
11)
#vim debian/rules
#!/usr/bin/make -f
%:
dh $@ --with python2
12)
13)
#vim debian/compat
10
14)
15)
#cd ../
#dpkg -i python-smpplib_1_all.deb
#python
>>> import smpplib
16)
#sudo dpkg --purge python-smpplib
#python
>>> import smpplib
17)
#sudo python setup.py install
#python
>>> import smpplib
18)
#sudo pip uninstall python-smpplib
#python
>>> import smpplib
How to Install Jenkins and Plugins GitHub Plugin
1)
How to Install jenkins
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
Goto
http://127.0.0.1:8080/
2)
How to Install plugins
a)
How to Install GitHub Plugin
Goto Manage Jenkins ==> Manage Plugins ==> Available ==> GitHub Plugin ==> Install Without restart
How to Install jenkins
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
Goto
http://127.0.0.1:8080/
2)
How to Install plugins
a)
How to Install GitHub Plugin
Goto Manage Jenkins ==> Manage Plugins ==> Available ==> GitHub Plugin ==> Install Without restart
Monday, March 31, 2014
How to Jenkins Create a Debian Package for OpenStack python-heatclient
1)
Install Jenkins and Plugins
http://fosshelp.blogspot.in/2014/04/install-jenkins-and-github-plugin.html
2)
Get debian packaging script for python-heatclient project.
#sudo apt-get install devscripts
Goto following link and locate your project's *.dsc file
http://ubuntu-cloud.archive.canonical.com/ubuntu/pool/main/
Download the packaging script and extract it
#dget http://ubuntu-cloud.archive.canonical.com/ubuntu/pool/main/p/python-heatclient/python-heatclient_0.2.8-0ubuntu1~cloud0.dsc
#tar -xzf python-heatclient_0.2.8-0ubuntu1~cloud0.debian.tar.gz
#cd debian
#ls
3)
Clone the source code of python-heatclient
#git clone https://github.com/sajuptpm/python-heatclient.git
#cd python-heatclient
Create a new branch named "packaging" if not exist and switch to that branch.
#git checkout -b packaging
4)
Copy debian folder (packaging script) to "packaging" branch
#cp -r ../../debian .
#git status
#git add debian
#git commit debian
#git status
5)
Push packaging branch to remote to remote github repo
#git remote -v
#git push origin packaging
6)
Create build job in Jenkins
a)
Goto "New Item" --> type name for the new job/item --> Select "Build a free-style software project"
b)
* Under "Source Code Management" ---> Select "Git" ---> Type Repository URL (eg:https://github.com/sajuptpm/python-heatclient.git)
* Credentials --> Click on "Add" button --> Select kind "username and password" --> Give your github username and password -> Click "Add"
* Branches to build --> Type "origin/master" or "*/master"
c)
Under "Additional Behaviours" Section:
* Check out to a sub-directory --> Local subdirectory for repo : "build"
* Strategy for choosing what to build --> Choosing strategy --> "default"
d)
Under "Build Triggers" Section:
* Select "Build when a change is pushed to GitHub"
e)
Add following script Under "Build" Section:
* Excecute Shell --> Command
-----------------------
#!/bin/bash -xe
rm -f *.deb
cd build
if ! git checkout packaging
then
git checkout -b packaging origin/packaging
fi
git checkout packaging
dpkg-buildpackage -b
git push origin packaging || true
f)
Under "Post-build Actions" Section:
* Archive the artifacts --> Files to archive --> "*.deb"
g)
Save
7)
Build the package
a)
Job Workspace:
* if you need to try build with fresh copy of repo, delete the workspace and run build again.
* In workspace you can see the cloned repo, build directory and debian package
* You can also download the workspace as a zip file
http://192.168.56.101:8080/job/test1/ws/
b)
Configure the job:
http://192.168.56.101:8080/job/test1/configure
c)
Console log of build Job:
http://192.168.56.101:8080/job/test1/28/console
* Explain each line of console log when build get succeeded
Example Log:
Started by user anonymous
#Create workspace directory
Building in workspace /var/lib/jenkins/jobs/test1/workspace
#Clone the repo
Fetching changes from the remote Git repository
Fetching upstream changes from https://github.com/sajuptpm/python-heatclient.git
using .gitcredentials to set credentials
Checking out Revision 03f5d54b1fefb70850b2c0882fdb561a199a9b85 (origin/master)
#Goto workspace directory /var/lib/jenkins/jobs/test1/workspace and execute build script.
[workspace] $ /bin/bash -xe /tmp/hudson2998818138453737595.sh
+ rm -f '*.deb'
+ cd build
+ git checkout packaging
+ dpkg-buildpackage -b
8)
Dependencies of dpkg-buildpackage command
#sudo apt-get install dpkg-dev
#sudo apt-get install debhelper
#sudo apt-get install python-all
* http://ftp.br.debian.org/debian/pool/main/p/python-mox3/python-mox3_0.7.0-1_all.deb
#sudo gdebi python-mox3_0.7.0-1_all.deb
9)
Packaging Script:
https://github.com/sajuptpm/python-heatclient-debian-packaging
Install Jenkins and Plugins
http://fosshelp.blogspot.in/2014/04/install-jenkins-and-github-plugin.html
2)
Get debian packaging script for python-heatclient project.
#sudo apt-get install devscripts
Goto following link and locate your project's *.dsc file
http://ubuntu-cloud.archive.canonical.com/ubuntu/pool/main/
Download the packaging script and extract it
#dget http://ubuntu-cloud.archive.canonical.com/ubuntu/pool/main/p/python-heatclient/python-heatclient_0.2.8-0ubuntu1~cloud0.dsc
#tar -xzf python-heatclient_0.2.8-0ubuntu1~cloud0.debian.tar.gz
#cd debian
#ls
3)
Clone the source code of python-heatclient
#git clone https://github.com/sajuptpm/python-heatclient.git
#cd python-heatclient
Create a new branch named "packaging" if not exist and switch to that branch.
#git checkout -b packaging
4)
Copy debian folder (packaging script) to "packaging" branch
#cp -r ../../debian .
#git status
#git add debian
#git commit debian
#git status
5)
Push packaging branch to remote to remote github repo
#git remote -v
#git push origin packaging
6)
Create build job in Jenkins
a)
Goto "New Item" --> type name for the new job/item --> Select "Build a free-style software project"
b)
* Under "Source Code Management" ---> Select "Git" ---> Type Repository URL (eg:https://github.com/sajuptpm/python-heatclient.git)
* Credentials --> Click on "Add" button --> Select kind "username and password" --> Give your github username and password -> Click "Add"
* Branches to build --> Type "origin/master" or "*/master"
c)
Under "Additional Behaviours" Section:
* Check out to a sub-directory --> Local subdirectory for repo : "build"
* Strategy for choosing what to build --> Choosing strategy --> "default"
d)
Under "Build Triggers" Section:
* Select "Build when a change is pushed to GitHub"
e)
Add following script Under "Build" Section:
* Excecute Shell --> Command
-----------------------
#!/bin/bash -xe
rm -f *.deb
cd build
if ! git checkout packaging
then
git checkout -b packaging origin/packaging
fi
git checkout packaging
dpkg-buildpackage -b
git push origin packaging || true
f)
Under "Post-build Actions" Section:
* Archive the artifacts --> Files to archive --> "*.deb"
g)
Save
7)
Build the package
a)
Job Workspace:
* if you need to try build with fresh copy of repo, delete the workspace and run build again.
* In workspace you can see the cloned repo, build directory and debian package
* You can also download the workspace as a zip file
http://192.168.56.101:8080/job/test1/ws/
b)
Configure the job:
http://192.168.56.101:8080/job/test1/configure
c)
Console log of build Job:
http://192.168.56.101:8080/job/test1/28/console
* Explain each line of console log when build get succeeded
Example Log:
Started by user anonymous
#Create workspace directory
Building in workspace /var/lib/jenkins/jobs/test1/workspace
#Clone the repo
Fetching changes from the remote Git repository
Fetching upstream changes from https://github.com/sajuptpm/python-heatclient.git
using .gitcredentials to set credentials
Checking out Revision 03f5d54b1fefb70850b2c0882fdb561a199a9b85 (origin/master)
#Goto workspace directory /var/lib/jenkins/jobs/test1/workspace and execute build script.
[workspace] $ /bin/bash -xe /tmp/hudson2998818138453737595.sh
+ rm -f '*.deb'
+ cd build
+ git checkout packaging
+ dpkg-buildpackage -b
8)
Dependencies of dpkg-buildpackage command
#sudo apt-get install dpkg-dev
#sudo apt-get install debhelper
#sudo apt-get install python-all
* http://ftp.br.debian.org/debian/pool/main/p/python-mox3/python-mox3_0.7.0-1_all.deb
#sudo gdebi python-mox3_0.7.0-1_all.deb
9)
Packaging Script:
https://github.com/sajuptpm/python-heatclient-debian-packaging
Subscribe to:
Posts (Atom)