Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 将上游的'zip'文件用'gbp'和'pristine tar'进行Debianize`_Git_Debian_Packaging_Debhelper - Fatal编程技术网

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
    设置(保存在
    ~/.gitconfig
    中)。现在就做: git config--global user.name“Your name” git config--全局user.emailyou@example.com
如果在
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"