File: clean.sh

package info (click to toggle)
xz-utils 5.2.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 8,012 kB
  • sloc: ansic: 24,591; sh: 5,495; makefile: 830; asm: 295; sed: 16
file content (46 lines) | stat: -rw-r--r-- 1,099 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# Remove files generated by autoreconf -fi.
# For use by the clean target in debian/rules.

set -e

remove_files='#!/usr/bin/perl
# Remove specified files from the current directory.
# Each line must be a filename, a comment (starting with #),
# a simple glob (of the form *.extension), or blank.
# Filenames are restricted to a small character set.

use strict;
use warnings;

my $fnchar = qr/[-_~.@[:alnum:]]/;

my $empty = qr/^$/;
my $comment = qr/^#/;
my $simple = qr/^$fnchar+$/;
my $glob = qr/^\*$fnchar+$/;
while (my $line = <>) {
	chomp $line;
	next if $line =~ $empty;
	next if $line =~ $comment;

	if ($line =~ $simple) {
		unlink $line;
		next;
	}
	if ($line =~ $glob) {
		unlink glob($line);
		next;
	}

	die "cannot parse $line";
}
'

dh_testdir
rm -f debug/translation.bash tests/test_block.c
rm -f ABOUT-NLS aclocal.m4 config.h.in configure
(cd po && perl -e "$remove_files") < debian/generated-po.list
(cd m4 && perl -e "$remove_files") < debian/generated-m4.list
(cd build-aux && perl -e "$remove_files") < debian/generated-build-aux.list
find . -name Makefile.in -delete