오픈소스 이야기

2022.10.03 15:38

quilt 사용하기

조회 수 303 추천 수 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/


  1. 오픈소스 이야기 게시판 이용안내

    Date2018.04.13 ByKevin Views1648
    read more
  2. 월드와이드웹(WWW)의 시작 2

    Date2021.02.01 ByKevin Views365
    Read More
  3. GIMP FAQ 한국어 번역

    Date2021.04.07 By세벌 Views457
    Read More
  4. 월드와이드웹(WWW)의 시작 3

    Date2021.04.12 ByKevin Views493
    Read More
  5. 월드와이드웹(WWW)의 시작 4

    Date2021.05.16 ByKevin Views431
    Read More
  6. 모자익 브라우저의 탄생

    Date2021.10.12 ByKevin Views506
    Read More
  7. 넷스케이프 브라우저

    Date2022.05.16 ByKevin Views539
    Read More
  8. 파이어폭스

    Date2022.06.30 ByKevin Views516
    Read More
  9. KHTML

    Date2022.08.03 ByKevin Views383
    Read More
  10. gpl-violations.org

    Date2022.09.02 ByKevin Views386
    Read More
  11. diff & patch

    Date2022.10.03 ByKevin Views219
    Read More
  12. quilt 사용하기

    Date2022.10.03 ByKevin Views303
    Read More
  13. GIT

    Date2022.10.03 ByKevin Views375
    Read More
  14. X-윈도우와 Wayland

    Date2022.11.03 ByKevin Views3197
    Read More
  15. LLVM 프로젝트 (1/2)

    Date2023.01.20 ByKevin Views509
    Read More
  16. LLVM 프로젝트 (2/2)

    Date2023.01.20 ByKevin Views461
    Read More
  17. Python 프로그래밍 언어 1

    Date2023.04.17 ByKevin Views501
    Read More
  18. Python 프로그래밍 언어 2

    Date2023.04.25 ByKevin Views499
    Read More
  19. 오픈소스 세계의 짠한 현실

    Date2023.12.19 ByKevin Views332
    Read More
  20. 리눅스는 인기가 있을까?

    Date2023.12.25 ByKevin Views697
    Read More
Board Pagination Prev 1 ... 2 3 4 Next
/ 4
CLOSE