作者:张华  发表于: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)

sudo apt install build-essential devscripts quilt dh-autoreconf fakeroot dpkg-dev python-sphinx

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

8, sru进度查看

UA,    https://people.canonical.com/~ubuntu-archive/pending-sru.html

UCA, reqorts.qa.ubuntu.com/reports/ubuntu-server/cloud-archive/kilo_versions.html

附录一。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)的更多相关文章

  1. freeCAD下载与安装

    官方安装: freeCAD稳定版 freeCAD官方提供了几个稳定版本供开发者使用: Windows (XP, Vista and 7, 32 and 64bits), Mac OS X (Lion ...

  2. How to Install JAVA 8 (JDK/JRE 8u111) on Debian 8 & 7 via PPA

    Oracle JAVA 8 Stable release has been released on Mar,18 2014 and available to download and install. ...

  3. Debian 中添加ppa

    在Debian8中默认没有"apt-add-repository"命令,所有也就没法安装ppa. 怎么破? sudo apt-get install software-proper ...

  4. debian/deepin 15.3安装jdk 1.7 (或jdk 7),配置默认环境

    一.前言 Deepin 15.3是基于Debian开发的,安装jdk 1.7有所不同,默认是openjdk-8-jdk,而我们玩一些编译需要的是jdk 7. 所以本文给出安装JDK 7的教程. 二.安 ...

  5. Install Debian note

    environment: already install xp,win7 and win8PE, left 87G space to install Debian, this space not fo ...

  6. Debian 8下vsftpd安装与配置

    Debian 8下vsftpd安装与配置 0.环境 root@remote:/# uname -r 3.16.0-4-amd64 root@remote:/e# lsb_release No LSB ...

  7. ZFS(一):ZFS在Debian GNU/Linux上的安装

    以下内容翻译自https://pthree.org/2012/04/17/install-zfs-on-debian-gnulinux/,并附有原文,由于是第一次翻译,如有任何翻译不恰当之处,欢迎指出 ...

  8. Debian系统常用配置

    每一次安装Linux之后总需要设置一下系统,下面把常用的设置总结一下,方便以后使用: 1.系统安装包选择 每一次找Linux的安装包时,总会纠结一下选哪个好,我在这里总结一下:安装Debian选择对应 ...

  9. (转) IPv6相关RFC

    转自http://blog.csdn.net/lucien_cc/article/details/12688477 IPv6 Spec RFC 2460 : Internet Protocol, Ve ...

随机推荐

  1. R语言采坑系列——Warning message: In validDetails.polygon(x) : 强制改变过程中产生了NA

    用ggplot2的geom_density_2d时,总是不能填充图案,并报错: Warning message: In validDetails.polygon(x) : 强制改变过程中产生了NA 解 ...

  2. match_parent, wrap_content, 和 fill_parent 区别联系

    fill_parent   -1  The view should be as big as its parent (minus padding). This constant is deprecat ...

  3. mybatis学习(九)——动态sql

    MyBatis 的强大特性之一便是它的动态 SQL.可以根据不同条件拼接 SQL 语句. 动态 SQL 元素和使用 JSTL 或其他类似基于 XML 的文本处理器相似.主要由以下几种元素. if wh ...

  4. setsockopt等高级使用

    参考: setsockopt函数使用http://hi.baidu.com/yelangdefendou/item/74161d0f384abd3c4ac4a316http://blog.csdn.n ...

  5. jenkins使用xvfb插件构建虚拟化显示屏自动化测试

    1.linux服务器安装xvfb,并启动 参考我的博客:http://www.cnblogs.com/lincj/p/5468505.html 或者网上搜索一下进行安装 2.jenkins安装xvfb ...

  6. [暑假集训--数位dp]hdu3555 Bomb

    The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the ti ...

  7. bootstrap 事件shown.bs.modal用于监听并执行你自己的代码【写hostmanger关联部门遇到的问题及解决方法】

    背景:记录写hostmanger中用户下拉框关联部门遇到的问题及解决方法 问题:需求是展示页面展示用户所属的部门,点击修改按钮后,弹出对应的model,这个时候部门的select要默认选中用户所在的s ...

  8. poj 1912 A highway and the seven dwarfs

    A highway and the seven dwarfs Time Limit: 8000MS   Memory Limit: 30000K Total Submissions: 2622   A ...

  9. SPOJ CIRU The area of the union of circles

    You are given N circles and expected to calculate the area of the union of the circles ! Input The f ...

  10. 05深入理解C指针之---指针声明和解引

    该系列文章源于<深入理解C指针>的阅读与理解,由于本人的见识和知识的欠缺可能有误,还望大家批评指教. 一.指针声明: 1.声明普通变量:“数据类型 + 空格 +  变量名 + :”实现普通 ...