source: trunk/debathena/debathena/config-package-dev/encode @ 23076

Revision 23076, 778 bytes checked in by tabbott, 16 years ago (diff)
Improve config-package-dev documentation and examples.
RevLine 
[22854]1#!/usr/bin/perl
2# Encode name of a file in a Debian package name.
3#
4# The purpose of this encoding is to cause Debian configuration
5# packages (potentially from different sites) that divert the same
6# configuration file to conflict with each other.  Thus, it is
7# important that all sites using this Debian configuration package
8# system use this encoding.
9#
10# This encoding is intended to be human-readable, so that users can
11# determine the cause of conflicts between different configuration
12# packages.
13 
14$ARGV[0] =~ s,^/,,;
15split('', $ARGV[0]);
16foreach (@_){
17    if (m/[a-z0-9.-]/) {
18        print "$_";
19    } elsif (m/[A-Z]/) {
20        print "+".lc($_)."+";
21    } elsif ($_ eq '/') {
22        print "++";
23    } elsif ($_ eq '_') {
24        print "+-+";
25    } else{
26        print "+x".hex(ord($_))."+";
27    }
28}
Note: See TracBrowser for help on using the repository browser.