@@ -1070,7 +1070,7 @@ def commit(args):
10701070
10711071 # Keyword mangling when adding new ebuilds
10721072 ebuild_path = repo .create_ebuild ("cat/pkg-1" , keywords = ("arm64" , "x86" , "~amd64" , "-sparc" ))
1073- commit (["-a" , "-m" , "version bump (no removal)" ])
1073+ commit (["-a" , "-m" , "version bump (type A, without removal)" ])
10741074 with open (ebuild_path ) as f :
10751075 lines = f .read ().splitlines ()
10761076 mo = keywords_regex .match (lines [- 1 ])
@@ -1079,12 +1079,29 @@ def commit(args):
10791079 # Keyword mangling when adding and removing ebuilds simultaniously (git interpreted as rename)
10801080 git_repo .remove (ebuild_path , commit = False )
10811081 ebuild_path = repo .create_ebuild ("cat/pkg-2" , keywords = ("arm64" , "x86" , "~amd64" , "-sparc" ))
1082- commit (["-a" , "-m" , "version bump (no removal)" ])
1082+ commit (["-a" , "-m" , "version bump (type R, with removal)" ])
10831083 with open (ebuild_path ) as f :
10841084 lines = f .read ().splitlines ()
10851085 mo = keywords_regex .match (lines [- 1 ])
10861086 assert mo .group ("keywords" ) == "~amd64 ~arm64 -sparc ~x86"
10871087
1088+ # Keyword mangling when moving a package to another category
1089+ ebuild_path = repo .create_ebuild ("oldcat/oldname-0" , keywords = ("arm64" , "x86" , "~amd64" , "-sparc" ))
1090+ git_repo .add_all ("oldcat/oldname-0" )
1091+ os .mkdir (os .path .join (git_repo .path , 'newcat' ))
1092+ os .mkdir (os .path .join (git_repo .path , 'newcat/newname' ))
1093+ git_repo .move (
1094+ pjoin (git_repo .path , "oldcat/oldname/oldname-0.ebuild" ),
1095+ pjoin (git_repo .path , "newcat/newname/newname-0.ebuild" ),
1096+ commit = False ,
1097+ )
1098+ commit (["-a" , "-m" , "rename package (type R, but no PV change)" ])
1099+ with open (os .path .join (git_repo .path , "newcat/newname/newname-0.ebuild" )) as f :
1100+ lines = f .read ().splitlines ()
1101+ mo = keywords_regex .match (lines [- 1 ])
1102+ assert mo .group ("keywords" ) == "~amd64 arm64 -sparc x86"
1103+
1104+
10881105 def test_scan (self , capsys , repo , make_git_repo ):
10891106 git_repo = make_git_repo (repo .location )
10901107 repo .create_ebuild ("cat/pkg-0" )
0 commit comments