[Dehs-devel] dehs welcome

Filippo Giunchedi filippo@esaurito.net
Tue, 22 Mar 2005 10:30:05 +0100


--5vNYLRcllDrimb99
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

[it is ok for me having svn commits on this list]

On Fri, Mar 18, 2005 at 04:41:07AM +0100, Bluefuture wrote:
[snip]
> 
> Well, Filippo could you change the output data format and send a patch
> on the list? Lucas do u have in mind a particular standardizing schema
> for uscan --dehs output format?

attached there is the (rather trivial) patch for uscan for using rfc882-style
messages (maybe xml is overkill, the data is not structured)
> 
> We could try to begin enumerate propose cases/excuses for packages that
> couldn't had a watch file?

I'm not sure what do you mean but if the package doesn't have a watch file,
then:

- it is possibile to get an url from copyright
  * it is possibile to guess a watch file
  * it is not possibile to guess a watch file
- it is not possibile to get an url from copyright
  * manually inject a watch file
 
filippo 

--5vNYLRcllDrimb99
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="devscripts-fg.diff"

Index: uscan.1
===================================================================
--- uscan.1	(revision 100)
+++ uscan.1	(working copy)
@@ -284,7 +284,7 @@
 Don't make these symlinks and don't rename the files.
 .TP
 .B \-\-dehs
-Use an XML format for output, as required by the DEHS system.
+Use an rfc822 format for output, as required by the DEHS system.
 .TP
 .B \-\-no-dehs
 Use the traditional uscan output format.  (This is the default behaviour.)
Index: uscan.pl
===================================================================
--- uscan.pl	(revision 100)
+++ uscan.pl	(working copy)
@@ -103,7 +103,7 @@
                    will be performed, no actions (even downloading) will be
                    carried out
     --no-dehs      Use traditional uscan output format (default)
-    --dehs         Use DEHS style output (XML-type)
+    --dehs         Use DEHS style output (rfc822-style)
     --no-conf, --noconf
                    Don\'t read devscripts config files;
                    must be the first option given
@@ -271,7 +271,7 @@
 die "$progname: Can't use --verbose if you're using --dehs!\n"
     if $verbose and $dehs;
 
-warn "$progname: You're going to get strange (non-XML) output using --debug and --dehs together!\n"
+warn "$progname: You're going to get strange (non-rfc822) output using --debug and --dehs together!\n"
     if $debug and $dehs;
 
 # We'd better be verbose if we're debugging
@@ -568,7 +568,7 @@
     my $style='new';
     my $urlbase;
 
-    %dehs_tags = ('package' => $pkg);
+    %dehs_tags = ('Package' => $pkg);
 
     if ($watch_version == 1) {
 	($site, $dir, $pattern, $lastversion, $action) = split ' ', $line;
@@ -836,10 +836,10 @@
 	$upstream_url = "$base$newfile";
     }
 
-    $dehs_tags{'debian_uversion'} = $lastversion;
-    $dehs_tags{'debian_mangled_uversion'} = $mangled_lastversion;
-    $dehs_tags{'upstream_version'} = $newversion;
-    $dehs_tags{'upstream_url'} = $upstream_url;
+    $dehs_tags{'Debian_uversion'} = $lastversion;
+    $dehs_tags{'Debian_mangled_uversion'} = $mangled_lastversion;
+    $dehs_tags{'Upstream_version'} = $newversion;
+    $dehs_tags{'Upstream_url'} = $upstream_url;
 
     print "Newest version on remote site is $newversion, local version is $lastversion\n" .
 	($mangled_lastversion eq $lastversion ? "" : " (mangled local version number $mangled_lastversion)\n")
@@ -849,7 +849,7 @@
     # compare different, whereas they are treated as equal by dpkg
     if (system("dpkg --compare-versions '$mangled_lastversion' eq '$newversion'") == 0) {
 	print " => Package is up to date\n" if $verbose;
-	$dehs_tags{'status'} = "up to date";
+	$dehs_tags{'Status'} = "up to date";
 	return 0;
     }
 
@@ -859,7 +859,7 @@
         if ($verbose) {
 	    print " => remote site does not even have current version\n";
 	} elsif ($dehs) {
-	    $dehs_tags{'status'} = "Debian version newer than remote site";
+	    $dehs_tags{'Status'} = "Debian version newer than remote site";
 	} else {
 	    print "$pkg: remote site does not even have current version\n";
 	}
@@ -887,7 +887,7 @@
 	print " => Newer version available from\n";
 	print "    $upstream_url\n";
     } elsif ($dehs) {
-	$dehs_tags{'status'} = "Newer version available";
+	$dehs_tags{'Status'} = "Newer version available";
     } else {
 	print "$pkg: Newer version ($newversion) available on remote site:\n  $upstream_url\n  (local version is $lastversion" .
 	    ($mangled_lastversion eq $lastversion ? "" : ", mangled local version number $mangled_lastversion") .
@@ -1198,21 +1198,21 @@
 {
     my $msg = $_[0];
     $msg =~ s/\s*$//;
-    push @{$dehs_tags{'messages'}}, $msg;
+    push @{$dehs_tags{'Messages'}}, $msg;
 }
 
 sub dehs_warn ($)
 {
     my $warning = $_[0];
     $warning =~ s/\s*$//;
-    push @{$dehs_tags{'warnings'}}, $warning;
+    push @{$dehs_tags{'Warnings'}}, $warning;
 }
 
 sub dehs_die ($)
 {
     my $msg = $_[0];
     $msg =~ s/\s*$//;
-    %dehs_tags = ('errors' => "$msg");
+    %dehs_tags = ('Errors' => "$msg");
     dehs_output;
     exit 1;
 }
@@ -1220,28 +1220,20 @@
 sub dehs_output ()
 {
     return unless $dehs;
-    my $output = 0;
 
-    for my $tag (qw(package debian_uversion debian_mangled_uversion
-		    upstream_version upstream_url
-		    status messages warnings errors)) {
+    for my $tag (qw(Package Debian_uversion Debian_mangled_uversion
+		    Upstream_version Upstream_url
+		    Status Messages Warnings Errors)) {
 	if (exists $dehs_tags{$tag}) {
-	    if (! $output) {
-		print "<dehs>\n";
-		$output = 1;
-	    }
 	    if (ref $dehs_tags{$tag} eq "ARRAY") {
 		foreach my $entry (@{$dehs_tags{$tag}}) {
-		    print "<$tag>$entry</$tag>\n";
+		    print "$tag: $entry\n";
 		}
 	    } else {
-		print "<$tag>$dehs_tags{$tag}</$tag>\n";
+		print "$tag: $dehs_tags{$tag}\n";
 	    }
 	}
     }
-    if ($output) {
-	print "</dehs>\n";
-    }
 
     # Don't repeat output
     %dehs_tags = ();

--5vNYLRcllDrimb99--