为deb包添加文件补丁,维护deb包:
有了补丁能使用基础包上,作相应的修改,每一次修改以补丁的形式保存,在包的编译时先将所有的debian/patches/*应用上。
1、打补丁将debian/patches/*所有文件 patch -stuN -p1 < $$patch
2、删除补丁时,得将补丁文件反序应用 patch -suRf -p1 < $$patch
自己使用/debian/rules文件记录:
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
PKGNAME=$(shell grep "^Package: " debian/control | head -1 | cut -f 2 -d/ )
PKG=$(shell pwd)/debian/$(PKGNAME)
LOCALEDIR=$(PKG)/usr/share/locale-langpack
build: patch
dh_testdir
clean: unpatch
dh_testdir
dh_testroot
dh_clean
binary-arch:
binary-indep:
dh_testdir
dh_testroot
mkdir -p $(LOCALEDIR)
cd data; /
find -type d -exec mkdir -p "$(LOCALEDIR)/{}" /; ; /
find -type f -name "*.po" -exec sh -c "N='{}'; msgfmt -o $(LOCALEDIR)//$${N%.po}.mo /$$N" /;
[ ! -e data/extra.tar ] || tar -C $(PKG) -xf data/extra.tar
[ ! -e data/mozilla.tar.gz ] || tar -C $(PKG) -xzf data/mozilla.tar.gz
dh_installdocs -i
dh_installchangelogs -i
dh_compress -i
dh_fixperms -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i -- -Z bzip2
binary: binary-arch binary-indep
# Apply patches to the deian package
patch: patch-stamp
patch-stamp:
dh_testdir
@patches=debian/patches/*.patch; for patch in $$patches; do/
test -f $$patch || continue; /
echo "Applying $$patch"; /
patch -stuN -p1 < $$patch || exit 1; /
done
touch $@
#Remove patches from the debian package
unpatch: unpatch-stamp
unpatch-stamp:
dh_testdir
@if test -f patch-stamp; then /
patches=debian/patches/*.patch; /
for patch in $$patches; do /
repatches="$$patch $$repatches"; /
done; /
for patch in $$repatches; do /
test -f $$patch || continue; /
echo "Reversing $$patch"; /
patch -suRf -p1 < $$patch || exit 1; /
done; /
rm -f patch-stamp;/
fi
.PHONY: build clean binary-indep binary-arch binary