오픈소스 이야기

2022.10.03 15:38

quilt 사용하기

조회 수 279 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

오픈소스에 대한 이해를 만화로 쉽게 할 수 있도록 작성한 컨텐츠를 원작자 님의 허락을 얻고 공유하고 있습니다.

공유를 허락해주신 원작자님에게 감사 드립니다.

원작자 : https://joone.net/

 

 

잠깐, quilt를 사용법을 알아볼까요? 먼저 quilt를 설치합니다.우분투라면,

$ sudo apt install quilt

 

다음과 같이 example1.txt를 작성합니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ cat example1.txt
line1
line2
Line3

아래와 같은 new 명령어로 새로운 패치를 만들 준비를 합니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ quilt new patch1.diff
Patch patches/patch1.diff is now on top

patch1.diff라는 패치가 준비되어 있고 아직은 빈 패치입니다.

edit명령어를 이용해서 example1.txt를 편집합니다.

linea 1
edit 1 (by patch1.diff)
linea 2
linea 3

두번째 라인을 추가했습니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ quilt edit example1.txt
File example1.txt added to patch patches/patch1.diff

이제 diff를 확인합니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ quilt diff
Index: demo/example1.txt
===================================================================
--- demo.orig/example1.txt
+++ demo/example1.txt
@@ -1,3 +1,4 @@
line1
+edit1 (by patch1.diff)
line2
Line3

edit1 (by patch1.diff) 이 추가되어 있음을 확인합니다.

 

이제 refresh 명령어로 실제로 patch파일을 생성합니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ quilt refresh
Refreshed patch patches/patch1.diff

변경 사항을 버리고 pop명령어를 이용해서 example1.txt를 원래 상태로 복원을 해봅니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ quilt pop
Removing patch patches/patch1.diff
Restoring example1.txt

No patches applied

exampe1.txt의 내용을 확인하면 원래 상태인 것을 알 수 있습니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ cat example1.txt
line1
line2
line3

자, 이제 두번째 패치를 작성해봅니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ quilt new patch2.diff
Patch patches/patch2.diff is now on top

series 명령어를 지금까지 작성된 patch 파일을 볼 수 있습니다. 현재 patch2.diff는 빈 파일입니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ quilt series
patches/patch2.diff
patches/patch1.diff

example2.txt를 patch2.diff에 추가하고 실제 파일을 편집합니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ quilt add example2.txt
File example2.txt added to patch patches/patch2.diff
joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ echo "New file created by patch2.diff" > example2.txt

example1.txt도 patch2.diff에 추가하고 파일을 변경합니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ quilt add example1.txt
File example1.txt added to patch patches/patch2.diff
joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ echo "Line created by patch2.diff" >> example1.txt

지금까지 변경된 내용을 diff 명령어로 확인합니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ quilt diff
Index: demo/example1.txt
===================================================================
--- demo.orig/example1.txt
+++ demo/example1.txt
@@ -1,3 +1,4 @@
line1
line2
line3
+Line created by patch2.diff
Index: demo/example2.txt
===================================================================
--- /dev/null
+++ demo/example2.txt
@@ -0,0 +1 @@
+New file created by patch2.diff

실제 patch2.diff파일을 생성합니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ quilt refresh
Refreshed patch patches/patch2.diff

모든 변경 사항을 pop합니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ quilt pop -a
Removing patch patches/patch2.diff
Removing example2.txt
Restoring example1.txt

No patches applied

현재 디렉토리 구조입니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ ll
total 20
drwxrwxr-x 4 joone joone 4096 Sep 10 15:46 ./
drwxrwxr-x 3 joone joone 4096 Sep 10 15:18 ../
-rw-rw-r-- 1 joone joone 18 Sep 10 15:46 example1.txt
drwxrwxr-x 2 joone joone 4096 Sep 10 15:46 patches/
drwxrwxr-x 2 joone joone 4096 Sep 10 15:46 .pc/

