From adb66eddf1c0cbc6783a59df138b433bfefa1e53 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Sat, 6 Feb 2016 17:45:02 +0100
Subject: [PATCH] Fix generation of rpm packages

---
 ChangeLog                        |  2 +-
 build/makepack-dolibarr.pl       | 13 ++++++++-----
 build/rpm/dolibarr-forrpm.patch  |  4 ++--
 build/rpm/dolibarr_fedora.spec   |  2 ++
 build/rpm/dolibarr_generic.spec  |  2 ++
 build/rpm/dolibarr_mandriva.spec |  2 ++
 build/rpm/dolibarr_opensuse.spec |  2 ++
 7 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a17879fcbdd..13346d43763 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,7 +12,7 @@ Upgrading to any other version or any other database system is abolutely require
 make a Dolibarr upgrade.
 
 
-***** ChangeLog for 3.9 compared to 3.8.* *****
+***** ChangeLog for 3.9.0 compared to 3.8.* *****
 For users:
 NEW: A new and more modern look for "eldy" theme.
 NEW: Introduce a new theme called "Material Design". 
diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl
index a057489ad04..42091d0cda4 100755
--- a/build/makepack-dolibarr.pl
+++ b/build/makepack-dolibarr.pl
@@ -354,15 +354,18 @@ if ($nboftargetok) {
 		chdir("$SOURCE");
 		
 		# Test that the ChangeLog is ok
-		$ret=`grep "ChangeLog for $MAJOR.$MINOR\.$BUILD" "$SOURCE/ChangeLog" 2>&1`;
+		$TMPBUILDTOCHECKCHANGELOG=$BUILD;
+		$TMPBUILDTOCHECKCHANGELOG =~ s/\-rc//;
+		print "Check if ChangeLog is ok for version $MAJOR.$MINOR\.$TMPBUILDTOCHECKCHANGELOG\n";
+		$ret=`grep "ChangeLog for $MAJOR.$MINOR\.$TMPBUILDTOCHECKCHANGELOG" "$SOURCE/ChangeLog" 2>&1`;
 		if (! $ret)
 		{
-			print "Error: The ChangeLogFile was not updated. Run the following command first:\n";
-			if (! $BUILD)
+			print "Error: The ChangeLogFile was not updated. Run the following command before building package for $MAJOR.$MINOR.$BUILD:\n";
+			if (! $BUILD || $BUILD eq '0-rc')	# For a major version
 			{
-				print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop | grep ^- | cut -c2- | head -n`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
+				print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop | grep ^- | cut -c2- | head -n 1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
 			}
-			else
+			else			# For a maintenance release
 			{
 				print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
 			}
diff --git a/build/rpm/dolibarr-forrpm.patch b/build/rpm/dolibarr-forrpm.patch
index 41f27e3b791..6c484345be9 100644
--- a/build/rpm/dolibarr-forrpm.patch
+++ b/build/rpm/dolibarr-forrpm.patch
@@ -25,7 +25,7 @@ diff -up htdocs/install/inc.php.patch htdocs/install/inc.php
 +$conffiletoshow = "/etc/dolibarr/conf.php";
  
  
- if (! defined('DONOTLOADCONF') && file_exists($conffile))
+ // Load conf file if it is already defined
 diff -up htdocs/support/inc.php.patch htdocs/support/inc.php
 --- htdocs/support/inc.php.patch	2011-09-03 02:34:39.606952000 +0200
 +++ htdocs/support/inc.php	2011-09-03 02:33:59.814952000 +0200
@@ -39,4 +39,4 @@ diff -up htdocs/support/inc.php.patch htdocs/support/inc.php
 +$conffiletoshow = "/etc/dolibarr/conf.php";
  
  
- if (! defined('DONOTLOADCONF') && file_exists($conffile))
+ // Load conf file if it is already defined
diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec
index 7189b7b6dc2..0cd72f99cdd 100755
--- a/build/rpm/dolibarr_fedora.spec
+++ b/build/rpm/dolibarr_fedora.spec
@@ -183,6 +183,7 @@ done >>%{name}.lang
 %_datadir/dolibarr/htdocs/fourn
 %_datadir/dolibarr/htdocs/ftp
 %_datadir/dolibarr/htdocs/holiday
+%_datadir/dolibarr/htdocs/hrm
 %_datadir/dolibarr/htdocs/imports
 %_datadir/dolibarr/htdocs/includes
 %_datadir/dolibarr/htdocs/install
@@ -200,6 +201,7 @@ done >>%{name}.lang
 %_datadir/dolibarr/htdocs/public
 %_datadir/dolibarr/htdocs/resource
 %_datadir/dolibarr/htdocs/societe
+%_datadir/dolibarr/htdocs/supplier_proposal
 %_datadir/dolibarr/htdocs/support
 %_datadir/dolibarr/htdocs/theme
 %_datadir/dolibarr/htdocs/user
diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec
index 0e28ff594ea..043088bf5d6 100755
--- a/build/rpm/dolibarr_generic.spec
+++ b/build/rpm/dolibarr_generic.spec
@@ -263,6 +263,7 @@ done >>%{name}.lang
 %_datadir/dolibarr/htdocs/fourn
 %_datadir/dolibarr/htdocs/ftp
 %_datadir/dolibarr/htdocs/holiday
+%_datadir/dolibarr/htdocs/hrm
 %_datadir/dolibarr/htdocs/imports
 %_datadir/dolibarr/htdocs/includes
 %_datadir/dolibarr/htdocs/install
@@ -280,6 +281,7 @@ done >>%{name}.lang
 %_datadir/dolibarr/htdocs/public
 %_datadir/dolibarr/htdocs/resource
 %_datadir/dolibarr/htdocs/societe
+%_datadir/dolibarr/htdocs/supplier_proposal
 %_datadir/dolibarr/htdocs/support
 %_datadir/dolibarr/htdocs/theme
 %_datadir/dolibarr/htdocs/user
diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec
index 639ec2b52dd..3f439bb4a9a 100755
--- a/build/rpm/dolibarr_mandriva.spec
+++ b/build/rpm/dolibarr_mandriva.spec
@@ -180,6 +180,7 @@ done >>%{name}.lang
 %_datadir/dolibarr/htdocs/fourn
 %_datadir/dolibarr/htdocs/ftp
 %_datadir/dolibarr/htdocs/holiday
+%_datadir/dolibarr/htdocs/hrm
 %_datadir/dolibarr/htdocs/imports
 %_datadir/dolibarr/htdocs/includes
 %_datadir/dolibarr/htdocs/install
@@ -197,6 +198,7 @@ done >>%{name}.lang
 %_datadir/dolibarr/htdocs/public
 %_datadir/dolibarr/htdocs/resource
 %_datadir/dolibarr/htdocs/societe
+%_datadir/dolibarr/htdocs/supplier_proposal
 %_datadir/dolibarr/htdocs/support
 %_datadir/dolibarr/htdocs/theme
 %_datadir/dolibarr/htdocs/user
diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec
index 23f42adaa0a..cc21d7083b3 100755
--- a/build/rpm/dolibarr_opensuse.spec
+++ b/build/rpm/dolibarr_opensuse.spec
@@ -191,6 +191,7 @@ done >>%{name}.lang
 %_datadir/dolibarr/htdocs/fourn
 %_datadir/dolibarr/htdocs/ftp
 %_datadir/dolibarr/htdocs/holiday
+%_datadir/dolibarr/htdocs/hrm
 %_datadir/dolibarr/htdocs/imports
 %_datadir/dolibarr/htdocs/includes
 %_datadir/dolibarr/htdocs/install
@@ -208,6 +209,7 @@ done >>%{name}.lang
 %_datadir/dolibarr/htdocs/public
 %_datadir/dolibarr/htdocs/resource
 %_datadir/dolibarr/htdocs/societe
+%_datadir/dolibarr/htdocs/supplier_proposal
 %_datadir/dolibarr/htdocs/support
 %_datadir/dolibarr/htdocs/theme
 %_datadir/dolibarr/htdocs/user
-- 
GitLab