Skip to main content

Build Wine rpm with 32 bit application support

Wine is a software to allow running Windows applications in Linux, MAC etc. platforms. It is available for installation from package managers like yum (RHEL, CentOS) and apt (Ubuntu). You can find more details on how it works in Wine wiki . But the default Wine package available from package manager does not have support for 32 bit Windows applications. This was the case for me. In Redhat Enterprise Linux 7.3, the wine package did not contain support for 32 bit windows applications. So the only option was to build a separate rpm of wine which will include this support. All the steps are executed on a RHEL 7.3 VM (x86_64). Step 1 Download and run shell script which will make wine 64 and 32 support for RHEL: https://github.com/zma/usefulscripts/blob/master/script/install-wine-i686-centos7.sh It accepts a version no. as CLI parameter e.g. 2.0.3 The script installs wine in /usr/local/ directory by default. We can verify the files that are being copied for wine using "...

Read a log file in tail mode from python

When you want to develop a log reader application, you'll need to keep reading the log. There is a Linux utility doing exactly the same. Its the tail command. tail blocks on the file till new entries are appended to it.

I needed the similar functionality in python and there was a small library providing it already. Its called filetail.py. The program performs tail functionality and also handles log rotation.

But in my case, the log file used to change (file name) depending on the date. filetail could not handle it as the file name has changed already. To handle this I have made following changes to the filetail code -

In nextline() method file size should be checked to be less or equal to the cursor position:
# maybe the log got rotated out from under us?
if stat(self.path)[ST_SIZE] <= self.pos: # modified by sarbajit
# file got truncated and/or re-created
self._reset()
view raw tail_log.py hosted with ❤ by GitHub
In _reset() method I have added the logic to re-create the log file name from the current date value and replace it with the original file name:
def _reset(self):
"""Internal method; reopen the internal file handle (probably
because the log file got rotated/truncated)."""
self.f.close()
# modified by sarbajit
localtime1 = localtime(time())
year = str(localtime1[0])
if localtime1[1] < 9:
month = "0"+str(localtime1[1])
else:
month = str(localtime[1])
if localtime1[2] > 9:
date = str(localtime1[2])
else:
date = "0"+str(localtime1[2])
logfile_name = "applog."+year+"-"+month+"-"+date+".log"
self.path = "/var/log/" + logfile_name
# end of modification
self.f = open(self.path, "r")
self.pos = self.f.tell()
self.last_read = time()
view raw tail_log.py hosted with ❤ by GitHub
I apologize for not following standards of coding here. It served the purpose for me.

Comments