example2.txt는 사라졌고 example1.txt를 보면 원래 상태로 되어 있습니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ cat example1.txt
line1
line2
Line3

다시 지금까지 작성된 patch1.diff와 patch2.diff를 적용합니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ quilt push -a
Applying patch patches/patch2.diff
patching file example1.txt
patching file example2.txt

Applying patch patches/patch1.diff
patching file example1.txt

Now at patch patches/patch1.diff

Example2.txt가 나타났습니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ ll
total 24
drwxrwxr-x 4 joone joone 4096 Sep 10 15:47 ./
drwxrwxr-x 3 joone joone 4096 Sep 10 15:18 ../
-rw-rw-r-- 1 joone joone 69 Sep 10 15:47 example1.txt
-rw-rw-r-- 1 joone joone 32 Sep 10 15:47 example2.txt
drwxrwxr-x 2 joone joone 4096 Sep 10 15:46 patches/
drwxrwxr-x 4 joone joone 4096 Sep 10 15:47 .pc/

내용을 각각 확인해보면, 두 패치가 잘 적용되어 있는 것을 확인할 수 있습니다.

joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ cat example1.txt
line1
edit1 (by patch1.diff)
line2
line3
Line created by patch2.diff
joone@xps:~/git/foss-comics-code/47.git/quilt/demo$ cat example2.txt
New file created by patch2.diff

 

참고: https://elbauldelprogramador.com/en/how-to-mantain-patchs-quilt-tutorial/


List of Articles
번호 제목 글쓴이 날짜 조회 수
공지 최준호 - 프로그래밍의 깊은 세계로 들어가는 길 file Kevin 2018.04.22 1157
공지 허준회 - 더 나은 세상을 위한 소통 file Kevin 2018.04.22 677
공지 류창우 - 그냥 부담 없이 취미로 2 file Kevin 2018.04.22 566
공지 이희승 - 도전과 점진적 개선, 그리고 변화에 열린 마음 1 file Kevin 2018.04.22 1179
공지 김정균 - 자신을 발전시키는 소중한 공부 file Kevin 2018.04.22 499
공지 허태준 - 가장 의미 있고 즐거운 개발 file Kevin 2018.04.22 2604
공지 오픈소스 이야기 게시판 이용안내 3 file Kevin 2018.04.13 1640
79 리눅스는 인기가 있을까? 6 file Kevin 2023.12.25 559
78 오픈소스 세계의 짠한 현실 2 file Kevin 2023.12.19 290
77 Python 프로그래밍 언어 2 1 Kevin 2023.04.25 457
76 Python 프로그래밍 언어 1 1 Kevin 2023.04.17 471
75 LLVM 프로젝트 (2/2) 2 Kevin 2023.01.20 443
74 LLVM 프로젝트 (1/2) Kevin 2023.01.20 457
73 X-윈도우와 Wayland 4 Kevin 2022.11.03 3037
72 GIT Kevin 2022.10.03 361
» quilt 사용하기 Kevin 2022.10.03 279
70 diff & patch Kevin 2022.10.03 210
69 gpl-violations.org 1 Kevin 2022.09.02 378
68 KHTML 1 Kevin 2022.08.03 367
67 파이어폭스 1 Kevin 2022.06.30 507
66 넷스케이프 브라우저 2 Kevin 2022.05.16 524
65 모자익 브라우저의 탄생 Kevin 2021.10.12 494
64 월드와이드웹(WWW)의 시작 4 1 Kevin 2021.05.16 427
63 월드와이드웹(WWW)의 시작 3 1 Kevin 2021.04.12 481
62 GIMP FAQ 한국어 번역 2 세벌 2021.04.07 454
61 월드와이드웹(WWW)의 시작 2 Kevin 2021.02.01 361
60 월드와이드웹(WWW)의 시작 1 1 Kevin 2021.01.04 490
Board Pagination Prev 1 2 3 ... 4 Next
/ 4
CLOSE