IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    [原]Debian Customer PPA RFC (by quqi99)

    quqi99发表于 2016-01-13 15:43:38
    love 0

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

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

    Precondition

    a, sudo apt-get install gnupg pbuilder ubuntu-dev-tools bzr-builddeb apt-file

    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      

    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"
       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

    2, debiandiff
       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 source to generate dsc file
          debdiff <package>_1.0-1.dsc <package>_1.0-1ubuntu1.dsc  #generate debdiff by comparing two sources

    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>

    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

    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/



沪ICP备19023445号-2号
友情链接