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

Revision 25426, 802 bytes checked in by andersk, 13 years ago (diff)
In config-package-dev: * Fix DEB_CHECK_FILES and DEB_TRANSFORM_FILES with non-conffiles in Multi-Arch: same packages. * Fix encode script to work with Perl 5.12. While we’re at it, turn on strict and warnings. * Bump Standards-Version to 3.9.2 (no changes required). * Add Vcs-Git, Vcs-Browser.
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.
[25426]13
14use strict;
15use warnings;
[22854]16 
17$ARGV[0] =~ s,^/,,;
[25426]18foreach (split('', $ARGV[0])) {
[22854]19    if (m/[a-z0-9.-]/) {
20        print "$_";
21    } elsif (m/[A-Z]/) {
22        print "+".lc($_)."+";
23    } elsif ($_ eq '/') {
24        print "++";
25    } elsif ($_ eq '_') {
26        print "+-+";
27    } else{
28        print "+x".hex(ord($_))."+";
29    }
30}
Note: See TracBrowser for help on using the repository browser.