Hello community,

here is the log from the commit of package mkdud for openSUSE:Factory checked 
in at 2015-01-27 09:09:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/mkdud (Old)
 and      /work/SRC/openSUSE:Factory/.mkdud.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "mkdud"

Changes:
--------
--- /work/SRC/openSUSE:Factory/mkdud/mkdud.changes      2015-01-22 
00:58:05.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.mkdud.new/mkdud.changes 2015-01-27 
09:09:21.000000000 +0100
@@ -1,0 +2,18 @@
+Mon Jan 26 16:41:08 CET 2015 - snw...@suse.com
+
+- fix git2log script
+- 1.13
+
+-------------------------------------------------------------------
+Mon Jan 26 16:23:15 CET 2015 - snw...@suse.com
+
+- updated git2log script
+- 1.12
+
+-------------------------------------------------------------------
+Mon Jan 26 16:20:32 CET 2015 - snw...@suse.com
+
+- Fix typo
+- 1.11
+
+-------------------------------------------------------------------

Old:
----
  mkdud-1.10.tar.xz

New:
----
  mkdud-1.13.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ mkdud.spec ++++++
--- /var/tmp/diff_new_pack.MtN7xp/_old  2015-01-27 09:09:21.000000000 +0100
+++ /var/tmp/diff_new_pack.MtN7xp/_new  2015-01-27 09:09:21.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package mkdud
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
 # Copyright (c) 2011 Steffen Winterfeldt
 #
 # All modifications and additions to the file contributed by third parties
@@ -22,7 +22,7 @@
 Summary:        Create driver update from rpms
 License:        GPL-3.0+
 Group:          Hardware/Other
-Version:        1.10
+Version:        1.13
 Release:        0
 Source:         %{name}-%{version}.tar.xz
 Url:            https://github.com/wfeldt/mkdud

++++++ mkdud-1.10.tar.xz -> mkdud-1.13.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mkdud-1.10/Makefile new/mkdud-1.13/Makefile
--- old/mkdud-1.10/Makefile     2014-10-13 15:35:15.000000000 +0200
+++ new/mkdud-1.13/Makefile     2015-01-26 16:35:56.000000000 +0100
@@ -1,13 +1,14 @@
 GIT2LOG        := $(shell if [ -x ./git2log ] ; then echo ./git2log --update ; 
else echo true ; fi)
 GITDEPS        := $(shell [ -d .git ] && echo .git/HEAD .git/refs/heads 
.git/refs/tags)
 VERSION        := $(shell $(GIT2LOG) --version VERSION ; cat VERSION)
