Tags: patch

Sorry, it seems I had reportbug running with an outdated email address.
I am the original reporter.

Please find attached:
- a patch to fix the above-mentioned issue
- a patch to fix another issue ($pwd is probably rather long, so the line wrapping should consider that)

Here is a fork-able repo:
https://github.com/BenWiederhake/dh-make
A version with both commits squashed:
https://github.com/BenWiederhake/dh-make/tree/squashed

In case this is required: I'm willed to add a "Signed-Off-By" line to each commit, but it doesn't look like this is required.

A note on the commit messages: The singular/plural difference is intentional, as it is about one and two such messages respectively.

With regards,
Ben Wiederhake
>From 9a3c2ee99eefb10d96d8e850477dffa65dbf7bed Mon Sep 17 00:00:00 2001
From: Ben Wiederhake <BenWiederhake.GitHub@gmx>
Date: Mon, 21 Sep 2015 21:43:52 +0200
Subject: [PATCH 1/2] Beautify error message.

---
 debian/changelog |  4 ++++
 dh_make          | 32 ++++++++++++++++++++++++++------
 dh_make.1        |  9 +++++++--
 3 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 853f09d..4945ff0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,12 @@
 dh-make (1.20150913) UNRELEASED; urgency=medium
 
+  [ Craig Small ]
   * Fixed LGPL comment
   * Added custom copyright template option
 
+  [ Ben Wiederhake ]
+  * Explain why version couldn't be parsed Closes: #799714
+
  -- Craig Small <csm...@debian.org>  Mon, 07 Sep 2015 21:12:25 +1000
 
 dh-make (1.20150601) unstable; urgency=medium
diff --git a/dh_make b/dh_make
index bca9e2f..26b77c2 100755
--- a/dh_make
+++ b/dh_make
@@ -399,11 +399,31 @@ sub get_package
 	my $pwd = &Cwd::cwd();
 	my $forced_package_version = "";
 	# May split the version out of the name
-	if ( ($main::forced_package_name) &&
-		($main::forced_package_name =~ /(.*)_([0-9][0-9a-zA-Z+.~-]*)$/))
-   	{
-		$main::forced_package_name = $1;
-		$forced_package_version = $2;
+	if ($main::forced_package_name)
+	{
+		if ($main::forced_package_name =~ /(.*)_([0-9][0-9a-zA-Z+.~-]*)$/)
+		{
+			$main::forced_package_name = $1;
+			$forced_package_version = $2;
+		} elsif ($main::forced_package_name =~ /(.*)_(.*)$/)
+		{
+			print <<"EOF";
+The directory name you have specified is invalid!
+It seems the <packagename>_<version> format was attempted,
+since underscores are illegal in both package-name and version.
+Make sure that the version starts with a digit and contains only
+digits, lower and uppercase letters, dashes, or the signs plus, dot, tilde.
+
+Your current directory is $pwd, perhaps you could try going to
+directory where the sources are?
+
+Please note that this change is necessary ONLY during the initial
+Debianization with dh_make.  When building the package, dpkg-source
+will gracefully handle almost any upstream tarball.
+
+EOF
+			exit 1;
+		}
 	}
 	if ( ($forced_package_version ne "")
 	   	|| (
@@ -445,7 +465,7 @@ Debianization with dh_make.  When building the package, dpkg-source
 will gracefully handle almost any upstream tarball.
 
 EOF
-	 exit 1;
+		exit 1;
 	}
 	if (! ($main::package_name =~ /^[a-z0-9+.-]+$/))
    	{
diff --git a/dh_make.1 b/dh_make.1
index 6c75fa7..8c88753 100644
--- a/dh_make.1
+++ b/dh_make.1
@@ -24,8 +24,13 @@ is a tool to convert a regular source code package into one formatted
 according to the requirements of the Debian Policy.
 .B dh_make
 must be invoked within a directory containing the source code, which must
-be named <packagename>\-<version>. The <packagename> must be all lowercase,
-digits and dashes. If the directory name does not conform to this scheme,
+be named <packagename>\-<version>.
+The <packagename> must be all lowercase,
+The <packagename> and <version>
+must be all lowercase,
+digits and dashes. The <version> can also contain digits, and the symbols
+plus, dot, tilde. The <version> must start with a digit.
+If the directory name does not conform to this scheme,
 you must rename it before using 
 .B dh_make.
 Alternatively, you may be able to use the \fB\-\-packagename\fR option to force 
-- 
2.5.1

>From 3c89ad8b44f5766672edcee757aa5a2ab7e36de9 Mon Sep 17 00:00:00 2001
From: Ben Wiederhake <BenWiederhake.GitHub@gmx>
Date: Mon, 21 Sep 2015 21:46:27 +0200
Subject: [PATCH 2/2] Beautify error messages.

---
 debian/changelog |  1 +
 dh_make          | 10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 4945ff0..5df7dd2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,7 @@ dh-make (1.20150913) UNRELEASED; urgency=medium
 
   [ Ben Wiederhake ]
   * Explain why version couldn't be parsed Closes: #799714
+  * Fix linebreaks (expect $pwd to be long)
 
  -- Craig Small <csm...@debian.org>  Mon, 07 Sep 2015 21:12:25 +1000
 
diff --git a/dh_make b/dh_make
index 26b77c2..06c3ece 100755
--- a/dh_make
+++ b/dh_make
@@ -414,8 +414,9 @@ since underscores are illegal in both package-name and version.
 Make sure that the version starts with a digit and contains only
 digits, lower and uppercase letters, dashes, or the signs plus, dot, tilde.
 
-Your current directory is $pwd, perhaps you could try going to
-directory where the sources are?
+Your current directory is:
+$pwd
+Perhaps you could try going to directory where the sources are?
 
 Please note that this change is necessary ONLY during the initial
 Debianization with dh_make.  When building the package, dpkg-source
@@ -457,8 +458,9 @@ needs to be in the format of <package>-<version>.  Alternatively use the
 -p flag using the format <name>_<version> to override it.
 The directory name you have specified is invalid!
 
-Your current directory is $pwd, perhaps you could try going to
-directory where the sources are?
+Your current directory is:
+$pwd
+Perhaps you could try going to directory where the sources are?
 
 Please note that this change is necessary ONLY during the initial
 Debianization with dh_make.  When building the package, dpkg-source
-- 
2.5.1

Reply via email to