Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:RedDwarf:fakePackman
fakePackman
packman2obs.sh
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File packman2obs.sh of Package fakePackman
#!/bin/bash # Not sure if it requires BASH, hardcoded just in case. DATE='20010101' # For the changelog date export LC_ALL=C for DISTRO in $@; do # I create different tars for 32 and 64 bits just in case their symbol tables are different for ARCH in i586 x86_64; do # Data is obtained from the -devel package, that is supposed to be unique RPM_FILE=$(ls $DISTRO/*devel*.$ARCH.rpm) NAME=$(rpm -qp --qf '%{NAME}' $RPM_FILE) RELEASE=$(rpm -qp --qf '%{RELEASE}' $RPM_FILE) TEMPDIR=$(mktemp -d) # In cases like ffmpeg the real libraries are splitted in multiple packages so I accept any RPM, probably a check would be needed for RPM in $DISTRO/*.$ARCH.rpm; do rpm2cpio $RPM | (cd $TEMPDIR; cpio -idm 2>/dev/null) || { echo "unpack failed: $?"; exit 2; } done # I don't need docs for FILE in $(rpm -qpd $RPM_FILE); do rm -rf $TEMPDIR$FILE done # .a files contain the code and must be deleted, and I don't like .la ones ;-) find $TEMPDIR ! -type d -a \( -name '*.a' -o -name '*.la' \) -delete find $TEMPDIR -empty -delete for LIBRARY in $(find $TEMPDIR -type f -name '*.so*' | sort); do # I only want symbols from the dynamic table strip "$LIBRARY" # Generate source from library ../gensyms.pl "$LIBRARY" -o "$LIBRARY.c" -v "$LIBRARY.v" # Also need the soname readelf -d "$LIBRARY" | fgrep SONAME | sed 's/.*\[\(.*\)\]/\1/' > $LIBRARY.soname rm -f "$LIBRARY" # For the Makefile $LIBRARY path must be relative LIBRARY=$(echo $LIBRARY | sed "s:$TEMPDIR/::") if [ -e "$TEMPDIR/$LIBRARY.v" ]; then printf "$LIBRARY : $LIBRARY.c\n\tcc \$(CFLAGS) -shared -fpic -Wl,-soname=\`cat \$@.soname\` -Wl,--version-script="$LIBRARY".v -o \$@ \$<\n\trm -f $LIBRARY.c $LIBRARY.v $LIBRARY.soname\n\n" >> $TEMPDIR/Makefile.temp else printf "$LIBRARY : $LIBRARY.c\n\tcc \$(CFLAGS) -shared -fpic -Wl,-soname=\`cat \$@.soname\` -o \$@ \$<\n\trm -f $LIBRARY.c $LIBRARY.soname\n\n" >> $TEMPDIR/Makefile.temp fi done # I need an "all" rule awk 'BEGIN {printf "all : "} /^[^\t]/ {printf $1" "} END {printf "\n\n"}' $TEMPDIR/Makefile.temp > $TEMPDIR/Makefile.pmet cat $TEMPDIR/Makefile.pmet $TEMPDIR/Makefile.temp > $TEMPDIR/Makefile rm -f $TEMPDIR/Makefile.{temp,pmet} tar cjf "$NAME-$ARCH-$DISTRO.tar.bz2" --owner root --group root --mtime="$DATE" -C $TEMPDIR . touch -d "$DATE" "$NAME-$ARCH-$DISTRO.tar.bz2" echo "$NAME-$ARCH-$DISTRO.tar.bz2 done" rm -rf $TEMPDIR done # The stupid data is because of build-compare echo "Name: $NAME URL: http://build.opensuse.org/ License: Contact author Group: Development/Libraries Version: $DATE Release: 1 Summary: Fake $NAME %ifarch i586 Source0: http://build.opensuse.org/$NAME-i586-$DISTRO.tar.bz2 %else %ifarch x86_64 Source0: http://build.opensuse.org/$NAME-x86_64-$DISTRO.tar.bz2 %endif BuildRequires: pkg-config" > $NAME-$DISTRO.spec PATCHNUM=0 for PATCH in *.patch; do [ -f $PATCH ] && echo "Patch$((PATCHNUM++)): $PATCH" >> $NAME-$DISTRO.spec done echo " %description $NAME This version is modified to remove any real code. %prep %setup -qc" >> $NAME-$DISTRO.spec PATCHNUM=0 for PATCH in *.patch; do [ -f $PATCH ] && echo "%patch$((PATCHNUM++))" >> $NAME-$DISTRO.spec done echo " %build %{__make} CFLAGS=\"\$RPM_OPT_FLAGS\" %{?jobs:-j%jobs} %install cp -a * %{buildroot} rm -f %{buildroot}/Makefile find %{buildroot} -name '*.orig' -delete # Every file minus those already available in the filesystem package rpm -ql filesystem > .filesystemlist find %{buildroot} -mindepth 1 | sed 's:%{buildroot}::' > .rpmlist sort .rpmlist .filesystemlist | uniq -d > .duplist sort .rpmlist .duplist | uniq -u > %{name}.files %{__rm} -f .filesystemlist .duplist .rpmlist %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files -f %{name}.files %defattr(-, root, root, 0755) %changelog $(echo "* $(date -d "$DATE" '+%a %b %d %Y') Me") - converted by packman2obs.sh from Packman version" >> $NAME-$DISTRO.spec touch -d "$DATE" $NAME-$DISTRO.spec echo "$NAME-${DISTRO}.spec done." done
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor