[devscripts] 01/01: Revert "debi/debc: reformat for consistent indentation"

James McCoy jamessan at debian.org
Wed Apr 9 23:22:03 UTC 2014


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch master
in repository devscripts.

commit a667b15ca5be1a8f1b7df11e3c096adde52149f4
Author: James McCoy <vega.james at gmail.com>
Date:   Wed Apr 9 19:21:52 2014 -0400

    Revert "debi/debc: reformat for consistent indentation"
    
    This reverts commit 4b2cacfa8660b4bc89cbfb22c02c0bea302a18df.
    
    Signed-off-by: James McCoy <vega.james at gmail.com>
    
    Conflicts:
    	debian/changelog
    	scripts/debi.pl
---
 debian/changelog |   1 -
 scripts/debi.pl  | 376 +++++++++++++++++++++++++++----------------------------
 2 files changed, 188 insertions(+), 189 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f98c923..dc7d90a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -28,7 +28,6 @@ devscripts (2.14.2) UNRELEASED; urgency=medium
     tarballs.  (Closes: #730768)
 
   [ Antonio Terceiro ]
-  * debi/debc: reformat for consistent indentation
   * debi/debc: always try ../build-area/ when the changes file is not found
     under ../ (even when not using svn)
 
diff --git a/scripts/debi.pl b/scripts/debi.pl
index 2dc40d9..b9b85a3 100755
--- a/scripts/debi.pl
+++ b/scripts/debi.pl
@@ -36,7 +36,7 @@ my $progname = basename($0,'.pl');  # the '.pl' is for when we're debugging
 my $modified_conf_msg;
 
 sub usage_i {
-  print <<"EOF";
+    print <<"EOF";
 Usage: $progname [options] [.changes file] [package ...]
   Install the .deb file(s) just created, as listed in the generated
   .changes file or the .changes file specified.  If packages are listed,
@@ -73,7 +73,7 @@ EOF
 }
 
 sub usage_c {
-  print <<"EOF";
+    print <<"EOF";
 Usage: $progname [options] [.changes file] [package ...]
   Display the contents of the .deb or .udeb file(s) just created, as listed
   in the generated .changes file or the .changes file specified.
@@ -129,51 +129,51 @@ my $install_tool = 'apt-get';
 # The next stuff is boilerplate
 
 if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) {
-  $modified_conf_msg = "  (no configuration files read)";
-  shift;
+    $modified_conf_msg = "  (no configuration files read)";
+    shift;
 } else {
-  my @config_files = ('/etc/devscripts.conf', '~/.devscripts');
-  my %config_vars = (
-    'DEBRELEASE_DEBS_DIR' => '..',
-    'DEVSCRIPTS_CHECK_DIRNAME_LEVEL' => 1,
-    'DEVSCRIPTS_CHECK_DIRNAME_REGEX' => 'PACKAGE(-.+)?',
-  );
-  my %config_default = %config_vars;
-
-  my $shell_cmd;
-  # Set defaults
-  foreach my $var (keys %config_vars) {
-    $shell_cmd .= qq[$var="$config_vars{$var}";\n];
-  }
-  $shell_cmd .= 'for file in ' . join(" ", at config_files) . "; do\n";
-  $shell_cmd .= '[ -f $file ] && . $file; done;' . "\n";
-  # Read back values
-  foreach my $var (keys %config_vars) { $shell_cmd .= "echo \$$var;\n" }
-  my $shell_out = `/bin/bash -c '$shell_cmd'`;
-  @config_vars{keys %config_vars} = split /\n/, $shell_out, -1;
-
-  # Check validity
-  $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_LEVEL'} =~ /^[012]$/
-    or $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_LEVEL'}=1;
-  # We do not replace this with a default directory to avoid accidentally
-  # installing a broken package
-  $config_vars{'DEBRELEASE_DEBS_DIR'} =~ s%/+%/%;
-  $config_vars{'DEBRELEASE_DEBS_DIR'} =~ s%(.)/$%$1%;
-  if (! -d $config_vars{'DEBRELEASE_DEBS_DIR'}) {
-    $debsdir_warning = "config file specified DEBRELEASE_DEBS_DIR directory $config_vars{'DEBRELEASE_DEBS_DIR'} does not exist!";
-  }
-
-  foreach my $var (sort keys %config_vars) {
-    if ($config_vars{$var} ne $config_default{$var}) {
-      $modified_conf_msg .= "  $var=$config_vars{$var}\n";
+    my @config_files = ('/etc/devscripts.conf', '~/.devscripts');
+    my %config_vars = (
+		       'DEBRELEASE_DEBS_DIR' => '..',
+		       'DEVSCRIPTS_CHECK_DIRNAME_LEVEL' => 1,
+		       'DEVSCRIPTS_CHECK_DIRNAME_REGEX' => 'PACKAGE(-.+)?',
+		       );
+    my %config_default = %config_vars;
+
+    my $shell_cmd;
+    # Set defaults
+    foreach my $var (keys %config_vars) {
+	$shell_cmd .= qq[$var="$config_vars{$var}";\n];
     }
-  }
-  $modified_conf_msg ||= "  (none)\n";
-  chomp $modified_conf_msg;
+    $shell_cmd .= 'for file in ' . join(" ", at config_files) . "; do\n";
+    $shell_cmd .= '[ -f $file ] && . $file; done;' . "\n";
+    # Read back values
+    foreach my $var (keys %config_vars) { $shell_cmd .= "echo \$$var;\n" }
+    my $shell_out = `/bin/bash -c '$shell_cmd'`;
+    @config_vars{keys %config_vars} = split /\n/, $shell_out, -1;
+
+    # Check validity
+    $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_LEVEL'} =~ /^[012]$/
+	or $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_LEVEL'}=1;
+    # We do not replace this with a default directory to avoid accidentally
+    # installing a broken package
+    $config_vars{'DEBRELEASE_DEBS_DIR'} =~ s%/+%/%;
+    $config_vars{'DEBRELEASE_DEBS_DIR'} =~ s%(.)/$%$1%;
+    if (! -d $config_vars{'DEBRELEASE_DEBS_DIR'}) {
+	$debsdir_warning = "config file specified DEBRELEASE_DEBS_DIR directory $config_vars{'DEBRELEASE_DEBS_DIR'} does not exist!";
+    }
+
+    foreach my $var (sort keys %config_vars) {
+	if ($config_vars{$var} ne $config_default{$var}) {
+	    $modified_conf_msg .= "  $var=$config_vars{$var}\n";
+	}
+    }
+    $modified_conf_msg ||= "  (none)\n";
+    chomp $modified_conf_msg;
 
-  $debsdir = $config_vars{'DEBRELEASE_DEBS_DIR'};
-  $check_dirname_level = $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_LEVEL'};
-  $check_dirname_regex = $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_REGEX'};
+    $debsdir = $config_vars{'DEBRELEASE_DEBS_DIR'};
+    $check_dirname_level = $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_LEVEL'};
+    $check_dirname_regex = $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_REGEX'};
 }
 
 # Command line options next
@@ -182,25 +182,25 @@ my $opt_upgrade;
 my ($opt_level, $opt_regex, $opt_noconf);
 my ($opt_tool, $opt_with_depends);
 GetOptions("help" => \$opt_help,
-  "version" => \$opt_version,
-  "a=s" => \$opt_a,
-  "t=s" => \$opt_t,
-  "debs-dir=s" => \$opt_debsdir,
-  "m|multi" => \$opt_multi,
-  "u|upgrade" => \$opt_upgrade,
-  "check-dirname-level=s" => \$opt_level,
-  "check-dirname-regex=s" => \$opt_regex,
-  "with-depends" => \$opt_with_depends,
-  "tool=s" => \$opt_tool,
-  "noconf" => \$opt_noconf,
-  "no-conf" => \$opt_noconf,
-)
-  or die "Usage: $progname [options] [.changes file] [package ...]\nRun $progname --help for more details\n";
+	   "version" => \$opt_version,
+	   "a=s" => \$opt_a,
+	   "t=s" => \$opt_t,
+	   "debs-dir=s" => \$opt_debsdir,
+	   "m|multi" => \$opt_multi,
+	   "u|upgrade" => \$opt_upgrade,
+	   "check-dirname-level=s" => \$opt_level,
+	   "check-dirname-regex=s" => \$opt_regex,
+	   "with-depends" => \$opt_with_depends,
+	   "tool=s" => \$opt_tool,
+	   "noconf" => \$opt_noconf,
+	   "no-conf" => \$opt_noconf,
+	   )
+    or die "Usage: $progname [options] [.changes file] [package ...]\nRun $progname --help for more details\n";
 
 if ($opt_help) { usage(); exit 0; }
 if ($opt_version) { print $version; exit 0; }
 if ($opt_noconf) {
-  die "$progname: --no-conf is only acceptable as the first command-line option!\n";
+    die "$progname: --no-conf is only acceptable as the first command-line option!\n";
 }
 
 my ($targetarch, $targetgnusystem);
@@ -208,90 +208,90 @@ $targetarch = $opt_a ? "-a$opt_a" : "";
 $targetgnusystem = $opt_t ? "-t$opt_t" : "";
 
 if ($opt_debsdir) {
-  $opt_debsdir =~ s%/+%/%;
-  $opt_debsdir =~ s%(.)/$%$1%;
-  if (! -d $opt_debsdir) {
-    $debsdir_warning = "--debs-dir directory $opt_debsdir does not exist!";
-  }
-  $debsdir = $opt_debsdir;
+    $opt_debsdir =~ s%/+%/%;
+    $opt_debsdir =~ s%(.)/$%$1%;
+    if (! -d $opt_debsdir) {
+	$debsdir_warning = "--debs-dir directory $opt_debsdir does not exist!";
+    }
+    $debsdir = $opt_debsdir;
 }
 
 if ($debsdir_warning) {
-  die "$progname: $debsdir_warning\n";
+    die "$progname: $debsdir_warning\n";
 }
 
 if (defined $opt_level) {
-  if ($opt_level =~ /^[012]$/) { $check_dirname_level = $opt_level; }
-  else {
-    die "$progname: unrecognised --check-dirname-level value (allowed are 0,1,2)\n";
-  }
+    if ($opt_level =~ /^[012]$/) { $check_dirname_level = $opt_level; }
+    else {
+	die "$progname: unrecognised --check-dirname-level value (allowed are 0,1,2)\n";
+    }
 }
 
 if (defined $opt_regex) { $check_dirname_regex = $opt_regex; }
 
 if ($opt_tool) {
-  $install_tool = $opt_tool;
+    $install_tool = $opt_tool;
 }
 
 # Is a .changes file listed on the command line?
 my ($changes, $mchanges, $arch);
 if (@ARGV and $ARGV[0] =~ /\.changes$/) {
-  $changes = shift;
+    $changes = shift;
 }
 
 # Need to determine $arch in any event
 $arch = `dpkg-architecture $targetarch $targetgnusystem -qDEB_HOST_ARCH`;
 if ($? != 0 or ! $arch) {
-  die "$progname: unable to determine target architecture.\n";
+    die "$progname: unable to determine target architecture.\n";
 }
 chomp $arch;
 
 my $chdir = 0;
 
 if (! defined $changes) {
-  # Look for .changes file via debian/changelog
-  until (-r 'debian/changelog') {
-    $chdir = 1;
-    chdir '..' or die "$progname: can't chdir ..: $!\n";
-    if (cwd() eq '/') {
-      die "$progname: cannot find readable debian/changelog anywhere!\nAre you in the source code tree?\n";
+    # Look for .changes file via debian/changelog
+    until (-r 'debian/changelog') {
+	$chdir = 1;
+	chdir '..' or die "$progname: can't chdir ..: $!\n";
+	if (cwd() eq '/') {
+	    die "$progname: cannot find readable debian/changelog anywhere!\nAre you in the source code tree?\n";
+	}
     }
-  }
-
-  if (-e ".svn/deb-layout") {
-    # Cope with format of svn-buildpackage tree
-    my $fh;
-    open($fh, "<", ".svn/deb-layout") || die "Can't open .svn/deb-layout: $!\n";
-    my($build_area) = grep /^buildArea=/, <$fh>;
-    close($fh);
-    if (defined($build_area) and not $opt_debsdir) {
-      chomp($build_area);
-      $build_area =~ s/^buildArea=//;
-      $debsdir = $build_area if -d $build_area;
+
+    if (-e ".svn/deb-layout") {
+	# Cope with format of svn-buildpackage tree
+	my $fh;
+	open($fh, "<", ".svn/deb-layout") || die "Can't open .svn/deb-layout: $!\n";
+	my($build_area) = grep /^buildArea=/, <$fh>;
+	close($fh);
+	if (defined($build_area) and not $opt_debsdir) {
+	    chomp($build_area);
+	    $build_area =~ s/^buildArea=//;
+	    $debsdir = $build_area if -d $build_area;
+	}
     }
-  }
-
-  # Find the source package name and version number
-  my $changelog = changelog_parse();
-
-  die "$progname: no package name in changelog!\n"
-  unless exists $changelog->{'Source'};
-  die "$progname: no package version in changelog!\n"
-  unless exists $changelog->{'Version'};
-
-  # Is the directory name acceptable?
-  if ($check_dirname_level ==  2 or
-    ($check_dirname_level == 1 and $chdir)) {
-    my $re = $check_dirname_regex;
-    $re =~ s/PACKAGE/\\Q$changelog->{'Source'}\\E/g;
-    my $gooddir;
-    if ($re =~ m%/%) { $gooddir = eval "cwd() =~ /^$re\$/;"; }
-    else { $gooddir = eval "basename(cwd()) =~ /^$re\$/;"; }
-
-    if (! $gooddir) {
-      my $pwd = cwd();
-      die <<"EOF";
-      $progname: found debian/changelog for package $changelog->{'Source'} in the directory
+
+    # Find the source package name and version number
+    my $changelog = changelog_parse();
+
+    die "$progname: no package name in changelog!\n"
+	unless exists $changelog->{'Source'};
+    die "$progname: no package version in changelog!\n"
+	unless exists $changelog->{'Version'};
+
+    # Is the directory name acceptable?
+    if ($check_dirname_level ==  2 or
+	    ($check_dirname_level == 1 and $chdir)) {
+	my $re = $check_dirname_regex;
+	$re =~ s/PACKAGE/\\Q$changelog->{'Source'}\\E/g;
+	my $gooddir;
+	if ($re =~ m%/%) { $gooddir = eval "cwd() =~ /^$re\$/;"; }
+	else { $gooddir = eval "basename(cwd()) =~ /^$re\$/;"; }
+
+	if (! $gooddir) {
+	    my $pwd = cwd();
+	    die <<"EOF";
+$progname: found debian/changelog for package $changelog->{'Source'} in the directory
   $pwd
 but this directory name does not match the package name according to the
 regex  $check_dirname_regex.
@@ -299,44 +299,44 @@ regex  $check_dirname_regex.
 To run $progname on this package, see the --check-dirname-level and
 --check-dirname-regex options; run $progname --help for more info.
 EOF
+	}
+    }
+
+    my $sversion = $changelog->{'Version'};
+    $sversion =~ s/^\d+://;
+    my $package = $changelog->{'Source'};
+    my $pva="${package}_${sversion}_${arch}";
+    $changes="$debsdir/$pva.changes";
+
+    if (! -e $changes and -d "../build-area") {
+	# Try out default svn-buildpackage structure in case
+	# we were going to fail anyway...
+	$changes = "../build-area/$pva.changes";
+    }
+
+    if ($opt_multi) {
+	my @mchanges = glob("$debsdir/${package}_${sversion}_*+*.changes");
+	@mchanges = grep { /[_+]$arch[\.+]/ } @mchanges;
+	$mchanges = $mchanges[0] || '';
+	$mchanges ||= "$debsdir/${package}_${sversion}_multi.changes"
+	    if -f "$debsdir/${package}_${sversion}_multi.changes";
     }
-  }
-
-  my $sversion = $changelog->{'Version'};
-  $sversion =~ s/^\d+://;
-  my $package = $changelog->{'Source'};
-  my $pva="${package}_${sversion}_${arch}";
-  $changes="$debsdir/$pva.changes";
-
-  if (! -e $changes and -d "../build-area") {
-    # Try out default svn-buildpackage structure in case
-    # we were going to fail anyway...
-    $changes = "../build-area/$pva.changes";
-  }
-
-  if ($opt_multi) {
-    my @mchanges = glob("$debsdir/${package}_${sversion}_*+*.changes");
-    @mchanges = grep { /[_+]$arch[\.+]/ } @mchanges;
-    $mchanges = $mchanges[0] || '';
-    $mchanges ||= "$debsdir/${package}_${sversion}_multi.changes"
-    if -f "$debsdir/${package}_${sversion}_multi.changes";
-  }
 }
 
 chdir dirname($changes)
-  or die "$progname: can't chdir to $changes directory: $!\n";
+    or die "$progname: can't chdir to $changes directory: $!\n";
 $changes = basename($changes);
 $mchanges = basename($mchanges) if $opt_multi;
 
 if (! -r $changes or $opt_multi and $mchanges and ! -r $mchanges) {
-  die "$progname: can't read $changes" .
-  (($opt_multi and $mchanges) ? " or $mchanges" : "") . "!\n";
+    die "$progname: can't read $changes" .
+	(($opt_multi and $mchanges) ? " or $mchanges" : "") . "!\n";
 }
 
 if (! -r $changes and $opt_multi) {
-  $changes = $mchanges;
+    $changes = $mchanges;
 } else {
-  $opt_multi = 0;
+    $opt_multi = 0;
 }
 # $opt_multi now tells us whether we're actually using a multi-arch .changes
 # file
@@ -346,67 +346,67 @@ my %pkgs = map { $_ => 0 } @ARGV;
 my $ctrl = Dpkg::Control->new(name => $changes, type => CTRL_FILE_CHANGES);
 $ctrl->load($changes);
 for (split(/\n/, $ctrl->{Files})) {
-  # udebs are only supported for debc
-  if ((($progname eq 'debi') && (/ (\S*\.deb)$/)) ||
-    (($progname eq 'debc') && (/ (\S*\.u?deb)$/))) {
-    my $deb = $1;
-    $deb =~ /^([a-z0-9+\.-]+)_/ or warn "unrecognised .deb name: $deb\n";
-    # don't want other archs' .debs:
-    next unless $deb =~ /[_+]($arch|all)[\.+]/;
-    my $pkg = $deb;
-    $pkg =~ s/_.*$//;
-
-    if (@ARGV) {
-      if (exists $pkgs{$pkg}) {
-        push @debs, $deb;
-        $pkgs{$pkg}++;
-      } elsif (exists $pkgs{$deb}) {
-        push @debs, $deb;
-        $pkgs{$deb}++;
-      }
-    } else {
-      push @debs, $deb;
+    # udebs are only supported for debc
+    if ((($progname eq 'debi') && (/ (\S*\.deb)$/)) ||
+	(($progname eq 'debc') && (/ (\S*\.u?deb)$/))) {
+	my $deb = $1;
+	$deb =~ /^([a-z0-9+\.-]+)_/ or warn "unrecognised .deb name: $deb\n";
+	# don't want other archs' .debs:
+	next unless $deb =~ /[_+]($arch|all)[\.+]/;
+	my $pkg = $deb;
+	$pkg =~ s/_.*$//;
+
+	if (@ARGV) {
+	    if (exists $pkgs{$pkg}) {
+		push @debs, $deb;
+		$pkgs{$pkg}++;
+	    } elsif (exists $pkgs{$deb}) {
+		push @debs, $deb;
+		$pkgs{$deb}++;
+	    }
+	} else {
+	    push @debs, $deb;
+	}
     }
-  }
 }
 
 if (! @debs) {
-  die "$progname: no appropriate .debs found in the changes file $changes!\n";
+    die "$progname: no appropriate .debs found in the changes file $changes!\n";
 }
 
 if ($progname eq 'debi') {
-  my @upgrade = $opt_upgrade ? ('-O') : ();
-  if ($opt_with_depends) {
-    system('debpkg', @upgrade, '--unpack', @debs) == 0
-      or die "$progname: debpkg --unpack failed \n";
-    system($install_tool, '-f', 'install') == 0
-      or die "$progname: " . $install_tool . ' -f install failed\n';
-  } else {
-    system('debpkg', @upgrade, '-i', @debs) == 0
-      or die "$progname: debpkg -i failed\n";
-  }
+    my @upgrade = $opt_upgrade ? ('-O') : ();
+    if ($opt_with_depends) {
+	system('debpkg', @upgrade, '--unpack', @debs) == 0
+	    or die "$progname: debpkg --unpack failed \n";
+	system($install_tool, '-f', 'install') == 0
+	    or die "$progname: " . $install_tool . ' -f install failed\n';
+    } else {
+	system('debpkg', @upgrade, '-i', @debs) == 0
+	    or die "$progname: debpkg -i failed\n";
+    }
 } else {
-  # $progname eq 'debc'
-  foreach my $deb (@debs) {
-    print "$deb\n";
-    print '-' x length($deb), "\n";
-    system('dpkg-deb', '-I', $deb) == 0
-      or die "$progname: dpkg-deb -I $deb failed\n";
-    system('dpkg-deb', '-c', $deb) == 0
-      or die "$progname: dpkg-deb -c $deb failed\n";
-    print "\n";
-  }
+    # $progname eq 'debc'
+    foreach my $deb (@debs) {
+	print "$deb\n";
+	print '-' x length($deb), "\n";
+	system('dpkg-deb', '-I', $deb) == 0
+	    or die "$progname: dpkg-deb -I $deb failed\n";
+	system('dpkg-deb', '-c', $deb) == 0
+	    or die "$progname: dpkg-deb -c $deb failed\n";
+	print "\n";
+    }
 }
 
 # Now do a sanity check
 if (@ARGV) {
-  foreach my $pkg (keys %pkgs) {
-    if ($pkgs{$pkg} == 0) {
-      warn "$progname: package $pkg not found in $changes, ignoring\n";
-    } elsif ($pkgs{$pkg} > 1) {
-      warn "$progname: package $pkg found more than once in $changes, installing all\n";
+    foreach my $pkg (keys %pkgs) {
+	if ($pkgs{$pkg} == 0) {
+	    warn "$progname: package $pkg not found in $changes, ignoring\n";
+	} elsif ($pkgs{$pkg} > 1) {
+	    warn "$progname: package $pkg found more than once in $changes, installing all\n";
+	}
     }
-  }
 }
 
 exit 0;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list