@@ -498,8 +498,13 @@ pkg_addlicense(struct pkg *pkg, const char *name)
498
498
499
499
HASH_FIND_STR (pkg -> licenses , name , l );
500
500
if (l != NULL ) {
501
- pkg_emit_error ("duplicate license listing: %s, ignoring" , name );
502
- return (EPKG_OK );
501
+ if (pkg_object_bool (pkg_config_get ("DEVELOPER_MODE" ))) {
502
+ pkg_emit_error ("duplicate license listing: %s, fatal (developer mode)" , name );
503
+ return (EPKG_FATAL );
504
+ } else {
505
+ pkg_emit_error ("duplicate license listing: %s, ignoring" , name );
506
+ return (EPKG_OK );
507
+ }
503
508
}
504
509
505
510
pkg_license_new (& l );
@@ -521,8 +526,13 @@ pkg_adduid(struct pkg *pkg, const char *name, const char *uidstr)
521
526
522
527
HASH_FIND_STR (pkg -> users , name , u );
523
528
if (u != NULL ) {
524
- pkg_emit_error ("duplicate user listing: %s, ignoring" , name );
525
- return (EPKG_OK );
529
+ if (pkg_object_bool (pkg_config_get ("DEVELOPER_MODE" ))) {
530
+ pkg_emit_error ("duplicate user listing: %s, fatal (developer mode)" , name );
531
+ return (EPKG_FATAL );
532
+ } else {
533
+ pkg_emit_error ("duplicate user listing: %s, ignoring" , name );
534
+ return (EPKG_OK );
535
+ }
526
536
}
527
537
528
538
pkg_user_new (& u );
@@ -555,8 +565,13 @@ pkg_addgid(struct pkg *pkg, const char *name, const char *gidstr)
555
565
556
566
HASH_FIND_STR (pkg -> groups , name , g );
557
567
if (g != NULL ) {
558
- pkg_emit_error ("duplicate group listing: %s, ignoring" , name );
559
- return (EPKG_OK );
568
+ if (pkg_object_bool (pkg_config_get ("DEVELOPER_MODE" ))) {
569
+ pkg_emit_error ("duplicate group listing: %s, fatal (developer mode)" , name );
570
+ return (EPKG_FATAL );
571
+ } else {
572
+ pkg_emit_error ("duplicate group listing: %s, ignoring" , name );
573
+ return (EPKG_OK );
574
+ }
560
575
}
561
576
562
577
pkg_group_new (& g );
@@ -593,9 +608,15 @@ pkg_adddep(struct pkg *pkg, const char *name, const char *origin, const char *ve
593
608
HASH_FIND_STR (pkg -> deps , origin , d );
594
609
if (d != NULL ) {
595
610
pkg_get (pkg , PKG_NAME , & n1 , PKG_VERSION , & v1 );
596
- pkg_emit_error ("%s-%s: duplicate dependency listing: %s-%s, ignoring" ,
597
- n1 , v1 , name , version );
598
- return (EPKG_OK );
611
+ if (pkg_object_bool (pkg_config_get ("DEVELOPER_MODE" ))) {
612
+ pkg_emit_error ("%s-%s: duplicate dependency listing: %s-%s, fatal (developer mode)" ,
613
+ n1 , v1 , name , version );
614
+ return (EPKG_FATAL );
615
+ } else {
616
+ pkg_emit_error ("%s-%s: duplicate dependency listing: %s-%s, ignoring" ,
617
+ n1 , v1 , name , version );
618
+ return (EPKG_OK );
619
+ }
599
620
}
600
621
601
622
pkg_dep_new (& d );
@@ -654,8 +675,13 @@ pkg_addfile_attr(struct pkg *pkg, const char *path, const char *sha256, const ch
654
675
if (check_duplicates ) {
655
676
HASH_FIND_STR (pkg -> files , path , f );
656
677
if (f != NULL ) {
657
- pkg_emit_error ("duplicate file listing: %s, ignoring" , pkg_file_path (f ));
658
- return (EPKG_OK );
678
+ if (pkg_object_bool (pkg_config_get ("DEVELOPER_MODE" ))) {
679
+ pkg_emit_error ("duplicate file listing: %s, fatal (developer mode)" , pkg_file_path (f ));
680
+ return (EPKG_FATAL );
681
+ } else {
682
+ pkg_emit_error ("duplicate file listing: %s, ignoring" , pkg_file_path (f ));
683
+ return (EPKG_OK );
684
+ }
659
685
}
660
686
}
661
687
@@ -689,8 +715,13 @@ pkg_addcategory(struct pkg *pkg, const char *name)
689
715
690
716
HASH_FIND_STR (pkg -> categories , name , c );
691
717
if (c != NULL ) {
692
- pkg_emit_error ("duplicate category listing: %s, ignoring" , name );
693
- return (EPKG_OK );
718
+ if (pkg_object_bool (pkg_config_get ("DEVELOPER_MODE" ))) {
719
+ pkg_emit_error ("duplicate category listing: %s, fatal (developer mode)" , name );
720
+ return (EPKG_FATAL );
721
+ } else {
722
+ pkg_emit_error ("duplicate category listing: %s, ignoring" , name );
723
+ return (EPKG_OK );
724
+ }
694
725
}
695
726
696
727
pkg_category_new (& c );
@@ -721,8 +752,13 @@ pkg_adddir_attr(struct pkg *pkg, const char *path, const char *uname, const char
721
752
if (check_duplicates ) {
722
753
HASH_FIND_STR (pkg -> dirs , path , d );
723
754
if (d != NULL ) {
724
- pkg_emit_error ("duplicate directory listing: %s, ignoring" , path );
725
- return (EPKG_OK );
755
+ if (pkg_object_bool (pkg_config_get ("DEVELOPER_MODE" ))) {
756
+ pkg_emit_error ("duplicate directory listing: %s, fatal (developer mode)" , path );
757
+ return (EPKG_FATAL );
758
+ } else {
759
+ pkg_emit_error ("duplicate directory listing: %s, ignoring" , path );
760
+ return (EPKG_OK );
761
+ }
726
762
}
727
763
}
728
764
@@ -856,8 +892,13 @@ pkg_addoption(struct pkg *pkg, const char *key, const char *value)
856
892
pkg_option_new (& o );
857
893
sbuf_set (& o -> key , key );
858
894
} else if ( o -> value != NULL ) {
859
- pkg_emit_error ("duplicate options listing: %s, ignoring" , key );
860
- return (EPKG_OK );
895
+ if (pkg_object_bool (pkg_config_get ("DEVELOPER_MODE" ))) {
896
+ pkg_emit_error ("duplicate options listing: %s, fatal (developer mode)" , key );
897
+ return (EPKG_FATAL );
898
+ } else {
899
+ pkg_emit_error ("duplicate options listing: %s, ignoring" , key );
900
+ return (EPKG_OK );
901
+ }
861
902
}
862
903
863
904
sbuf_set (& o -> value , value );
@@ -889,8 +930,13 @@ pkg_addoption_default(struct pkg *pkg, const char *key,
889
930
pkg_option_new (& o );
890
931
sbuf_set (& o -> key , key );
891
932
} else if ( o -> default_value != NULL ) {
892
- pkg_emit_error ("duplicate default value for option: %s, ignoring" , key );
893
- return (EPKG_OK );
933
+ if (pkg_object_bool (pkg_config_get ("DEVELOPER_MODE" ))) {
934
+ pkg_emit_error ("duplicate default value for option: %s, fatal (developer mode)" , key );
935
+ return (EPKG_FATAL );
936
+ } else {
937
+ pkg_emit_error ("duplicate default value for option: %s, ignoring" , key );
938
+ return (EPKG_OK );
939
+ }
894
940
}
895
941
896
942
sbuf_set (& o -> default_value , default_value );
@@ -921,8 +967,13 @@ pkg_addoption_description(struct pkg *pkg, const char *key,
921
967
pkg_option_new (& o );
922
968
sbuf_set (& o -> key , key );
923
969
} else if ( o -> description != NULL ) {
924
- pkg_emit_error ("duplicate description for option: %s, ignoring" , key );
925
- return (EPKG_OK );
970
+ if (pkg_object_bool (pkg_config_get ("DEVELOPER_MODE" ))) {
971
+ pkg_emit_error ("duplicate description for option: %s, fatal (developer mode)" , key );
972
+ return (EPKG_FATAL );
973
+ } else {
974
+ pkg_emit_error ("duplicate description for option: %s, ignoring" , key );
975
+ return (EPKG_OK );
976
+ }
926
977
}
927
978
928
979
sbuf_set (& o -> description , description );
@@ -1043,9 +1094,15 @@ pkg_addannotation(struct pkg *pkg, const char *tag, const char *value)
1043
1094
1044
1095
an = ucl_object_find_key (pkg -> annotations , tag );
1045
1096
if (an != NULL ) {
1046
- pkg_emit_error ("duplicate annotation tag: %s value: %s,"
1047
- " ignoring" , tag , value );
1048
- return (EPKG_OK );
1097
+ if (pkg_object_bool (pkg_config_get ("DEVELOPER_MODE" ))) {
1098
+ pkg_emit_error ("duplicate annotation tag: %s value: %s,"
1099
+ " fatal (developer mode)" , tag , value );
1100
+ return (EPKG_OK );
1101
+ } else {
1102
+ pkg_emit_error ("duplicate annotation tag: %s value: %s,"
1103
+ " ignoring" , tag , value );
1104
+ return (EPKG_OK );
1105
+ }
1049
1106
}
1050
1107
an = ucl_object_fromstring_common (value , strlen (value ), 0 );
1051
1108
pkg -> annotations = ucl_object_insert_key (pkg -> annotations ,
0 commit comments