Git 将上游的'zip'文件用'gbp'和'pristine tar'进行Debianize`
说明如下: 首先,创建一个空存储库:Git 将上游的'zip'文件用'gbp'和'pristine tar'进行Debianize`,git,debian,packaging,debhelper,Git,Debian,Packaging,Debhelper,说明如下: 首先,创建一个空存储库: mkdir package-0.1 cd package-0.1 git init 然后,导入上游源,分支出上游分支并添加Debian文件(例如,通过dh_make): 就这样,你完了 但是如果使用zip,则会失败,因为没有.orig.tar.gz。调用dh_make--createorig将创建一个.orig.tar.gz,但这将包括.git/子目录,因此它是无效的 另外,pristine tar分支以这种方式丢失,并且pristine tar comm
mkdir package-0.1
cd package-0.1
git init
然后,导入上游源,分支出上游分支并添加Debian文件(例如,通过dh_make):
就这样,你完了
但是如果使用zip
,则会失败,因为没有.orig.tar.gz
。调用dh_make--createorig
将创建一个.orig.tar.gz
,但这将包括.git/
子目录,因此它是无效的
另外,pristine tar
分支以这种方式丢失,并且pristine tar commit
不知道如何处理zip
文件
如果上游仅提供zip
-文件,如何启动Debian包?在这种情况下,如何处理原始焦油?(这里仍然有点未经测试)
为了读者的利益,这是我提出的。我不确定这是否是BCP,但它是有效的。在Linux上,可能还有CygWin
我目前使用gbp
从头开始创建Debian存储库的工作流程是:
上游进口
上游通常是.orig.tar.gz
,但下面的代码也适用于ZIP
。有关所有支持的归档类型,请参阅man gbp导入源文件
设置一些变量
使用这些变量,您可以将复制和粘贴与配方的以下行一起使用
PACKAGENAME=mypackagename
UPSTREAMVERSION=0.1.2.3-up4
UPSTREAMARCHIVE=../upstreampackage-$UPSTREAMVERSION.zip
# Following should start/end with a number and only contain
# numbers, lowercase letters and single dots (.)
MYDIST=stable
MYBASEVERSION=0example.com1
TEMPLATEGIT=https://github.com/hilbig/templates.git
TEMPLATEBRANCH=gbp
创建git回购协议
初始化回购协议
git commit --allow-empty -m empty
git branch upstream
git fetch $TEMPLATEGIT $TEMPLATEBRANCH
git merge FETCH_HEAD
上游第一次进口
创建debian/
在debian/
现在根据需要更改debian/
中的所有文件,并删除不需要的文件(提示:rm-f*.ex
)。抱歉,我找不到适当的方法自动执行此操作。不要更改debian/
之外的文件,因为这些文件稍后将使用coult/patchqueue(又名debian/patchs/
)进行处理。确保编辑debian/changelog:
gbp dch --commit -D $MYDIST
- 将
(第一行)更改为unstable
的值。(如果你不这样做也不会受伤。)$MYDIST
- 将文本
更改为更好的格式,如*初始发行版(关闭:#nnnn)
将上游XXX借记到软件包YYY
- 如果最后一行是错误的,您可能忘记了设置通常的
设置(保存在git config
中)。现在就做: git config--global user.name“Your name” git config--全局user.emailyou@example.com~/.gitconfig
debian/
中设置了所有内容,则提交:
git add -A debian
# Use "git status" to see, that only file in "debian/" are changed
git commit -m 'edited directory debian/'
设置gbp dch
下面是垃圾。我仍然试图弄清楚如何正确地完成这项工作,因为所需的标记并没有像我认为的那样自动创建
如果要使用gbp dch--auto
(建议使用),则需要正确设置git标记。由于您可以在debian/gbp.conf
中更改这些标记的格式,因此建议使用gbp dch创建第一个标记——因为(如果您愿意,您可以手动创建它,但我们希望自动化,对不对?)
gbp dch --commit -D "$MYRELEASE" -N "`git describe --tags --abbrev=0 upstream | sort | head -1 | sed s/^[^0-9]*//`-$MYBASEVERSION" --since HEAD^
vim debian/changelog
git commit --amend debian/changelog
将其推送到git服务器
当推送到您的git
服务器时,请确保始终包含以下标记:
git push origin --tags
这些(未注释的)标记用于各种引用/跟踪目的
解释
git fetch
使用git
repo$TEMPLATEGIT
中的分支fetch\u HEAD
填充。
这将创建debian/gbp.conf
,并启用您最喜欢的设置,包括原始tar
echo$PACKAGENAME | fakeroot gbp…
做两件事:
gbp
将询问包裹名称。不幸的是,没有命令行选项。因此,它被echo
嵌入其中,以便能够像批处理一样运行它
fakeroot
修复了一个小故障,其中选项pristine tar
(如果在gbp.conf
中设置,命令行中可能会缺少该选项)将与用户创建一个.tar
文件,而不是root:root
dh_make
需要-a
来填充debian/
目录,因为已经有一个目录只包含gbp.conf
- 如果第一次调用
gbp
时没有debian/gbp.conf
,则需要将选项pristine tar
添加到gbp import orig
。
如果没有它,它看起来可以工作,但是就没有可用的.orig.tar.gz
(也可以命名为.bz2
或.xz
)。
gbp
是识别.zip
-文件的唯一工具,因此如果忘记了这一点,您将遇到一些麻烦。
不幸的是,gbp
(或者--git pristine tar
或者--pristine tar
)的版本之间,选项的名称不同,因此最好将其放在gbp.conf
中
注:
- 将来将有
gbp init
来改进这些步骤,但是我当前的gbp
变体还没有包括这一点
- 文件
debian/gbp.conf
如下所示。在上面,它应该通过回购$TEMPLATEGIT
的分支$TEMPLATEBRANCH
的git merge FETCH\u HEAD
进行合并。
也许您可以为此创建自己的git
模板存储库,另请参见https://github.com/hilbix/templates/tree/gbp
:
debian/gbp.conf
:
[DEFAULT]
pristine-tar = True
debian-branch = master
debian-tag = v%(version)s
[dch]
full = True
git-author = True
[pq]
patch-num-format = PATCH-%04d-
[import-orig]
merge-mode = replace
遵循通常的工作流程
之后,您可以遵循通常的gbp
工作流,这样就可以使用web上关于如何更改Debian软件包的所有其他典型方法
以下是我是如何做到这一点的
构建包
简单的软件包很容易。然而,有些软件包需要的不仅仅是这些,比如编译64位
gbp dch --commit -D "$MYRELEASE" -N "`git describe --tags --abbrev=0 upstream | sort | head -1 | sed s/^[^0-9]*//`-$MYBASEVERSION" --since HEAD^
vim debian/changelog
git commit --amend debian/changelog
git push origin --tags
[DEFAULT]
pristine-tar = True
debian-branch = master
debian-tag = v%(version)s
[dch]
full = True
git-author = True
[pq]
patch-num-format = PATCH-%04d-
[import-orig]
merge-mode = replace
gbp buildpackage --dist="$MYDIST" --git-builder=sbuild --arch=amd64 --arch-all --source --force-orig-source
gbp buildpackage --dist="$MYDIST" --git-builder=sbuild --arch=i386
gbp pq import
# now edit everything here
# if you are happy with it:
gbp pq export
git rebase -i COMMIT
gbp dch --commit -D $MYDIST
echo $PACKAGENAME | fakeroot gbp import-orig --upstream-version=$UPSTREAMVERSION $UPSTREAMARCHIVE
gbp dch --commit -D "$MYDIST" -N "`git describe --tags --abbrev=0 upstream | sort | head -1 | sed s/^[^0-9]*//)-$MYBASEVERSION"