Make:从工作目录名称中提取数字(Debian 打包规则)
我需要一些帮助来解决以下问题:
我有一个每天使用 Launchpad 的食谱功能构建的 debian 软件包。版本名称(以及源目录的名称)是自动生成的,并包括当前的修订号。我想修改 debian/rules 文件以提取修订号并将其传递给 CMake。
到目前为止它不起作用 - 似乎一个空字符串被传递给 CMake。我不知道问题是出在我的 make 代码中还是其他地方。
规则文件:
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
%:
dh $@ --parallel --list-missing
# Try to detect the Bazaar revision number from the directory name
ifneq ($(findstring bzr,$(PWD)),)
COMPONENTS := $(PWD)
COMPONENTSL := $(subst -,' ',COMPONENTS)
COMPONENTSLL := $(subst ~,' ',COMPONENTSL)
BZRVER := $(filter bzr%,COMPONENTSLL)
BZRVERN := $(subst bzr,,$(BZRVER))
override_dh_auto_configure:
dh_auto_configure -- -DRELEASE_BUILD=0 -DBZR_REVISION=$(BZRVERN)
endif
构建日志的相关部分:
make[1]: Entering directory `/build/buildd/stellarium-0.11.2~bzr5066'
dh_auto_configure -- -DRELEASE_BUILD=0 -DBZR_REVISION=
mkdir -p obj-i686-linux-gnu
cd obj-i686-linux-gnu
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DRELEASE_BUILD=0 -DBZR_REVISION=
有什么想法吗?
I'd like some help with the following problem:
I have a debian package built daily with Launchpad's Recipes feature. The version name (and the name of the source directory) is automatically generated and includes current revision number. I want to modify the debian/rules file to extract the revision number and pass it to CMake.
So far it doesn't work - it seems that an empty string is passed to CMake. I don't know if the problem is in my make code or in something else.
The rules file:
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
%:
dh $@ --parallel --list-missing
# Try to detect the Bazaar revision number from the directory name
ifneq ($(findstring bzr,$(PWD)),)
COMPONENTS := $(PWD)
COMPONENTSL := $(subst -,' ',COMPONENTS)
COMPONENTSLL := $(subst ~,' ',COMPONENTSL)
BZRVER := $(filter bzr%,COMPONENTSLL)
BZRVERN := $(subst bzr,,$(BZRVER))
override_dh_auto_configure:
dh_auto_configure -- -DRELEASE_BUILD=0 -DBZR_REVISION=$(BZRVERN)
endif
Relevant section of the build log:
make[1]: Entering directory `/build/buildd/stellarium-0.11.2~bzr5066'
dh_auto_configure -- -DRELEASE_BUILD=0 -DBZR_REVISION=
mkdir -p obj-i686-linux-gnu
cd obj-i686-linux-gnu
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DRELEASE_BUILD=0 -DBZR_REVISION=
The full log is here:
https://launchpadlibrarian.net/86783083/buildlog_ubuntu-natty-i386.stellarium_0.11.2~bzr5066-0ubuntu0~natty1_BUILDING.txt.gz
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您至少在这些行中犯了一个错误:
您必须对
COMPONENTSXX
变量的实际值进行更改,因此它们的名称应该包含在$(...).
如果您唯一需要的是修订号(示例中为 5066),则可以按如下方式提取:
You've made a mistake at least in these lines:
You have to perform changes on the actual values of
COMPONENTSXX
variables, thus their names should be enclosed into$(...)
.If the only thing you need is the revision number (5066 in your example), it could be extracted as follows: