@@ -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,30 @@ 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 (
1090+ "oldcat/oldname-0" , keywords = ("arm64" , "x86" , "~amd64" , "-sparc" )
1091+ )
1092+ git_repo .add_all ("oldcat/oldname-0" )
1093+ os .mkdir (os .path .join (git_repo .path , "newcat" ))
1094+ os .mkdir (os .path .join (git_repo .path , "newcat/newname" ))
1095+ git_repo .move (
1096+ pjoin (git_repo .path , "oldcat/oldname/oldname-0.ebuild" ),
1097+ pjoin (git_repo .path , "newcat/newname/newname-0.ebuild" ),
1098+ commit = False ,
1099+ )
1100+ commit (["-a" , "-m" , "rename package (type R, but no PV change)" ])
1101+ with open (os .path .join (git_repo .path , "newcat/newname/newname-0.ebuild" )) as f :
1102+ lines = f .read ().splitlines ()
1103+ mo = keywords_regex .match (lines [- 1 ])
1104+ assert mo .group ("keywords" ) == "~amd64 arm64 -sparc x86"
1105+
10881106 def test_scan (self , capsys , repo , make_git_repo ):
10891107 git_repo = make_git_repo (repo .location )
10901108 repo .create_ebuild ("cat/pkg-0" )
0 commit comments