File: upstream.pl

package info (click to toggle)
falselogin 0.3-4
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, lenny, sid, squeeze, wheezy
  • size: 56 kB
  • ctags: 15
  • sloc: ansic: 125; makefile: 57; perl: 20
file content (48 lines) | stat: -rw-r--r-- 1,522 bytes parent folder | download | duplicates (2)
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
47
48
#!/usr/bin/perl

# upstream.pl
# creates a new upstream version of a Debian package
#
# Usage: perl upstream.pl <VERSION>
# Please note that if you specify a version number that is the same of this debianized source tree, your
# old orig.tar.gz will get overwritten!

use strict;
use warnings;

my $newversion = $ARGV[0];

my $pwd = `pwd`;
my $basepwd = `basename $pwd`;

# If you don't want to specify a version number, it will
# increment by 0.1
my $increment = 0.1;

# Let's get the package name
# and the version number
my ($package, $version) = ($1, $2) if $basepwd =~ /([\w\d\_]+)-([\d\.]+)/;
die "Seems like you're not standing in a Debianized source tree.\n" unless (defined ($package) && defined($version));

# Let's create a new orig
# working directory
$newversion = $version + $increment unless (defined($newversion) && $newversion ne '');
my $neworig = "$package_" . $newversion;
print "Creating new orig files for the new upstream version: $neworig\n";
system ("mkdir $neworig.orig");

# Let's copy all the upstream
# files in there
my @files = split("\n", `ls`);
foreach my $file (@files) {
	system("cp -R $file $neworig.orig/") unless ($file =~ /^debian$/ || $file =~ /^$neworig.orig$/);
}

# Now we'll compress the new
# file and delete the temporary
# directory
system("tar czf ../$neworig.orig.tar.gz $neworig.orig/");
system("rm -rf $neworig.orig/");

print "Created a new orig file in ../$neworig.orig.tar.gz\n";
print "Done! Now you should debian/rules binary again so the .diff.gz is recreated!\n";