DEP-14 Note
บันทึกเตือนความจำสำหรับการทำตาม DEP-14: Recommended layout for Git packaging repositories เพื่อนำไปใช้ทำกับแพกเกจอื่น ๆ ในความดูแลของผมต่อไป
สำหรับ Debian package ปกติที่จัดการเวอร์ชันบน Git และใช้ git-buildpackage ในการ build นั้น จะมี branch layout ดังนี้:
master pristine-tar upstream
-
masterเป็น branch หลักที่มีทั้ง upstream source tree และ Debian control files ครบสำหรับ build deb -
upstreamเป็น branch ที่เก็บ upstream source tree ซึ่ง maintainer จะ import source รุ่นใหม่เข้าที่นี่ก่อน (ถ้ามีการ repack เพื่อให้สอดคล้องกับ DFSG ก็ repack ก่อน import) แล้วจึง merge เข้าที่masterเพื่อเป็นการปรับรุ่น upstream ของ deb เอง -
pristine-tarเป็น branch สำหรับ regenerate binary tarball รุ่นต่าง ๆ ของ upstream เพื่อใช้เป็นไฟล์*.orig.tar.[gz|bz2|xz]โดยเก็บเฉพาะ delta ระหว่างรุ่นต่าง ๆ เพื่อให้ใช้เนื้อที่อย่างมีประสิทธิภาพสูงสุด
ศึกษารายละเอียดเพิ่มเติมได้ที่:
DEP-14 ได้แนะนำให้ใช้ branch layout แบบใหม่ เพื่อให้ Debian derivatives ต่าง ๆ ทำงานได้สะดวกขึ้น พร้อมกับเป็นการเตรียมการสำหรับเครื่องมือสร้างแพกเกจบน Git ต่าง ๆ ที่จะมีต่อไปในอนาคต
สำหรับแพกเกจใน Debian เอง โดยสรุปแล้วจะมีการเปลี่ยนแปลง branch layout ภาคบังคับอยู่ 2 รายการ คือ:
-
masterเปลี่ยนเป็นdebian/master -
upstreamเปลี่ยนเป็นupstream/latest
ทำให้มี branch layout ขั้นต่ำคือ:
debian/master pristine-tar upstream/latest
ที่เหลือก็ขึ้นอยู่กับความเปลี่ยนแปลงที่เกิดขึ้นกับแพกเกจ เช่น:
- ถ้ามีการ update ใน stable release (เช่น security update, proposed update, backport) ก็ทำใน branch
debian/jessie,debian/wheezy,debian/wheezy-backportsฯลฯ แล้วแต่กรณี - ถ้ามี experimental upload ก็ทำใน branch
debian/experimentalซึ่งเป็น branch ชั่วคราวจนกว่าจะ merge เข้าdebian/masterหรือถ้าแพกเกจไหนมี experimental upload คู่ขนานกับ stable upload อยู่เป็นนิตย์ ก็อาจจะแทน branchdebian/masterด้วยdebian/sidแล้วก็ไม่ต้องลบ branchdebian/experimentalเลยก็ได้ - ถ้าต้อง update upstream ขนานกันหลาย branch ก็อาจจะใช้
upstream/latestเก็บ development release ล่าสุด และสร้าง branch เช่นupstream/1.2.xไว้เก็บ upstream รุ่น 1.2.*
สำหรับแพกเกจที่ผมดูแล ส่งตรงจาก linux.thai.net ซึ่งที่ผ่านมามีแต่ release เป็นเส้นตรง ไม่มีแยกแขนง ก็มักไม่มีความซับซ้อนอะไร (ยกเว้นตอนที่มี security update) สิ่งที่ต้องทำในตอนนี้จึงมีเพียง 3 ขั้นตอน:
- เปลี่ยนชื่อ branch
upstreamเป็นupstream/latest - เปลี่ยนชื่อ branch
masterเป็นdebian/master - เพิ่มไฟล์
debian/gbp.confเพื่อระบุให้ใช้ branch ชื่อใหม่
เปลี่ยนชื่อ branch upstream
upstreamการเปลี่ยนชื่อ Git remote branch สามารถทำได้ตามขั้นตอนดังนี้
- เปลี่ยนชื่อ local branch
$ git branch -m upstream upstream/latest
- ลบ remote branch
upstream$ git push origin :upstream
- push local branch ชื่อใหม่ไปที่ remote
$ git push --set-upstream origin upstream/latest
เปลี่ยนชื่อ branch master
masterโดยหลักการแล้วก็ทำเหมือนตอนเปลี่ยนชื่อ branch
นั่นแหละ แต่จะมีความไม่ตรงไปตรงมานิดหน่อยupstream
- เปลี่ยนชื่อ local branch
$ git branch -m master debian/master
- ลบ remote branch
masterขั้นตอนนี้แหละที่ tricky ที่สุด เพราะ คุณกำลังจะลบ default branch (
master) ออกจาก repository!ถ้าคุณใช้ Salsa ล่ะก็ hook script ของมันจะปฏิเสธไม่ให้ลบ default branch ผ่านการ push เลยทีเดียว คุณต้องทำผ่าน web interface ดังนี้
- เปลี่ยน default branch ไปที่อื่นก่อน โดยใช้เมนู
Settings > General > Default Branch
- ลบ branch
โดยใช้เมนูmasterRepository > Branches
สังเกตว่า branch
จะถูก protect ไว้ ไม่สามารถลบผ่านการ push ได้ แต่ใช้ web interface ลบได้ โดยมันจะถามยืนยันก่อนลบmaster
- เปลี่ยน default branch ไปที่อื่นก่อน โดยใช้เมนู
- push local branch ชื่อใหม่ไปที่ remote
$ git push --set-upstream origin debian/master
- เปลี่ยน default branch ให้ชี้มาที่
โดยใช้เมนูdebian/masterSettings > General > Default Branch
เพิ่มไฟล์ debian/gbp.conf
คุณอาจจะต้อง clone Git repository ใหม่อีกครั้ง เพื่อให้ค่าต่าง ๆ ของ origin ตรงกับของ remote (เช่น HEAD)
จากนั้น เพิ่มไฟล์ debian/gbp.conf ที่มีเนื้อหาดังนี้:
[DEFAULT] pristine-tar = True debian-branch = debian/master upstream-branch = upstream/latest
ก็จะสามารถ build package ด้วย git-buildpackage ได้ตามปกติผ่าน branch layout ตาม DEP-14
ป้ายกำกับ: debian





0 ความเห็น:
แสดงความเห็น (มีการกลั่นกรองสำหรับ blog ที่เก่ากว่า 14 วัน)
<< กลับหน้าแรก