-BRANCH := $(shell git branch | perl -ne 'print $$_ if s/^\*\s*//')
+BRANCH := $(shell [ -d .git ] && git branch | perl -ne 'print $$_ if 
s/^\*\s*//')
 PREFIX := mkdud-$(VERSION)
 BINDIR   = /usr/bin
 
 all:    archive
 
 archive: changelog
+       @if [ ! -d .git ] ; then echo no git repo ; false ; fi
        mkdir -p package
        git archive --prefix=$(PREFIX)/ $(BRANCH) > package/$(PREFIX).tar
        tar -r -f package/$(PREFIX).tar --mode=0664 --owner=root --group=root 
--mtime="`git show -s --format=%ci`" --transform='s:^:$(PREFIX)/:' VERSION 
changelog
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mkdud-1.10/README new/mkdud-1.13/README
--- old/mkdud-1.10/README       2014-10-13 15:35:15.000000000 +0200
+++ new/mkdud-1.13/README       2015-01-26 16:35:56.000000000 +0100
@@ -28,7 +28,7 @@
     preferred.
 
 Method (b) has the advantage that the old packages are never installed and
-used and conficts and dependencies are automatically resolved (think of
+used and conflicts and dependencies are automatically resolved (think of
 different kernel flavors).
 
 This script supports both ways.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mkdud-1.10/VERSION new/mkdud-1.13/VERSION
--- old/mkdud-1.10/VERSION      2014-10-13 15:35:15.000000000 +0200
+++ new/mkdud-1.13/VERSION      2015-01-26 16:35:56.000000000 +0100
@@ -1 +1 @@
-1.10
+1.13
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mkdud-1.10/changelog new/mkdud-1.13/changelog
--- old/mkdud-1.10/changelog    2014-10-13 15:35:15.000000000 +0200
+++ new/mkdud-1.13/changelog    2015-01-26 16:35:56.000000000 +0100
@@ -1,3 +1,12 @@
+2015-01-26:    8bc57e17bc620def784a8130c98d349054c6823d-1.13
+       - fix git2log script
+
+2015-01-26:    1.12
+       - updated git2log script
+
+2015-01-20:    1.11
+       - Fix typo
+
 2014-10-13:    1.10
        - added 'archive' Makefile target
        - updated git2log script
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mkdud-1.10/git2log new/mkdud-1.13/git2log
--- old/mkdud-1.10/git2log      2014-10-13 15:35:15.000000000 +0200
+++ new/mkdud-1.13/git2log      2015-01-26 16:35:56.000000000 +0100
@@ -1,5 +1,7 @@
 #! /usr/bin/perl
 
+use strict;
+
 use Getopt::Long;
 
 use Data::Dumper;
@@ -8,27 +10,43 @@
 $Data::Dumper::Indent = 1;
 
 sub usage;
+sub get_branch_tags;
+sub get_branch;
+sub get_parent_branch;
+sub get_version;
 
 usage 0 if !@ARGV;
 
-@deps = qw ( .git/HEAD .git/refs/heads .git/refs/tags );
+my @deps = qw ( .git/HEAD .git/refs/heads .git/refs/tags );
+
+my $branch;
+my $current_version;
+my @tags;
+my @all_tags;
+
+my $opt_log;
+my $opt_version;
+my $opt_branch;
+my $opt_update;
+my $opt_file;
 
 GetOptions(
   'help'          => sub { usage 0 },
   'version'       => \$opt_version,
+  'branch'        => \$opt_branch,
   'update'        => \$opt_update,
   'log|changelog' => \$opt_log,
 ) || usage 1;
 
-usage 1 if @ARGV > 1 || !($opt_log || $opt_version);
+usage 1 if @ARGV > 1 || !($opt_log || $opt_version || $opt_branch);
 $opt_file = @ARGV ? shift : '-';
 
 die "no git repo\n" unless -d ".git";
 
 if($opt_update && $opt_file ne '-' && -f($opt_file)) {
-  $ok = 1;
+  my $ok = 1;
 
-  $t = (stat $opt_file)[9];
+  my $t = (stat $opt_file)[9];
 
   for (@deps) {
     $ok = 0 if (stat)[9] > $t;
@@ -37,57 +55,45 @@
   exit 0 if $ok;
 }
 
-for (`git branch`) {
-  if(/^\*\s+(\S+)/) {
-    $branch = $1;
-    last;
-  }
-}
-
-$branch = "master" if $branch eq '(no';
+@all_tags = `git tag`;
+chomp @all_tags;
 
+$branch = get_branch;
 die "no branch?\n" unless $branch;
 
-# print STDERR "writing log for branch $branch\n";
-
-@tags = `git tag`;
+@tags = get_branch_tags;
+die "no tags at all?\n" unless @tags;
 
-chomp @tags;
+if(!grep { /^$branch\-/ } @tags) {
+  $branch = get_parent_branch;
+  die "sorry, can't determine branch\n" unless $branch;
 
-for (@tags) {
-  if(/^\d/) {
-    s/(\d+)/sprintf "%04d", $1/eg;
-    push @ntags, $_;
-  }
-  elsif(s/^$branch\-//) {
-    s/(\d+)/sprintf "%04d", $1/eg;
-    push @ntags, "$branch-$_";
-  }
+  @tags = get_branch_tags;
+  die "no tags at all?\n" unless @tags;
 }
 
-@tags = sort @ntags;
-
-die "no tags at all?\n" unless @tags;
-
-$current_version = $tags[-1];
-$current_version =~ s/(\d+)/$1 + 0/eg;
+if($opt_branch) {
+  open my $f, ">$opt_file";
+  print $f "$branch\n";
+  close $f;
 
-if(`git log --pretty=medium --date=iso '$current_version..HEAD'`) {
-  $current_version =~ s/(\d+)$/$1 + 1/e;
+  exit 0;
 }
 
-$current_version =~ s/^$branch\-//;
+$current_version = get_version;
 
 if($opt_version) {
-  open F, ">$opt_file";
-  print F "$current_version\n";
-  close F;
+  open my $f, ">$opt_file";
+  print $f "$current_version\n";
+  close $f;
 
   exit 0;
 }
 
 if($branch ne 'master') {
-  for ($i = 0; $i < @tags; $i++) {
+  my ($i1, $i2, $bi);
+
+  for (my $i = 0; $i < @tags; $i++) {
     if($tags[$i] =~ /^$branch\-(\S+)/) {
       $i2 = $i;
       $bi = $1;
@@ -99,7 +105,7 @@
 
   warn "no tags in this branch yet\n" unless $bi;
 
-  for ($i = 0; $i < $i2; $i++) {
+  for (my $i = 0; $i < $i2; $i++) {
     if($tags[$i] ge $bi) {
       if($tags[$i] eq $bi) {
         $i1 = $i;
@@ -122,14 +128,14 @@
 
 open F, ">$opt_file";
 
-for ($i = @tags - 1; $i > 0; $i--) {
-  $date = undef;
-  @t = `git log --pretty=medium --date=iso '$tags[$i-1]..$tags[$i]'`;
+for (my $i = @tags - 1; $i > 0; $i--) {
+  my ($date, @t2);
+
+  my @t = `git log --pretty=medium --date=iso '$tags[$i-1]..$tags[$i]'`;
 
   # print "\n--- $tags[$i-1]..$tags[$i] ---\n", @t, "---\n";
 
-  undef @t2;
-  $merge = 0;
+  my $merge = 0;
   for (@t) {
     $merge = 1 if /^Merge: /;
     $merge = 0 if /^commit /;
@@ -138,15 +144,13 @@
   @t = @t2;
 
   undef @t2;
-  $detail = 0;
+  my $detail = 0;
   for (@t) {
     $detail = 1 if /^    $/;
+    $detail = 2 if /^    Conflicts:$/;
     $detail = 0 if /^commit /;
-    if($detail && /^    [^\-\s]/) {
-      # push @t2, "# $_";
-    }
-    else {
-      push @t2, $_;
+    if(!$detail || !/^    [^\-\s]/) {
+      push @t2, $_ if $detail < 2;
     }
   }
   @t = @t2;
@@ -160,10 +164,21 @@
       last;
     }
   }
+
+  # handle white space in every first line once and for all
+  my $empty = 1;
+  for (@t) {
+    $empty = 1, $_ = "", next if $_ =~ /^\s*$/;
+    next if !$empty;
+    s/^\s*//;
+    $empty = 0;
+  }
+
   @t = grep { !/^(commit|Author:|Date:|Merge:|\s*$)|created.*tag/ } @t;
   if(@t) {
     # rewrite a bit to have it look more consistent
-    map { s/(fate|bnc)#/$1 #/g } @t;
+    map { s/(fate|bnc|bsc)#/$1 #/g } @t;
+    map { s/(fate|bnc|bsc)\s*(\d{4})/$1 #$2/g } @t;
     map { s/\(#/(bnc #/g } @t;
     map { s/bug\s*#/bnc #/g } @t;
     map { s/feat(\.|ure)?\s*#?(\d+)/fate #$2/g } @t;
@@ -175,9 +190,9 @@
     map { s/^/\t/ } @t;
     map { s/\\'/'/ } @t;
 
-#    print "\n--- $tags[$i-1]..$tags[$i] ---\n", join("\n", @t);
+    # print "\n--- $tags[$i-1]..$tags[$i] ---\n", join("\n", @t);
 
-    $t = $tags[$i];
+    my $t = $tags[$i];
     $t = "${branch}-$t" if $branch ne 'master' && $t eq "HEAD";
     $t =~ s/HEAD/$current_version/;
     print F "$date:\t$t\n";
@@ -187,6 +202,8 @@
 
 close F;
 
+
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 sub usage
 {
   my $err = shift;
@@ -196,6 +213,7 @@
 Create changelog and project version from git repo.
   --changelog   Write changelog to FILE.
   --version     Write version number to FILE.
+  --branch      Write current branch to FILE.
   --update      Write changelog or version only if FILE is outdated.
   --help        Print this help text.
   usage
@@ -203,3 +221,72 @@
   exit $err;
 }
 
+
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+sub get_branch_tags
+{
+  my @ntags;
+
+  for (@all_tags) {
+    if(/^\d/) {
+      s/(\d+)/sprintf "%04d", $1/eg;
+      push @ntags, $_;
+    }
+    elsif(s/^$branch\-//) {
+      s/(\d+)/sprintf "%04d", $1/eg;
+      push @ntags, "$branch-$_";
+    }
+  }
+
+  return sort @ntags;
+}
+
+
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+sub get_branch
+{
+  my $b;
+
+  for (`git branch`) {
+    if(/^\*\s+(\S+)/) {
+      $b = $1;
+      last;
+    }
+  }
+
+  $b = "master" if $b eq '(no';
+
+  return $b;
+}
+
+
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+sub get_parent_branch
+{
+  my $p;
+
+  for (`git log -g --pretty=oneline`) {
+    $p = $1 if /checkout: moving from (\S+) to $branch/;
+  }
+
+  # print "parent = $p\n";
+
+  return $p || "master";
+}
+
+
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+sub get_version
+{
+  my $v = $tags[-1];
+  $v =~ s/(\d+)/$1 + 0/eg;
+
+  if(`git log --pretty=medium --date=iso '$v..HEAD'`) {
+    $v =~ s/(\d+)$/$1 + 1/e;
+  }
+
+  $v =~ s/^$branch\-//;
+
+  return $v;
+}
+

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to