오픈소스 이야기
quilt 사용하기
2022.10.03 15:38
오픈소스에 대한 이해를 만화로 쉽게 할 수 있도록 작성한 컨텐츠를 원작자 님의 허락을 얻고 공유하고 있습니다.
원작자 : 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/
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
공지 | 오픈소스 이야기 게시판 이용안내 [3] | Kevin | 2018.04.13 | 1516 |
76 | LLVM 프로젝트 (2/2) [2] | Kevin | 2023.01.20 | 114 |
75 | LLVM 프로젝트 (1/2) | Kevin | 2023.01.20 | 77 |
74 | X-윈도우와 Wayland [4] | Kevin | 2022.11.03 | 1147 |
73 | GIT | Kevin | 2022.10.03 | 135 |
» | quilt 사용하기 | Kevin | 2022.10.03 | 68 |
71 | diff & patch | Kevin | 2022.10.03 | 45 |
70 | gpl-violations.org [1] | Kevin | 2022.09.02 | 153 |
69 | KHTML [1] | Kevin | 2022.08.03 | 148 |
68 | 8월 도커, 쿠버네티스, 록키 리눅스 실무 교육(Zoom) 100% 정부지원 | RedHat | 2022.07.29 | 432 |
67 | 파이어폭스 [1] | Kevin | 2022.06.30 | 235 |
66 | 넷스케이프 브라우저 [2] | Kevin | 2022.05.16 | 315 |
65 | 모자익 브라우저의 탄생 | Kevin | 2021.10.12 | 351 |
64 | 월드와이드웹(WWW)의 시작 4 [1] | Kevin | 2021.05.16 | 323 |
63 | 월드와이드웹(WWW)의 시작 3 [1] | Kevin | 2021.04.12 | 354 |
62 | GIMP FAQ 한국어 번역 [2] | 세벌 | 2021.04.07 | 369 |
61 | 월드와이드웹(WWW)의 시작 2 | Kevin | 2021.02.01 | 268 |
60 | 월드와이드웹(WWW)의 시작 1 [1] | Kevin | 2021.01.04 | 374 |
59 | 그놈(GNOME) 데스크탑의 시작 [2] | Kevin | 2020.08.06 | 922 |
58 | 오픈소스 이미지 편집 프로그램 김프와 GTK+ 시작 [2] | Kevin | 2020.06.08 | 1478 |
57 | 오픈소스 GUI 툴킷 Qt와 KDE 프로젝트의 시작 [1] | Kevin | 2020.05.21 | 3674 |