码迷,mamicode.com
首页 > 其他好文 > 详细

Debian Customer PPA RFC (by quqi99)

时间:2016-11-18 00:32:14      阅读:453      评论:0      收藏:0      [点我收藏+]

标签:timestamp   www   ons   添加   compute   export   sts   rom   ebs   

作者:张华  发表于:2016-01-13
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明

( http://blog.csdn.net/quqi99 )

Precondition

a, sudo apt install gnupg pbuilder ubuntu-dev-tools bzr-builddeb apt-file debhelper dh-systemd openstack-pkg-tools

b, GPG key
scp -r /home/hua/.gnupg ubuntu@192.168.100.3:~/
gpg --list-public           # or gpg --gen-key
export GPGKEY=XXXXXX
gpg --send-keys --keyserver keyserver.ubuntu.com $GPGKEY

c, SSH key
ssh-keygen -t rsa
https://launchpad.net/~/+editsshkeys

d, Bazaar
bzr whoami "<Email>"
bzr launchpad-login <lauchpad_id>

Get the source code

a, Add related ppa to /etc/apt/source.list
   ppa info can be found from lanchpad https://launchpad.net/~zhhuabj/+archivesubscriptions
   
b, Import the public key and update the repository
   sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <public-key>
   sudo apt-get update

c, Get the source code (pls don‘t add other repository when executing this step)
   #Get package from the ppa
   sudo apt-get source <package-name>    
   #Get package from official repo
   #pull-lp-source lsb trusty

   #debcheckout --git-track=‘*‘ nova   #for openstack sru

d, dget *.dsc

Example:

sudo add-apt-repository cloud-archive:kilo
#uncomment deb-src in /etc/apt/sources.list.d/cloudarchive-kilo.list
$ cat /etc/apt/sources.list.d/cloudarchive-kilo.list
deb http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/kilo main
deb-src http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/kilo main


sudo rm /var/lib/apt/lists/* -vf && sudo apt-get update

rmadison libvirt

sudo apt-cache madison nova-compute  #See all versions
sudo apt-get source nova=1:2015.1.2-0ubuntu2~cloud

其中get-get source相当于:

#https://launchpad.net/~ubuntu-cloud-archive/+archive/ubuntu/kilo-staging/+packages?field.name_filter=qemu&field.status_filter=superseded&field.series_filter=
wget https://launchpad.net/~ubuntu-cloud-archive/+archive/ubuntu/kilo-staging/+files/qemu_2.2+dfsg-5expubuntu9.6~cloud0.debian.tar.gz
wget https://launchpad.net/~ubuntu-cloud-archive/+archive/ubuntu/kilo-staging/+files/qemu_2.2+dfsg-5expubuntu9.6~cloud0.dsc
wget https://launchpad.net/~ubuntu-cloud-archive/+archive/ubuntu/kilo-staging/+files/qemu_2.2+dfsg.orig.tar.xz
dpkg-source -x qemu_2.2+dfsg-5expubuntu9.6~cloud0.dsc

Patch package

1, quilt configuration
   a, sudo apt-get install quilt devscripts dh-make
   b, Export to bash env
      export QUILT_PATCHES=debian/patches
      export QUILT_NO_DIFF_INDEX=1
      export QUILT_NO_DIFF_TIMESTAMPS=1
      export QUILT_REFRESH_ARGS="-p ab"
      export QUILT_PATCHES=debian/patches
      export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"

#git format-patch -1 2150d5d8e17323bc9fce11903da3afffda211d26
quilt import /bak/openstack/nova/0001-pci-eliminate-DB-lookup-PCI-requests-during-claim.patch

   c, Creating a new patch.
      quilt new test.diff
      quilt add neutron/agent/linux/ovs_lib.py
      quilt refresh
      quilt rename -P test.diff test2.diff
      cat debian/patches/test.diff
      quilt pop -a

   d, For the exsiting patch,
      Put the patch into ‘./debian/patches‘ directory
      Pppend it into ‘./debian/patch/series‘ file
      Use ‘quilt push -a‘ command to push all existing patches onto the source tree.
      quilt refresh

3, changelog
   dch -i #can be changed later by dch -e
   cat debian/changelog
   cat debian/copyright
   cat debian/rules
   cat debian/control

   ppa name format:  <customername>[-<openstack-version>|-<ubuntu-release>]
   changelog format: <upstream-version>hf<lp-bug-number>v<date>.<buildnum>
   dch -b -Dprecise-updates -v1:2014.1.5-0ubuntu1.2hf123456v20150902.0
   nova (1:2014.1.5-0ubuntu1.2hf123456v20150902.0) precise-update; urgency=low
       * [HOTFIX] Fixes some catastrophic failure (LP: #123456)
         - blah blah blah
         - d/p/my-awesome-backport.patch

4, Edit ppa‘s dependancy in ‘Edit PPA dependencies‘ field.
   Eg:
   for Juno,    ~ubuntu-cloud-archive/ubuntu/juno-staging
   for grizzly, ~ubuntu-cloud-archive/grizzly-staging


5, Resolv the dependancy
   dpkg-checkbuilddeps
   
   add grizzly dependancy repository
   #sudo add-apt-repository ppa:ubuntu-cloud-archive/grizzly-staging
   deb http://ppa.launchpad.net/ubuntu-cloud-archive/grizzly-staging/ubuntu precise main
   deb-src http://ppa.launchpad.net/ubuntu-cloud-archive/grizzly-staging/ubuntu precise main
   sudo apt-get build-dep  quantum    # will read debian/control to resolv dependancy.
   sudo apt-get build-dep --no-install-recommends quantum

6, Build
   find . -name "*.pyc" -exec rm -rf {} \;
 
   #build signed source package
   debuild -S -k<your key here>

   #build signed binary package
   debuild -b -k<your key here>

   #build unsigned source package
   debuild -i -us -uc -S

   #build unsigned binary package which can be tested by the command ‘dpkg -i <pac>.deb‘
   debuild -i -us -uc -b

   debuild -S -sa --changes-option=-DDistribution=precise -k<GPGKEY>


   #for openstack sru, 有时候这步不成功,需要先将patch用quilt格式化一下再用(quilt import, quilt push -a, quilt refresh)

   gbp buildpackage -S -k$GPGKEY
   #gbp buildpackage -S -us -uc


2, debiandiff, 这步需要将老新build两次再用debdiff命令产生
   a, Use the existing debdiff, patch -p1 < ../trusty.debdiff
   b, Create new debdiff, http://packaging.ubuntu.com/html/traditional-packaging.html#creating-a-debdiff
      debuild -S                                              #build old source to generate dsc file
      debdiff old.dsc new.dsc                           #generate debdiff by comparing two sources


7, Upload to PPA
   export DEBEMAIL=<email>
   export DEBFULLNAME=<name, e.g. "Zhang">
   #Test PPA can be created in https://launchpad.net/~zhhuabj/+activate-ppa
   dput -f ppa:zhhuabj/trusty-sru-testing test.changes
  
   #openstack sru

git push --all lp:~<launchpad-id>/ubuntu/+source/nova
git push --tags lp:~<launchpad-id>/ubuntu/+source/nova

如果用git的话,需要先在~/.git_config中添加:

[url "git+ssh://zhhuabj@git.launchpad.net/"]
        insteadof = lp:

然后执行:git push lp:~zhhuabj/ubuntu/+source/nova

最后访问: https://code.launchpad.net/~zhhuabj/ubuntu/+source/nova/+git/nova


附录一,sbuild

#sbuild, https://wiki.ubuntu.com/SimpleSbuild
#sudo add-apt-repository cloud-archive:liberty
cat /etc/apt/sources.list.d/ubuntu-cloud-archive-liberty-staging-trusty.list

deb http://ubuntu-cloud.archive.canonical.com/ubuntu liberty-updates/ubuntu main
# deb http://ppa.launchpad.net/ubuntu-cloud-archive/liberty-staging/ubuntu trusty main
# deb-src http://ppa.launchpad.net/ubuntu-cloud-archive/liberty-staging/ubuntu trusty main

schroot -l
schroot -c source:trusty-amd64 -u root         #这句会告成电脑没有声音,可以使用sudo killall pulseaudio解决
schroot -c trusty-amd64 -u root  #do work
apt-get build-dep libvirt-bin
sbuild -d trusty-amd64

附录二, pbuilder
#pbuilder https://wiki.ubuntu.com/PbuilderHowto   http://www.cr173.com/html/28930_1.html
sudo apt-get install pbuilder debootstrap devscripts apt-cacher-ng
echo ‘Acquire::http::Proxy "http://127.0.0.1:3142";‘ | sudo tee /etc/apt/apt.conf.d/01acng
$ sudo cat /etc/pbuilderrc 
MIRRORSITE=http://us.archive.ubuntu.com/ubuntu/
export http_proxy=http://127.0.0.1:3142/
export http_proxys=http://127.0.0.1:3142/

DEBFULLNAME=‘xxx‘
DEBEMAIL=‘xxx@xxx.com‘

DISTRIBUTION=‘trusty‘
OTHERMIRROR="deb http://us.archive.ubuntu.com/ubuntu/ ${DISTRIBUTION} universe"
OTHERMIRROR+="|deb http://us.archive.ubuntu.com/ubuntu/ ${DISTRIBUTION}-updates main universe"
OTHERMIRROR+="|deb http://us.archive.ubuntu.com/ubuntu/ ${DISTRIBUTION}-proposed main"
EXTRAPACKAGES=‘‘
EXTRAPACKAGES+=‘ vim sudo openssh-server bash-completion wget rsync git build-essential gdb crash apt-transport-https ca-certificates ubuntu-cloud-keyring‘

# Cloud Archive
#OS_RELEASE=‘liberty‘
#OTHERMIRROR+="|deb http://ubuntu-cloud.archive.canonical.com/ubuntu $DISTRIBUTION-updates/$OS_RELEASE main"

if [ -n "$OS_RELEASE" ]; then
    BASETGZ="/var/cache/pbuilder/$DISTRIBUTION-$OS_RELEASE-base.tgz"
else
    BASETGZ="/var/cache/pbuilder/$DISTRIBUTION-base.tgz"
fi


#sudo pbuilder --create --distribution trusty --architecture amd64 --basetgz /images/pbuilder/trusty-amd64-base.tgz --debootstrapopts --variant=buildd
sudo pbuilder --create --distribution trusty --architecture amd64 --debootstrapopts --variant=buildd

sudo cp /var/cache/pbuilder/trusty-base.tgz /var/cache/pbuilder/trusty-liberty-base.tgz

then uncomment OS_RELEASE, run ‘sudo pbuilder update‘ again

sudo pbuilder login --save-after-login  #equal to chroot
root# Add UCA repository  to source.list,

        # ‘deb http://ubuntu-cloud.archive.canonical.com/ubuntu liberty-updates/ubuntu main‘ && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8A6844A29F68104E

        or apt-get install software-properties-common python-software-properties  &&  add-apt-repository cloud-archive:liberty
root# apt update
then exit chroot, press ctrl-d to save 
sudo pbuilder update   #run again when building the package every time

wget https://launchpad.net/debian/+archive/primary/+files/libvirt_1.2.14-3.dsc
wget https://launchpad.net/debian/+archive/primary/+files/libvirt_1.2.14.orig.tar.gz
wget https://launchpad.net/debian/+archive/primary/+files/libvirt_1.2.14-3.debian.tar.xz

#注意:上面的是debian包,需要先使用beyond compare工具和ubuntu的1.2.16对debian目录进行比较转化成ubuntu包,转换规则是:

1, 凡1.2.14有的,1.2.16没有的,删

2, 凡1.2.14没有的,1.2.16有的,增

3, 凡1.2.14与1.2.16不一致的以1.2.16为准

4, debian/patch和debian/changlog可以不作处理

5, debian/control也是重点

#sudo pbuilder --build --distribution trusty --architecture amd64 ./libvirt_1.2.14-3.dsc

dpkg-source -x libvirt_1.2.14-3.dsc && cd libvirt-1.2.14 && sudo pdebuild

sudo debsign /var/cache/pbuilder/result/<package>_<version>.changes
sudo dput ppa:techtonik/backports /var/cache/pbuilder/result/<package>_<version>.changes


sudo apt-get autoclean
sudo apt-get update
sudo apt-get -f install

sudo apt update

cat /etc/apt/source.list

deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu xenial-security main restricted universe multiverse

#deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main

## ubuntu ddebs

# deb http://ddebs.ubuntu.com/ xenial main restricted universe multiverse
# deb http://ddebs.ubuntu.com/ xenial-updates main restricted universe multiverse
# deb http://ddebs.ubuntu.com/ xenial-proposed main restricted universe multiverse
# deb http://ddebs.ubuntu.com/ xenial-security main restricted universe multiverse
## kernel ppa
# deb http://ppa.launchpad.net/canonical-kernel-team/ppa/ubuntu xenial main
# deb-src http://ppa.launchpad.net/canonical-kernel-team/ppa/ubuntu xenial main

Reference

1, https://help.launchpad.net/Packaging/UploadErrors  
2, https://wiki.canonical.com/STS/Engineering/Hotfix
3, http://packaging.ubuntu.com/html/fixing-a-bug.html#work-on-a-fix
4, http://packaging.ubuntu.com/html/traditional-packaging.html#creating-a-debdiff
5, http://blog.packagecloud.io/debian/debuild/packaging/2015/06/08/buildling-deb-packages-with-debuild/

6, https://wiki.ubuntu.com/OpenStack/StableReleaseUpdates
7, https://wiki.ubuntu.com/OpenStack/CorePackages
8, https://wiki.ubuntu.com/ServerTeam/OpenStack/SRUCadence

9, https://wiki.ubuntu.com/SimpleSbuild

Debian Customer PPA RFC (by quqi99)

标签:timestamp   www   ons   添加   compute   export   sts   rom   ebs   

原文地址:http://blog.csdn.net/quqi99/article/details/50511173

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!