Differences in the python byte code fails in a build validation
(rpmdiff) done on difference architecture of the same package.

This patch:
 1) Ensures that timestamps of generated *.pyo and *.pyc files match
 2) Python integer literals greater or equal 2^32 and lower than 2^64
    are converted to long right away to prevent different type of
    the integer on architectures with different size of int

https://fedorahosted.org/freeipa/ticket/3858
From 55a5b9c5ffaf6c0139db697cd5487ecf1e9130ae Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Tue, 13 Aug 2013 02:10:01 -0400
Subject: [PATCH] Prevent *.pyo and *.pyc multilib problems

Differences in the python byte code fails in a build validation
(rpmdiff) done on difference architecture of the same package.

This patch:
 1) Ensures that timestamps of generated *.pyo and *.pyc files match
 2) Python integer literals greater or equal 2^32 and lower than 2^64
    are converted to long right away to prevent different type of
    the integer on architectures with different size of int

https://fedorahosted.org/freeipa/ticket/3858
---
 Makefile                                | 2 ++
 daemons/configure.ac                    | 1 +
 install/configure.ac                    | 1 +
 ipa-client/configure.ac                 | 1 +
 ipalib/plugins/trust.py                 | 2 +-
 ipapython/certmonger.py                 | 4 ++--
 ipaserver/install/certs.py              | 2 +-
 ipaserver/install/ipa_backup.py         | 2 +-
 ipaserver/install/ipa_restore.py        | 2 +-
 ipatests/test_xmlrpc/test_dns_plugin.py | 2 +-
 10 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 484144fd6f2dfb905abfc96621fc03b306d2f230..674143b8df14e93833d87fcea5740efbb28a9374 100644
--- a/Makefile
+++ b/Makefile
@@ -122,6 +122,7 @@ version-update: release-update
 		> ipatests/setup.py
 	perl -pi -e "s:__NUM_VERSION__:$(IPA_NUM_VERSION):" ipapython/version.py
 	perl -pi -e "s:__API_VERSION__:$(IPA_API_VERSION_MAJOR).$(IPA_API_VERSION_MINOR):" ipapython/version.py
+	touch -r ipapython/version.py.in ipapython/version.py
 	sed -e s/__VERSION__/$(IPA_VERSION)/ daemons/ipa-version.h.in \
 		> daemons/ipa-version.h
 	perl -pi -e "s:__NUM_VERSION__:$(IPA_NUM_VERSION):" daemons/ipa-version.h
@@ -135,6 +136,7 @@ version-update: release-update
 	if [ "$(SUPPORTED_PLATFORM)" != "" ]; then \
 		sed -e s/SUPPORTED_PLATFORM/$(SUPPORTED_PLATFORM)/ ipapython/services.py.in \
 			> ipapython/services.py; \
+		touch -r ipapython/services.py.in ipapython/services.py; \
 	fi
 
 	if [ "$(SKIP_API_VERSION_CHECK)" != "yes" ]; then \
diff --git a/daemons/configure.ac b/daemons/configure.ac
index 835d0b368ab016713f903e59fa857c433d467605..e57dad27614f268d3e5bbafc99b739a5cfa2589b 100644
--- a/daemons/configure.ac
+++ b/daemons/configure.ac
@@ -20,6 +20,7 @@ AC_HEADER_STDC
 AM_CONDITIONAL([HAVE_GCC], [test "$ac_cv_prog_gcc" = yes])
 
 AC_SUBST(VERSION)
+AC_SUBST([INSTALL_DATA], ['$(INSTALL) -m 644 -p'])
 
 dnl ---------------------------------------------------------------------------
 dnl - Check for NSPR/NSS
diff --git a/install/configure.ac b/install/configure.ac
index 29254e6edfb9874ead9b37cc2d310a86fbfa0060..09ed9f1b4c9779a6b1e23b7ea7ea4eac3110d2c1 100644
--- a/install/configure.ac
+++ b/install/configure.ac
@@ -18,6 +18,7 @@ AM_MAINTAINER_MODE
 #AC_HEADER_STDC
 
 AC_SUBST(VERSION)
+AC_SUBST([INSTALL_DATA], ['$(INSTALL) -m 644 -p'])
 
 AC_PROG_MKDIR_P
 AC_PROG_AWK
diff --git a/ipa-client/configure.ac b/ipa-client/configure.ac
index 880e9289f3ec92bf195b3330d121567aa27e5a73..bb4ac854b0952a42329587f566125b9976281cd2 100644
--- a/ipa-client/configure.ac
+++ b/ipa-client/configure.ac
@@ -22,6 +22,7 @@ AC_HEADER_STDC
 AM_CONDITIONAL([HAVE_GCC], [test "$ac_cv_prog_gcc" = yes])
 
 AC_SUBST(VERSION)
