Hello community,

here is the log from the commit of package obs-service-download_files for 
openSUSE:Factory checked in at 2014-02-19 07:21:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/obs-service-download_files (Old)
 and      /work/SRC/openSUSE:Factory/.obs-service-download_files.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "obs-service-download_files"

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/obs-service-download_files/obs-service-download_files.changes
    2014-02-07 10:27:05.000000000 +0100
+++ 
/work/SRC/openSUSE:Factory/.obs-service-download_files.new/obs-service-download_files.changes
       2014-02-19 07:21:09.000000000 +0100
@@ -1,0 +2,6 @@
+Thu Feb 13 08:59:59 UTC 2014 - [email protected]
+
+- Update to version 0.5+git.1392281610.962de91:
+  + Generate changes entries from special files
+
+-------------------------------------------------------------------

Old:
----
  obs-service-download_files-0.5+git.1391604570.4196eab.tar.gz

New:
----
  obs-service-download_files-0.5+git.1392281610.962de91.tar.gz

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

Other differences:
------------------
++++++ obs-service-download_files.spec ++++++
--- /var/tmp/diff_new_pack.zK5sRp/_old  2014-02-19 07:21:09.000000000 +0100
+++ /var/tmp/diff_new_pack.zK5sRp/_new  2014-02-19 07:21:09.000000000 +0100
@@ -18,7 +18,7 @@
 
 %define service download_files
 Name:           obs-service-%{service}
-Version:        0.5+git.1391604570.4196eab
+Version:        0.5+git.1392281610.962de91
 Release:        0
 Summary:        An OBS source service: download files
 License:        GPL-2.0+

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.zK5sRp/_old  2014-02-19 07:21:09.000000000 +0100
+++ /var/tmp/diff_new_pack.zK5sRp/_new  2014-02-19 07:21:09.000000000 +0100
@@ -1,6 +1,6 @@
 <servicedata>
   <service name="tar_scm">
     <param 
name="url">[email protected]:openSUSE/obs-service-download_files.git</param>
-    <param 
name="changesrevision">4196eab32054f2899e524f9cea0c58b25ecdb21c</param>
+    <param name="changesrevision">962de91fb1</param>
   </service>
 </servicedata>

++++++ obs-service-download_files-0.5+git.1391604570.4196eab.tar.gz -> 
obs-service-download_files-0.5+git.1392281610.962de91.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/obs-service-download_files-0.5+git.1391604570.4196eab/download_files 
new/obs-service-download_files-0.5+git.1392281610.962de91/download_files
--- old/obs-service-download_files-0.5+git.1391604570.4196eab/download_files    
2014-02-05 14:03:23.000000000 +0100
+++ new/obs-service-download_files-0.5+git.1392281610.962de91/download_files    
2014-02-13 09:59:58.000000000 +0100
@@ -11,6 +11,9 @@
 DORECOMPRESS=""
 ENFORCELOCAL=""
 ENFORCEUPSTREAM=""
+CHANGES_GENERATE=disable
+CHANGES_AUTHOR=""
+CHANGES_LINES_MAX=30
 while test $# -gt 0; do
   case $1 in
     *-recompress)
@@ -35,6 +38,18 @@
       MYOUTDIR="$2"
       shift
     ;;
+    *-changesgenerate)
+      CHANGES_GENERATE="$2"
+      shift
+    ;;
+    *-changesauthor)
+      CHANGES_AUTHOR="$2"
+      shift
+    ;;
+    *-changeslinesmax)
+      CHANGES_LINES_MAX="$2"
+      shift
+    ;;
     *)
       echo "Unknown parameter $1."
       echo "This service is not accepting parameters currently."
@@ -73,6 +88,48 @@
   echo $basename
 }
 
