Change ',' to '#' in sed 's' command
[platform/upstream/rpm.git] / scripts / brp-python-hardlink
1 #!/bin/sh
2
3 # If using normal root, avoid changing anything.
4 if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
5         exit 0
6 fi
7
8 # Hardlink identical *.pyc and *.pyo, originally from PLD's rpm-build-macros
9 # Modified to use sha1sum instead of cmp to avoid a diffutils dependency.
10 find "$RPM_BUILD_ROOT" -type f -name "*.pyc" | while read pyc ; do
11        pyo="${pyc%c}o"
12        if [ -f "$pyo" ] ; then
13                csha="$(sha1sum -b "$pyc" | cut -d' ' -f 1)" && \
14                osha="$(sha1sum -b "$pyo" | cut -d' ' -f 1)" && \
15                if [ "$csha" = "$osha" ] ; then
16                        ln -f "$pyc" "$pyo"
17                fi
18        fi
19 done