+AC_SUBST([INSTALL_DATA], ['$(INSTALL) -m 644 -p'])
 
 dnl ---------------------------------------------------------------------------
 dnl - Check for KRB5
diff --git a/ipalib/plugins/trust.py b/ipalib/plugins/trust.py
index 8790dcd2a5d026c728c6468d5fb7c50f58d0908b..6c7ea560eedd441b5fa46fc97b342b41010fd9f8 100644
--- a/ipalib/plugins/trust.py
+++ b/ipalib/plugins/trust.py
@@ -561,7 +561,7 @@ def add_range(self, range_name, dom_sid, *keys, **options):
             base_id = DEFAULT_RANGE_SIZE + (
                 pysss_murmur.murmurhash3(
                     dom_sid,
-                    len(dom_sid), 0xdeadbeef
+                    len(dom_sid), 0xdeadbeefL
                 ) % 10000
             ) * DEFAULT_RANGE_SIZE
 
diff --git a/ipapython/certmonger.py b/ipapython/certmonger.py
index d347c2aeb92a852e51da77557598ebf039bed0e7..03f4b23738197905f6891c0bfe842328723afd5a 100644
--- a/ipapython/certmonger.py
+++ b/ipapython/certmonger.py
@@ -398,7 +398,7 @@ def dogtag_start_tracking(ca, nickname, pin, pinfile, secdir, pre_command,
 
     if pre_command is not None:
         if not os.path.isabs(pre_command):
-            if sys.maxsize > 2**32:
+            if sys.maxsize > 2**32L:
                 libpath = 'lib64'
             else:
                 libpath = 'lib'
@@ -408,7 +408,7 @@ def dogtag_start_tracking(ca, nickname, pin, pinfile, secdir, pre_command,
 
     if post_command is not None:
         if not os.path.isabs(post_command):
-            if sys.maxsize > 2**32:
+            if sys.maxsize > 2**32L:
                 libpath = 'lib64'
             else:
                 libpath = 'lib'
diff --git a/ipaserver/install/certs.py b/ipaserver/install/certs.py
index 6d01d2be1e8f7ea2db35db55e7cc6d2bb092a281..8d7b7d0d320d3a5f87dcf1671275248755a1b799 100644
--- a/ipaserver/install/certs.py
+++ b/ipaserver/install/certs.py
@@ -540,7 +540,7 @@ def track_server_cert(self, nickname, principal, password_file=None, command=Non
         /usr/lib[64]/ipa/certmonger.
         """
         if command is not None and not os.path.isabs(command):
-            if sys.maxsize > 2**32:
+            if sys.maxsize > 2**32L:
                 libpath = 'lib64'
             else:
                 libpath = 'lib'
diff --git a/ipaserver/install/ipa_backup.py b/ipaserver/install/ipa_backup.py
index 54694c99d9473f0833ab238fb7da6b192c0eb841..8326bb0c61d517758ef5c85f633d005857994eed 100644
--- a/ipaserver/install/ipa_backup.py
+++ b/ipaserver/install/ipa_backup.py
@@ -561,7 +561,7 @@ def __find_scripts_dir(self, instance):
         if instance != 'PKI-IPA':
             return os.path.join('/var/lib/dirsrv', 'scripts-%s' % instance)
         else:
-            if sys.maxsize > 2**32:
+            if sys.maxsize > 2**32L:
                 libpath = 'lib64'
             else:
                 libpath = 'lib'
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py
index 760da0baf9a9c543c17407ce2a06907f0fd75beb..35cc6a5180b647497cd9356f241c9d90d7535a47 100644
--- a/ipaserver/install/ipa_restore.py
+++ b/ipaserver/install/ipa_restore.py
@@ -593,7 +593,7 @@ def __find_scripts_dir(self, instance):
         if instance != 'PKI-IPA':
             return os.path.join('/var/lib/dirsrv', 'scripts-%s' % instance)
         else:
-            if sys.maxsize > 2**32:
+            if sys.maxsize > 2**32L:
                 libpath = 'lib64'
             else:
                 libpath = 'lib'
diff --git a/ipatests/test_xmlrpc/test_dns_plugin.py b/ipatests/test_xmlrpc/test_dns_plugin.py
index 9a3ce667b5ac18624d840cf34ae8438efac06c18..1bfaee71e2e069616c3f2f58ad4d72f541cff694 100644
--- a/ipatests/test_xmlrpc/test_dns_plugin.py
+++ b/ipatests/test_xmlrpc/test_dns_plugin.py
@@ -1254,7 +1254,7 @@ def setUpClass(cls):
 
         dict(
             desc='Set SOA serial of zone %r to high number' % dnszone1,
-            command=('dnszone_mod', [dnszone1], {'idnssoaserial': 4294967295}),
+            command=('dnszone_mod', [dnszone1], {'idnssoaserial': 4294967295L}),
             expected={
                 'value': dnszone1,
                 'summary': None,
-- 
1.8.3.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to