在 Linux 系統上面的軟體開發,偶而會遇到需要直接從 git repository 取出尚未正式釋出的版本,以下分享一下我在參加 DebConf15 後,學會的使用流程。
以下以 http://www.freedesktop.org/wiki/Software/libmbim/ 為例子。
首先要找到 git repository 的位置,然後使用 git 指令 clone 到本地端。
$ git clone git://anongit.freedesktop.org/libmbim/libmbim
然後在該目錄底下,找出最後 commit 的日期。
$ git log -1 --format=%cd --date=short . | sed 's/-//g' 20150910
找出目前的版本號碼,libmbim 的版本號碼在寫作這篇文章時寫在 configure.ac 裡面。
dnl Process this file with autoconf to produce a configure script. AC_PREREQ([2.68]) dnl The libmbim version number m4_define([mbim_major_version], [1]) m4_define([mbim_minor_version], [13]) m4_define([mbim_micro_version], [0]) m4_define([mbim_version], [mbim_major_version.mbim_minor_version.mbim_micro_version])
版本號碼也就是 1.13.0 這樣。
然後檢查一下有沒有 .gitignore,如果有的話要先另建一個文字檔 .gitattributes 放入下面的內容。
.gitattributes export-ignore .gitignore export-ignore
然後就可以使用 git 跟 xz 指令來產生 tarball 檔案。
$ git archive --worktree-attributes --format=tar --prefix=libmbim-1.13.0+20150910/ HEAD | xz > ../libmbim-1.13.0+20150910.tar.xz
如果本來就沒有 .gitignore 的話,就可以不需要使用參數 --worktree-attributes,這樣產生出來的 tarball 檔案就不會包含 .gitignore 在裡面,在使用 Debian 上的一些 git based 的管理工具,會因為 .gitignore 的存在而產生問題。
最後檢查一下 libmbim-1.13.0+20150910.tar.xz 的內容,看看是否沒有那些不應該存在的 .git 開頭的檔案在裡面。
$ tar tf libmbim-1.13.0+20150910.tar.xz libmbim-1.13.0+20150910/ libmbim-1.13.0+20150910/AUTHORS libmbim-1.13.0+20150910/COPYING libmbim-1.13.0+20150910/COPYING.LIB libmbim-1.13.0+20150910/Makefile.am libmbim-1.13.0+20150910/NEWS libmbim-1.13.0+20150910/README libmbim-1.13.0+20150910/autogen.sh libmbim-1.13.0+20150910/build-aux/ libmbim-1.13.0+20150910/build-aux/Makefile.am libmbim-1.13.0+20150910/build-aux/mbim-codegen/ libmbim-1.13.0+20150910/build-aux/mbim-codegen/Makefile.am libmbim-1.13.0+20150910/build-aux/mbim-codegen/Message.py libmbim-1.13.0+20150910/build-aux/mbim-codegen/ObjectList.py libmbim-1.13.0+20150910/build-aux/mbim-codegen/Struct.py libmbim-1.13.0+20150910/build-aux/mbim-codegen/mbim-codegen libmbim-1.13.0+20150910/build-aux/mbim-codegen/utils.py libmbim-1.13.0+20150910/build-aux/templates/ libmbim-1.13.0+20150910/build-aux/templates/Makefile.am libmbim-1.13.0+20150910/build-aux/templates/mbim-enum-types-template.c libmbim-1.13.0+20150910/build-aux/templates/mbim-enum-types-template.h libmbim-1.13.0+20150910/build-aux/templates/mbim-error-quarks-template.c libmbim-1.13.0+20150910/build-aux/templates/mbim-error-types-template.c libmbim-1.13.0+20150910/build-aux/templates/mbim-error-types-template.h libmbim-1.13.0+20150910/configure.ac libmbim-1.13.0+20150910/data/ libmbim-1.13.0+20150910/data/Makefile.am libmbim-1.13.0+20150910/data/mbim-service-auth.json libmbim-1.13.0+20150910/data/mbim-service-basic-connect.json libmbim-1.13.0+20150910/data/mbim-service-dss.json libmbim-1.13.0+20150910/data/mbim-service-ms-firmware-id.json libmbim-1.13.0+20150910/data/mbim-service-ms-host-shutdown.json libmbim-1.13.0+20150910/data/mbim-service-phonebook.json libmbim-1.13.0+20150910/data/mbim-service-proxy-control.json libmbim-1.13.0+20150910/data/mbim-service-sms.json libmbim-1.13.0+20150910/data/mbim-service-stk.json libmbim-1.13.0+20150910/data/mbim-service-ussd.json libmbim-1.13.0+20150910/data/pkg-config/ libmbim-1.13.0+20150910/data/pkg-config/Makefile.am libmbim-1.13.0+20150910/data/pkg-config/mbim-glib.pc.in libmbim-1.13.0+20150910/docs/ libmbim-1.13.0+20150910/docs/Makefile.am libmbim-1.13.0+20150910/docs/libmbim-icon.svg libmbim-1.13.0+20150910/docs/libmbim-logo.png libmbim-1.13.0+20150910/docs/libmbim-logo.svg libmbim-1.13.0+20150910/docs/man/ libmbim-1.13.0+20150910/docs/man/Makefile.am libmbim-1.13.0+20150910/docs/reference/ libmbim-1.13.0+20150910/docs/reference/Makefile.am libmbim-1.13.0+20150910/docs/reference/libmbim-glib/ libmbim-1.13.0+20150910/docs/reference/libmbim-glib/Makefile.am libmbim-1.13.0+20150910/docs/reference/libmbim-glib/libmbim-glib-common.sections libmbim-1.13.0+20150910/docs/reference/libmbim-glib/libmbim-glib-docs.xml libmbim-1.13.0+20150910/docs/reference/libmbim-glib/version.xml.in libmbim-1.13.0+20150910/gtester.make libmbim-1.13.0+20150910/m4/ libmbim-1.13.0+20150910/m4/compiler-warnings.m4 libmbim-1.13.0+20150910/src/ libmbim-1.13.0+20150910/src/Makefile.am libmbim-1.13.0+20150910/src/libmbim-glib/ libmbim-1.13.0+20150910/src/libmbim-glib/Makefile.am libmbim-1.13.0+20150910/src/libmbim-glib/generated/ libmbim-1.13.0+20150910/src/libmbim-glib/generated/Makefile.am libmbim-1.13.0+20150910/src/libmbim-glib/libmbim-glib.h libmbim-1.13.0+20150910/src/libmbim-glib/mbim-cid.c libmbim-1.13.0+20150910/src/libmbim-glib/mbim-cid.h libmbim-1.13.0+20150910/src/libmbim-glib/mbim-compat.c libmbim-1.13.0+20150910/src/libmbim-glib/mbim-compat.h libmbim-1.13.0+20150910/src/libmbim-glib/mbim-device.c libmbim-1.13.0+20150910/src/libmbim-glib/mbim-device.h libmbim-1.13.0+20150910/src/libmbim-glib/mbim-enums.h libmbim-1.13.0+20150910/src/libmbim-glib/mbim-errors.h libmbim-1.13.0+20150910/src/libmbim-glib/mbim-message-private.h libmbim-1.13.0+20150910/src/libmbim-glib/mbim-message.c libmbim-1.13.0+20150910/src/libmbim-glib/mbim-message.h libmbim-1.13.0+20150910/src/libmbim-glib/mbim-proxy-helpers.c libmbim-1.13.0+20150910/src/libmbim-glib/mbim-proxy-helpers.h libmbim-1.13.0+20150910/src/libmbim-glib/mbim-proxy.c libmbim-1.13.0+20150910/src/libmbim-glib/mbim-proxy.h libmbim-1.13.0+20150910/src/libmbim-glib/mbim-utils.c libmbim-1.13.0+20150910/src/libmbim-glib/mbim-utils.h libmbim-1.13.0+20150910/src/libmbim-glib/mbim-uuid.c libmbim-1.13.0+20150910/src/libmbim-glib/mbim-uuid.h libmbim-1.13.0+20150910/src/libmbim-glib/mbim-version.h.in libmbim-1.13.0+20150910/src/libmbim-glib/test/ libmbim-1.13.0+20150910/src/libmbim-glib/test/Makefile.am libmbim-1.13.0+20150910/src/libmbim-glib/test/test-cid.c libmbim-1.13.0+20150910/src/libmbim-glib/test/test-fragment.c libmbim-1.13.0+20150910/src/libmbim-glib/test/test-message-builder.c libmbim-1.13.0+20150910/src/libmbim-glib/test/test-message-parser.c libmbim-1.13.0+20150910/src/libmbim-glib/test/test-message.c libmbim-1.13.0+20150910/src/libmbim-glib/test/test-proxy-helpers.c libmbim-1.13.0+20150910/src/libmbim-glib/test/test-uuid.c libmbim-1.13.0+20150910/src/mbim-proxy/ libmbim-1.13.0+20150910/src/mbim-proxy/76-mbim-proxy-device-ownership.rules.in libmbim-1.13.0+20150910/src/mbim-proxy/Makefile.am libmbim-1.13.0+20150910/src/mbim-proxy/mbim-proxy.c libmbim-1.13.0+20150910/src/mbimcli/ libmbim-1.13.0+20150910/src/mbimcli/Makefile.am libmbim-1.13.0+20150910/src/mbimcli/mbimcli-basic-connect.c libmbim-1.13.0+20150910/src/mbimcli/mbimcli-completion libmbim-1.13.0+20150910/src/mbimcli/mbimcli-dss.c libmbim-1.13.0+20150910/src/mbimcli/mbimcli-helpers.c libmbim-1.13.0+20150910/src/mbimcli/mbimcli-helpers.h libmbim-1.13.0+20150910/src/mbimcli/mbimcli-ms-firmware-id.c libmbim-1.13.0+20150910/src/mbimcli/mbimcli-ms-host-shutdown.c libmbim-1.13.0+20150910/src/mbimcli/mbimcli-phonebook.c libmbim-1.13.0+20150910/src/mbimcli/mbimcli.c libmbim-1.13.0+20150910/src/mbimcli/mbimcli.h libmbim-1.13.0+20150910/utils/ libmbim-1.13.0+20150910/utils/Makefile.am libmbim-1.13.0+20150910/utils/mbim-network.in
沒有留言:
張貼留言