+function write_changes() {
+  spec_file_name=$1
+
+  if [ "$spec_file_name" = "PKGBUILD" ] ; then
+    echo "No support for writing PKGBUILD changes"
+    return
+  fi
+  if [ ${#CHANGES_LINES[@]} -eq 0 ] ; then
+    echo "No changes since $CHANGES_REVISION, skipping changes file generation"
+    return
+  fi
+
+  if [ -z "$CHANGES_AUTHOR" ] ; then
+    OSCRC="$HOME/.oscrc"
+    if [ -f $OSCRC ] ; then
+      CHANGES_AUTHOR=$(grep -e '^email.*=' $OSCRC | head -n1 | cut -d"=" -f2)
+    else
+      CHANGES_AUTHOR="[email protected]"
+    fi
+  fi
+
+  
change_entry="-------------------------------------------------------------------
+$(LC_ALL=POSIX TZ=UTC date) - ${CHANGES_AUTHOR}
+
+- Update to version $NEW_VERSION:"
+  for change in "${CHANGES_LINES[@]}" ; do
+    # Skip some common boilerplate pattern:
+    case $change in
+      ==*|--*|CHANGES) continue ;;
+    esac
+    change_entry="$change_entry
+  $change"
+  done
+  change_entry="$change_entry
+"
+
+  # Prepend change entry to current changes file
+  changes_file="$SRCDIR/${spec_file_name%".spec"}.changes"
+  tmpfile=$(mktemp)
+  echo "$change_entry" | cat - $changes_file > $tmpfile && mv $tmpfile 
$MYOUTDIR/$(basename $changes_file)
+}
+
 
 default_config="/usr/lib/build/configs/sl12.3.conf"
 [ -e "/usr/lib/build/configs/default.conf" ] && 
default_config="/usr/lib/build/configs/default.conf"
@@ -102,6 +159,18 @@
     # because too many sites just have a white list, but they accept wget
     # WGET="$WGET -U 'OBS-wget'"
 
+
+    if [ "$CHANGES_GENERATE" == "enable" ]; then
+      # Check old tarball if there are any changes files present, take the 
first one (if any)
+      #changes_filename=$(tar -tf $BN* 2>/dev/null | sed -e "s|[^/]*/||" | 
grep -iE "changelog|news|changes" | head -n1)
+      OLD_CHANGES_FILENAME=$(tar -tf $BN* 2>/dev/null | grep -iE 
"/changelog|news|changes" | head -n1)
+      if [ -n "$OLD_CHANGES_FILENAME" ] ; then
+        OLD_CHANGES_FILE=$(tar -xvf $BN* $OLD_CHANGES_FILENAME)
+        OLD_CHANGES_BASEDIR=$(echo $OLD_CHANGES_FILE | sed -e "s|/.*||")
+      fi
+    fi
+    SRCDIR=$PWD
+
     cd "$MYOUTDIR"
 
     # check local cache if configured
@@ -145,6 +214,26 @@
       echo "$FILE" > "$MYCACHEDIRECTORY/filename/$HASH"
     fi
 
+    if [ "$CHANGES_GENERATE" == "enable" -a -n "$OLD_CHANGES_FILE" ]; then
+      # Try to find the same changes file in the new tarball
+      CHANGES_FILENAME=$(tar -tf $BN* 2>/dev/null | grep -iE 
"/changelog|news|changes" | head -n1)
+      if [ -n "$CHANGES_FILENAME" ] ; then
+        CHANGES_FILE=$(tar -xvf $BN* $CHANGES_FILENAME)
+        CHANGES_BASEDIR=$(echo $CHANGES_FILE | sed -e "s|/.*||")
+        NEW_VERSION=${CHANGES_BASEDIR#$BN-}  # Find out what version we 
updated to
+        # Check if both old and new aren't the same files:
+        if [ "$OLD_CHANGES_FILE" != "$CHANGES_FILE" ] ; then
+          lines=$(diff -u $SRCDIR/$OLD_CHANGES_FILE $CHANGES_FILE | grep -E 
"^\+.*" | grep -vE "^\+\+\+" | head -n $CHANGES_LINES_MAX | cut -d"+" -f2-)
+          OLD_IFS="$IFS"
+          IFS=$'\n' CHANGES_LINES=( $lines )
+          IFS="$OLD_IFS"
+          rm -rf $CHANGES_BASEDIR || :
+        fi
+      fi
+      rm -rf $SRCDIR/$OLD_CHANGES_BASEDIR || :
+      rm -rf $OLD_CHANGES_BASEDIR || :
+    fi
+
     if [[ -n "$RECOMPRESS" ]]; then
       tempfile=`mktemp`
       file_name=`uncompress_file "$FILE" "$tempfile"`
@@ -203,6 +292,10 @@
       exit 1
     fi
 
+    if [ "$CHANGES_GENERATE" == "enable" ] ; then
+      write_changes $i
+    fi
+
     cd - > /dev/null
   done
 done
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/obs-service-download_files-0.5+git.1391604570.4196eab/download_files.service
 
new/obs-service-download_files-0.5+git.1392281610.962de91/download_files.service
--- 
old/obs-service-download_files-0.5+git.1391604570.4196eab/download_files.service
    2014-02-05 14:03:23.000000000 +0100
+++ 
new/obs-service-download_files-0.5+git.1392281610.962de91/download_files.service
    2014-02-13 09:59:58.000000000 +0100
@@ -14,6 +14,16 @@
     <description>Fail when the file was not commited, download will happen 
anyway to verify that file is identical with upstream. Package state will 
become "broken".</description>
     <allowedvalue>yes</allowedvalue>
   </parameter>
-
+  <param name="changesgenerate">
+    <description>Whether or not to generate changes file entries from special 
files in the tarball (such as NEWS, CHANGES* or ChangeLog).  Default is 
'disable'.</description>
+    <allowedvalue>enable</allowedvalue>
+    <allowedvalue>disable</allowedvalue>
+  </param>
+  <param name="changesauthor">
+    <description>The author of the changes file entry to be written, defaults 
to first email entry in ~/.oscrc or "[email protected]" if there 
is no .oscrc found.</description>
+  </param>
+  <param name="changeslinesmax">
+    <description>The maximum amount of changes lines that are written (the 
rest is dropped). Defaults to 30.</description>
+  </param>
 </service>
 

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to