pax_global_header00006660000000000000000000000064123130347500014510gustar00rootroot0000000000000052 comment=2a6762cdb37c8daa13f46caedf770ee0cabd18ae rpmrebuild-arepo-3.1.5/000075500000000000000000000000001231303475000147655ustar00rootroot00000000000000rpmrebuild-arepo-3.1.5/.gear/000075500000000000000000000000001231303475000157615ustar00rootroot00000000000000rpmrebuild-arepo-3.1.5/.gear/rules000064400000000000000000000000061231303475000170320ustar00rootroot00000000000000tar: .rpmrebuild-arepo-3.1.5/arepo.plug000064400000000000000000000007471231303475000167740ustar00rootroot00000000000000change-spec-preamble arepo.sh change-spec-conflicts arepo.sh change-spec-obsoletes arepo.sh change-spec-provides arepo.sh change-spec-requires arepo.sh change-spec-description arepo.sh change-spec-files arepo.sh change-spec-triggers arepo.sh change-spec-pre arepo.sh change-spec-post arepo.sh change-spec-preun arepo.sh change-spec-postun arepo.sh # change-spec-verifyscript arepo.sh # change-spec-changelog arepo.sh # apply on whole spec (add another tag) # change-spec-whole arepo.sh rpmrebuild-arepo-3.1.5/arepo.sh000075500000000000000000000151041231303475000164330ustar00rootroot00000000000000#!/bin/bash -e ############################################################################### # code's file of arepo plugin for rpmrebuild # # There are several required environment variables: # AREPO_MODE - operation mode, either "lib" or "prog" # AREPO_PKGLIST - file containing the list of all arepo package names # AREPO_ARCH - compat architecture name # AREPO_COMPAT - path to input package of the compat architecture # AREPO_NATIVE - path to input package of the native architecture, may be unset # AREPO_CONF - path to config file, defaults to /etc/rpmrebuild-arepo.conf fatal() { printf >&2 '%s\n' "${0##*/}: $*" exit 1 } FILTER_MODE="${LONG_OPTION#change-spec-}" [ -n "$FILTER_MODE" -a "$FILTER_MODE" != "$LONG_OPTION" ] || fatal "Invalid LONG_OPTION ($LONG_OPTION)!" [ -n "$AREPO_CONF" ] || AREPO_CONF=/etc/rpmrebuild-arepo.conf lib_files= blacklist_files= . $AREPO_CONF [ -n "$AREPO_ARCH" ] || fatal 'AREPO_ARCH is not set!' # There are two possible arepo-modes: lib (repack only libraries) and prog (repack all) [ "$AREPO_MODE" = "lib" -o "$AREPO_MODE" = "prog" ] || fatal "Invalid AREPO_MODE ($AREPO_MODE), valid modes are 'lib' and 'prog'." [ -f "$AREPO_PKGLIST" ] || fatal "Arepo state file $AREPO_PKGLIST is not accessible!" [ -f "$AREPO_COMPAT" ] || fatal "Donor rpm file $AREPO_COMPAT is not accessible!" ORIGRPMNAME=`rpmquery --qf "%{NAME}" -p "$AREPO_COMPAT"` tmpdir= cleanup_tmpdir() { [ -z "$tmpdir" ] || rm -rf -- "$tmpdir" exit "$@" } create_tmpdir() { [ -z "$tmpdir" ] || return 0 tmpdir=$(mktemp -dt "${0##*/}.XXXXXXXX") trap 'cleanup_tmpdir $?' EXIT trap 'exit 143' HUP INT QUIT PIPE TERM } get_tag_depname() { # Fetch NAME from "Tag: NAME..." printf '%s\n' "$*" | sed -n 's,^[^:]\+: \+\([^ <=>]\+\).*,\1,p' } arepoize_tag() { # Convert "Tag: NAME..." -> "Tag: $AREPO_ARCH-NAME..." printf '%s\n' "$*" | sed 's,^\([^:]\+: \+\)\([^ <=>].*\),\1'"$AREPO_ARCH"'-\2,' } is_arepoized_name() { local name="$1"; shift [ -n "$name" ] && grep -Fqsx "$AREPO_ARCH-$name" "$AREPO_PKGLIST" && return 0 || return 1 } output_intact() { printf '%s\n' "$*" } filter_description() { echo "[This package was automatically repackaged from $AREPO_ARCH.]" echo cat } # common code for conflicts and obsoletes filter_obsoletes() { local line DEPNAME while read line; do arepoize_tag "$line" if [ "$AREPO_MODE" = "prog" ]; then DEPNAME="$(get_tag_depname "$line")" if ! is_arepoized_name "$DEPNAME"; then # copy original conflicts/obsoletes output_intact "$line" fi fi done } filter_conflicts() { if [ "$AREPO_MODE" = "prog" -a -f "$AREPO_NATIVE" ]; then # add Conflicts: %name for the native package echo "Conflicts: $ORIGRPMNAME" fi filter_obsoletes } filter_files() { if [ "$AREPO_MODE" = "prog" ]; then # filter out file names containing Percent symbols grep -v '".*%' ||: return fi create_tmpdir # dump %files from the native package if [ -f "$AREPO_NATIVE" ]; then rpmquery -l -p "$AREPO_NATIVE" > "$tmpdir/orig" else : > "$tmpdir/orig" fi sort -t $'\t' -u -o "$tmpdir"/orig{,} # filter out file names containing Tab and Percent symbols # input format: ..."${file}" # output format: ${file}\t... sed -n 's,^\([^"\t]*\)"\(/[^%\t]*\)"$,\2\t\1,p' > "$tmpdir"/ours sort -t $'\t' -u -o "$tmpdir"/ours{,} if [ "$AREPO_MODE" = "lib" ]; then # filter out %ghost files sed -i '/[[:space:]]%ghost[[:space:]]/d' "$tmpdir"/ours fi cut -f1 "$tmpdir"/ours | # take package names grep -Ee "$lib_files" | # filter them through whitelist grep -Eve "$blacklist_files" | # filter them through blacklist_files comm -23 - "$tmpdir/orig" | # subtract those that also packaged to the native package join -t $'\t' -j 1 -o 2.2,2.1 - "$tmpdir"/ours | # output format: ...\t${file} sed 's/\t\(.*\)/"\1"/' # convert to original input format } filter_preamble() { # arepoize package name sed 's/\(^Name: *\)/\1'"$AREPO_ARCH"'-/' } filter_provides() { local line DEPNAME while read line; do case "$line" in *.so.*|*.so|*.so' '*|*.so'('*')'*) # a soname provide output_intact "$line" ;; *) DEPNAME="$(get_tag_depname "$line")" if [ "$DEPNAME" = "$ORIGRPMNAME" ]; then # keeping self-provide as sometimes we # provide ourselves with different # version (not filtering standard NEVR # so we can't get rid of it anyway) arepoize_tag "$line" fi if [ "$AREPO_MODE" = "prog" ]; then # copy all the rest in prog mode intact output_intact "$line" fi if is_arepoized_name "$DEPNAME"; then # there is an arepoized package # corresponding to this provide so there # might be an arepoized requirement # corresponding to this arepoized provide. arepoize_tag "$line" fi ;; esac done } filter_requires() { if [ "$AREPO_MODE" = "lib" ]; then # add Requires: %name=EVR for the native package ORIGRPMREQ=`rpmquery --qf "%{NAME} = %|EPOCH?{%{EPOCH}:}|%{VERSION}-%{RELEASE}" -p "$AREPO_COMPAT"` if [ -f "$AREPO_NATIVE" ]; then echo "Requires: $ORIGRPMREQ" fi fi local line DEPNAME while read line; do case "$line" in *.so.*|*.so|*.so' '*) # a soname req output_intact "$line" ;; *) DEPNAME="$(get_tag_depname "$line")" if is_arepoized_name "$DEPNAME"; then # there is an arepoized package corresponding to this req arepoize_tag "$line" elif [ "$AREPO_MODE" = "prog" ]; then # copy all the rest in prog mode intact output_intact "$line" fi ;; esac done } filter_scripts() { if [ "$AREPO_MODE" = 'prog' ]; then # in prog mode copy scripts as is cat elif [ "$AREPO_MODE" = 'lib' -a -f "$AREPO_NATIVE" ]; then # copy scripts iff they differ local t qf case "$FILTER_MODE" in pre) t=PREIN ;; post) t=POSTIN ;; preun) t=PREUN ;; postun) t=POSTUN ;; triggers ) qf='[trigger%{TRIGGERTYPE} script (through %{TRIGGERSCRIPTPROG}) -- %{TRIGGERCONDS}\n%{TRIGGERSCRIPTS}\n]' ;; *) # discard unrecognized sections cat > /dev/null return ;; esac [ -n "$qf" ] || qf="'%|${t}?{preinstall scriptlet%|${t}PROG?{ (through %{${t}PROG})}|:\\n%{${t}}\\n}:{%|${t}PROG?{preinstall program: %{${t}PROG}\\n}|}|'" create_tmpdir rpmquery --qf "$qf" -p "$AREPO_COMPAT" > "$tmpdir/script_compat" rpmquery --qf "$qf" -p "$AREPO_NATIVE" > "$tmpdir/script_native" if cmp -s "$tmpdir/script_compat" "$tmpdir/script_native"; then cat > /dev/null else cat fi else # discard cat > /dev/null fi } case "$FILTER_MODE" in conflicts|description|files|obsoletes|preamble|provides|requires) filter_$FILTER_MODE ;; triggers|pre|post|preun|postun) filter_scripts ;; *) cat ;; esac rpmrebuild-arepo-3.1.5/arepo_pre.py000075500000000000000000000113661231303475000173250ustar00rootroot00000000000000#!/usr/bin/python # # Use this script to calculate new arepo state. # It takes 3 parameters: <32-bit rpmdir> <64-bit rpmdir> [] # and produces the output listing in the following format: # 'i586-packagename EVR i586-packagename-VR.i586.rpm packagename-VR.i586.rpm arepo-mode' # # The config file [defaults to /etc/rpmrebuild-arepo.conf) contains a list of # following regexps (egrep/python): # Programs to arepo (prog_packages) # - Files to repack in 'lib' mode (lib_files) # - Files to determine 'prog' (prog_files) # - Files to skip (blacklist_files) # - Blacklist packages names (blacklist_pkg_name) # - Blacklist packages with following content (blacklist_pkg_contents) import rpm import os import sys import re class PackageHeader: def __init__(self, path): fd = os.open(path,os.O_RDONLY) self.hdr = rpm.headerFromPackage(fd)[0] self.name = self.hdr[rpm.RPMTAG_NAME] self.vr=self.hdr[rpm.RPMTAG_VERSION]+"-"+self.hdr[rpm.RPMTAG_RELEASE] if self.hdr[rpm.RPMTAG_EPOCH]!=None: self.evr=str(self.hdr[rpm.RPMTAG_EPOCH])+":"+self.vr else: self.evr=self.vr os.close(fd) def printself(self,mode): print "i586-"+self.name+"\t"+self.evr+"\ti586-"+self.name+"-"+self.vr+".i586.rpm\t"+self.name+"-"+self.vr+".i586.rpm\t"+mode def is_arepable(self, list64, filelist, blacklist_files, blacklist_pkg_contents): has_arepable_content = False for i in range(0,len(self.hdr[rpm.RPMTAG_FILENAMES])-1): fname = self.hdr[rpm.RPMTAG_FILENAMES][i] fflags = self.hdr[rpm.RPMTAG_FILEFLAGS][i] # In 'lib' mode if not has_arepable_content \ and not fname in list64 \ and not (fflags & rpm.RPMFILE_GHOST) \ and filelist.search(fname) \ and not blacklist_files.search(fname): # Will not intersect with 64-bit package, matches lib_files/prog_files and not matches blacklist_files has_arepable_content = True if blacklist_pkg_contents.search(fname): # Package has blacklisted content return False return has_arepable_content if __name__ == "__main__": if len(sys.argv) < 3: sys.stderr.write("Usage: "+sys.argv[0]+" <32-bit rpmdir> <64-bit rpmdir> []\n") sys.exit(1) rpmdir32 = sys.argv[1] rpmdir64 = sys.argv[2] if not os.path.isdir(rpmdir32): sys.stderr.write("32-bit rpm dir invalid: "+rpmdir32+"!\n") sys.exit(1) if not os.path.isdir(rpmdir64): sys.stderr.write("64-bit rpm dir invalid: "+rpmdir64+"!\n") sys.exit(1) configfile = "/etc/rpmrebuild-arepo.conf" if len(sys.argv) > 3: configfile = sys.argv[3] fd = open(configfile,"r") prog_packages = "" lib_files = "" prog_files = "" blacklist_files = "" blacklist_pkg_name = "" blacklist_pkg_contents = "" for line in fd.readlines(): if line.strip()=='' or line.strip().startswith('#'): continue (option,value) = line.split('=') (option,value) = (option.strip(' "\'\t'),value.strip(' "\'\t\n')) if option == "prog_packages": prog_packages = re.compile(value) elif option == "lib_files": lib_files = re.compile(value) elif option == "prog_files": prog_files = re.compile(value) elif option == "blacklist_files": blacklist_files = re.compile(value) elif option == "blacklist_pkg_name": blacklist_pkg_name = re.compile(value) elif option == "blacklist_pkg_contents": blacklist_pkg_contents = re.compile(value) else: sys.stderr.write("Unknown option in config: "+option+"!\n") sys.exit(1) rpms32 = os.listdir(rpmdir32) for rpm32 in rpms32: header = PackageHeader(rpmdir32+'/'+rpm32) if header.hdr[rpm.RPMTAG_ARCH] != 'i586': continue if blacklist_pkg_name.search(header.name): continue rpm64 = rpmdir64+'/'+header.name+'-'+header.vr+'.x86_64.rpm' if prog_packages.search(header.name): if header.is_arepable([], prog_files, blacklist_files, blacklist_pkg_contents): header.printself('prog') elif not os.path.isfile(rpm64): if header.is_arepable([], prog_files, blacklist_files, blacklist_pkg_contents): header.printself('prog') elif header.is_arepable([], lib_files, blacklist_files, blacklist_pkg_contents): header.printself('lib') else: header64 = PackageHeader(rpm64) if header.is_arepable(header64.hdr[rpm.RPMTAG_FILENAMES], lib_files, blacklist_files, blacklist_pkg_contents): header.printself('lib') rpmrebuild-arepo-3.1.5/rpmrebuild-arepo.conf000064400000000000000000000011151231303475000211030ustar00rootroot00000000000000# regexp: packages to arepoize in 'prog' mode prog_packages="^wine-vanilla$|^wine$|^mozilla-plugin-adobe-flash$" # regexp: files to repack in 'lib' mode lib_files="^/lib/[^/]+\.so|^/usr/lib/[^/]+\.[ao]$|^/usr/lib/.+\.so|^/usr/(include|lib/(gcc|gconv|gdk-pixbuf-[[:digit:].]+|pango|pkgconfig|wine))/|^/etc/X11/lib$" # regexp: files to determine 'prog' mode prog_files="^(/usr)?/s?bin/" # regexp: files to skip blacklist_files="^$" # regexp: packages to skip blacklist_pkg_name="-debuginfo$|^kernel-" # regexp: packages to skip by their contents blacklist_pkg_contents="^/lib/udev/devices/" rpmrebuild-arepo-3.1.5/rpmrebuild-arepo.spec000064400000000000000000000045631231303475000211220ustar00rootroot00000000000000Name: rpmrebuild-arepo Version: 3.1.5 Release: alt1 Summary: biarch repackager for Sisyphus packages License: GPL Group: Development/Other BuildArch: noarch Source: %name-%version.tar Requires: rpmrebuild Requires: rpm >= 4.0.4-alt100.48 %description Arepo repackages i586 files (mostly libraries) in i586-* packages suitable for installation on an x86_64 system. Installing these packages allows you to emulate a biarch environment. %package scripts Group: Development/Other Summary: Helper scripts for %name biarch repackager %description scripts Helper scripts for %name biarch repackager %prep %setup %install mkdir -p %buildroot%_bindir install -m755 arepo_pre.py %buildroot%_bindir/ mkdir -p %buildroot%_sysconfdir install -m644 rpmrebuild-arepo.conf %buildroot%_sysconfdir mkdir -p %buildroot%_libexecdir/rpmrebuild/plugins/ install -m644 arepo.plug %buildroot%_libexecdir/rpmrebuild/plugins/ install -m755 arepo.sh %buildroot%_libexecdir/rpmrebuild/plugins/ %files %config(noreplace) %_sysconfdir/rpmrebuild-arepo.conf %_libexecdir/rpmrebuild/plugins/arepo.* %files scripts %_bindir/arepo_pre.py %changelog * Fri Mar 21 2014 Gleb F-Malinovskiy 3.1.5-alt1 - rpmrebuild-arepo.conf: added /usr/lib/gdk-pixbuf-[[:digit:].]+/ to lib_files. - arepo.sh: added *.so(*)* to provides_filter whitelist (e.g. "libnss3.so(NSS_3.14.3)"). * Thu Nov 08 2012 Dmitry V. Levin 3.1.4-alt1 - rpmrebuild-arepo.conf: added /usr/lib/pango/ to lib_files. - arepo.sh: changed scripts filtering in 'lib' mode to copy scripts when they differ between native and compat packages. * Wed Jun 13 2012 Vitaly Kuznetsov 3.1.3-alt1 - arepo_pre.py, arepo.sh: filter out %%ghost files in 'lib' mode * Tue Apr 24 2012 Dmitry V. Levin 3.1.2-alt1 - rpmrebuild-arepo.conf: added /etc/X11/lib to lib_files. - arepo_pre.py: changed output format to match $repo/files/list/arepo-x86_64-i586.list better. * Mon Apr 02 2012 Dmitry V. Levin 3.1.1-alt1 - rpmrebuild-arepo.conf: fixed lib_files. * Mon Apr 02 2012 Dmitry V. Levin 3.1-alt1 - rpmrebuild-arepo.conf: stuffed up lib_files. * Sun Apr 01 2012 Dmitry V. Levin 3.0-alt1 - Changed arepo.sh interface. - Fixed default blacklist_pkg_name regexp. - Optimized regexps. * Fri Mar 02 2012 Vitaly Kuznetsov 2.0-alt1 - initial