]> andersk Git - config-package-dev.git/blob - encode
Initial import of the config-package-dev system.
[config-package-dev.git] / encode
1 #!/usr/bin/perl
2 # Encode name of a file in a Debian package name.
3 #
4 # DO NOT CHANGE THIS FUNCTION OR WE WILL ALL BURN IN CONFLICT HELL
5
6 # The purpose of this encoding is to cause Debian configuration
7 # packages (potentially from different sites) that divert the same
8 # configuration file to conflict with each other.  Thus, it is
9 # important that all sites using this Debian configuration package
10 # system use this encoding.
11 #
12 # This encoding is intended to be human-readable, so that users can
13 # determine the cause of conflicts between different configuration
14 # packages.
15  
16 print "configures-";
17 $ARGV[0] =~ s,^/,,;
18 split('', $ARGV[0]);
19 foreach (@_){
20     if (m/[a-z0-9.-]/) {
21         print "$_";
22     } elsif (m/[A-Z]/) {
23         print "+".lc($_)."+";
24     } elsif ($_ eq '/') {
25         print "++";
26     } elsif ($_ eq '_') {
27         print "+-+";
28     } else{
29         print "+x".hex(ord($_))."+";
30     }
31 }
This page took 0.037248 seconds and 5 git commands to generate.