checking in more of the rpm build system (is that it?)
authorivan <ivan>
Thu, 8 Jul 2010 09:32:14 +0000 (09:32 +0000)
committerivan <ivan>
Thu, 8 Jul 2010 09:32:14 +0000 (09:32 +0000)
17 files changed:
rpm/build/BOOTSTRAP [new file with mode: 0644]
rpm/build/build-freeside
rpm/build/buildsysrc [new file with mode: 0755]
rpm/build/cvs-check-and-build
rpm/build/mock/centos-5-i386.cfg [new file with mode: 0644]
rpm/build/mock/centos-5-x86_64.cfg [new file with mode: 0644]
rpm/build/mock/defaults.cfg [new file with mode: 0644]
rpm/build/mock/logging.ini [new file with mode: 0644]
rpm/build/mock/site-defaults.cfg [new file with mode: 0644]
rpm/build/mock/sles-10-i386.cfg [new file with mode: 0644]
rpm/build/mock/sles-10-x86_64.cfg [new file with mode: 0644]
rpm/build/native/Ovid.diff [new file with mode: 0644]
rpm/build/native/build-from-cvs [new file with mode: 0755]
rpm/build/native/freeside-cvs [new file with mode: 0755]
rpm/build/native/makesrpm [new file with mode: 0755]
rpm/build/native/ovid-0.12-1.x86_64.rpm [new file with mode: 0644]
rpm/build/native/ovid2flute [new file with mode: 0755]

diff --git a/rpm/build/BOOTSTRAP b/rpm/build/BOOTSTRAP
new file mode 100644 (file)
index 0000000..6fdc196
--- /dev/null
@@ -0,0 +1,116 @@
+# its more notes than a script, so no #!/bin/sh yet
+
+# s/ivan/username/ in buildsysrc and below
+
+
+###
+# host dirs
+###
+
+
+cd
+mkdir public_html
+mkdir mock
+mkdir redhat
+mkdir redhat/SRPMS
+mkdir buildsys
+mkdir buildsys/ref
+mkdir buildsys/ref/SRPMS
+
+cd buildsys
+for a in build-freeside buildsysrc cvs-check-and-build enrpm expect-addsign expect-signrepo ovid2flute refresh-repo; do
+ln -s ~/freeside/rpm/build/$a .
+done
+
+
+###
+# vserver setup
+###
+
+
+#ftp://ftp.pld-linux.org/people/hawk/vserver-templates/Centos
+#sudo vserver centos5 build -m template --context 5 --hostname centos5.freeside.biz --interface dummy0:10.5.4.5/24 -- -d centos5 -t centos5-i686.tar.bz2
+sudo vserver centos5 build -m template --context 5 --hostname centos5.freeside.biz --interface dummy0:10.5.4.5/24 -- -d centos5 -t centos5-x86_64.tar.bz2
+
+#something like this as /etc/init.d/vserver-nat:
+!/bin/sh
+iptables -t nat -F
+iptables -t nat -A POSTROUTING -s 10.5.4.0/24 -d ! 10.5.4.0/24 -j SNAT --to-source 192.168.1.143
+
+vserver centos5 start
+vserver centos5 enter
+#edit /etc/resolv.conf (easier from outside, no vi inside yet)
+
+yum update
+yum install openssh-server vim-minimal zsh screen sudo perl patch cvs diffutils rpm-build rsync
+
+adduser ivan #username
+cd ~ivan #username
+mkdir .ssh
+vi .ssh/authorized_keys
+
+mkdir redhat
+mkdir redhat/BUILD
+mkdir redhat/RPMS
+mkdir redhat/SOURCES
+mkdir redhat/SPECS
+mkdir redhat/SRPMS
+chown -R ivan:ivan redhat
+
+vi ~/.rpmmacros
+%_topdir /home/ivan/redhat
+%_signature gpg
+%_gpg_path /home/ivan/.gnupg
+%_gpg_name Freeside Internet Services, Inc. RPM Signing Key
+
+vi /etc/ssh/sshd_config #ListenAddress
+#also need to edit on the host so the vserver can claim its address
+
+vi /etc/pam.d/sshd
+#comment out:
+#session    required     pam_loginuid.so
+
+/etc/init.d/sshd restart
+
+vi /etc/sudoers
+
+exit #and test ssh'ing in
+
+###
+# more...
+###
+
+#copy the stuff from rpm/build/native into /home/ivan (#username) in the vserver
+cd rpm/build/native
+for a in build-from-cvs freeside-cvs makesrpm ovid2flute ovid-0.12-1.x86_64.rpm Ovid.diff; do
+  cp $a /var/lib/vservers/centos5/home/ivan/
+done
+
+for a in build-from-cvs freeside-cvs makesrpm ovid2flute; do
+  chmod a+rx /var/lib/vservers/centos5/home/ivan/$a
+done
+
+vserver centos5 enter #or ssh 10.5.4.5 and sudo
+
+rpm -i ovid-0.12-1.x86_64.rpm
+cd /usr/lib/perl5/site_perl/5.*/Ovid
+patch < ~ivan/Ovid.diff
+
+#also checkout the necessary freeside versions...
+export CVSROOT=":pserver:anonymous:anonymous@cvs.freeside.biz:/home/cvs/cvsroot"
+
+cvs checkout -rFREESIDE_1_7_BRANCH -d freeside-1.7 freeside
+#cvs checkout -rFREESIDE_1_9_BRANCH -d freeside-1.9 freeside
+
+###
+# yet more
+###
+
+cp expect-* /usr/local/bin/
+#edit them and set your real passphrase for the gpg key you're using
+
+###
+# references
+###
+
+http://www.freeside.biz/mediawiki/index.php/Freeside:Documentation:CreatingRPMRepo
index 8ea0392..f4c6ca7 100755 (executable)
@@ -17,14 +17,30 @@ CENTOSVERS='5'
 SLESVERS=10
 WHICHVERS=
 ARCHS='i386 x86_64'
-MOCKARGS='--autocache'
 
 BUILDSYSDIR=`dirname $0`
 
+#MOCKARGS='--autocache'
+MOCKARGS="--configdir=$BUILDSYSDIR/mock"
+
+
+if [ -f $BUILDSYSDIR/buildsysrc ]; then
+        #chmod a+x $BUILDSYSDIR/buildsysrc
+       #echo $BUILDSYSDIR/buildsysrc
+       . $BUILDSYSDIR/buildsysrc
+fi
+
 if [ -f $HOME/buildsysrc ]; then
+        #chmod a+x $HOME/buildsysrc
+       #echo $HOME/buildsysrc
        . $HOME/buildsysrc
 fi
 
+EXPECT_ADDSIGN=$BUILDSYSDIR/expect-addsign
+if [ -f /usr/local/bin/expect-addsign ]; then
+   EXPECT_ADDSIGN=/usr/local/bin/expect-addsign
+fi
+
 usage() {
        echo "build-freeside: build RPMs for all target distros and architectures using mock"
        echo "where:"
@@ -72,7 +88,8 @@ do
 done
 
 if [ "${SRCFOLDER}x" = "x" ]; then
-       echo "No source folder defined!"
+        PWD=`pwd`
+       echo "No source folder defined! (BUILDSYSDIR=$BUILDSYSDIR pwd=$PWD)"
        exit
 fi
 
@@ -120,6 +137,7 @@ do
                        for arch in $ARCHS
                        do
                                echo "$os - $arch: $srpm"
+                               echo mock $MOCKARGS -r ${os}-${arch} $REFFOLDER/${srpm}
                                time mock $MOCKARGS -r ${os}-${arch} $REFFOLDER/${srpm}
                                if [ -f /var/lib/mock/${os}-${arch}/state/status ] && grep done /var/lib/mock/${os}-${arch}/state/status
                                then
@@ -137,7 +155,7 @@ do
                                                then
                                                        for FILE in $FILES
                                                        do
-                                                               $BUILDSYSDIR/expect-addsign $FILE
+                                                               $EXPECT_ADDSIGN $FILE
                                                        done
                                                        if [ "${REPOMACHINE}x" != "x" ]
                                                        then
@@ -153,7 +171,7 @@ do
                                                then
                                                        for FILE in $FILES
                                                        do
-                                                               $BUILDSYSDIR/expect-addsign $FILE
+                                                               $EXPECT_ADDSIGN $FILE
                                                        done
                                                        if [ "${REPOMACHINE}x" != "x" ]
                                                        then
diff --git a/rpm/build/buildsysrc b/rpm/build/buildsysrc
new file mode 100755 (executable)
index 0000000..0161f1d
--- /dev/null
@@ -0,0 +1,14 @@
+# Define shell variables for the Freeside RPM build system
+#
+
+SRCFOLDER=ivan@10.5.4.5:/home/ivan/redhat/SRPMS
+REFFOLDER=$HOME/buildsys/ref/SRPMS
+#ARCHS='i386 x86_64'
+REPOFOLDER=/home/ivan/public_html
+REPOBASEFOLDER=/home/ivan/public_html
+KEYID=rpm
+
+VERSIONS='1.7'
+DISTROS='centos'
+CENTOSVERS='5'
+ARCHS='x86_64'
index b5e94b7..dbd300a 100755 (executable)
@@ -36,6 +36,9 @@ do
         esac
 done
 
-ssh 10.5.4.5 /home/rsiddall/build-from-cvs $FORCE_FLAG
-cd /home/rsiddall/buildsys; ./build-freeside; ./refresh-repo $QUIET_FLAG
+#ssh 10.5.4.5 /home/rsiddall/build-from-cvs $FORCE_FLAG
+#cd /home/rsiddall/buildsys; ./build-freeside; ./refresh-repo $QUIET_FLAG
+
+ssh 10.5.4.5 ./build-from-cvs $FORCE_FLAG
+cd ~/buildsys; ./build-freeside; ./refresh-repo $QUIET_FLAG
 
diff --git a/rpm/build/mock/centos-5-i386.cfg b/rpm/build/mock/centos-5-i386.cfg
new file mode 100644 (file)
index 0000000..c2deb1f
--- /dev/null
@@ -0,0 +1,58 @@
+#!/usr/bin/python -tt
+import os
+config_opts['root'] = 'centos-5-i386'
+config_opts['target_arch'] = 'i386'
+
+
+config_opts['yum.conf'] = """
+[main]
+cachedir=/var/cache/yum
+debuglevel=1
+logfile=/var/log/yum.log
+reposdir=/dev/null
+retries=20
+obsoletes=1
+gpgcheck=0
+assumeyes=1
+
+# repos
+
+[os]
+name=os
+#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=i386&repo=os
+#baseurl=http://mirror.centos.org/centos/5/os/i386/
+baseurl=file:///home/rsiddall/mock/repos/centos/5/os/i386/
+
+[updates]
+name=updates
+#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=i386&repo=updates
+#baseurl=http://mirror.centos.org/centos/5/updates/i386/
+baseurl=file:///home/rsiddall/mock/repos/centos/5/updates/i386/
+
+[groups]
+name=groups
+baseurl=http://dev.centos.org/centos/buildsys/5/
+
+"""
+
+config_opts['macros'] = """
+%_topdir /builddir/build
+%_rpmfilename  %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
+
+# Change the next two lines to reflect yourself.
+
+%packager  Freeside Internet Services, Inc. <rpm@freeside.biz>
+#%vendor   
+#%distribution 
+
+# please change this to reflect the Distro Tree and Repo hosting packages!
+#%dist    <distro>.<yourtag> 
+%centos_ver     5
+
+#%_smp_mflags   -j1
+
+"""
+
+
+
+
diff --git a/rpm/build/mock/centos-5-x86_64.cfg b/rpm/build/mock/centos-5-x86_64.cfg
new file mode 100644 (file)
index 0000000..448edc6
--- /dev/null
@@ -0,0 +1,57 @@
+#!/usr/bin/python -tt
+import os
+
+config_opts['root'] = 'centos-5-x86_64'
+config_opts['target_arch'] = 'x86_64'
+
+
+config_opts['yum.conf'] = """
+[main]
+cachedir=/var/cache/yum
+debuglevel=1
+reposdir=/dev/null
+logfile=/var/log/yum.log
+retries=20
+obsoletes=1
+gpgcheck=0
+assumeyes=1
+exclude=[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefhijklmnopqrstuvwxyz]*.i*86 g[abcdefghijkmnopqrstuvwxyz]*.i?86 glib2.i?86 glib.i?86 *-devel.i?86
+# repos
+
+[os]
+name=os
+#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=os
+#baseurl=http://mirror.centos.org/centos/5/os/x86_64/
+baseurl=file:///home/rsiddall/mock/repos/centos/5/os/x86_64/
+
+[updates]
+name=updates
+#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=updates
+#baseurl=http://mirror.centos.org/centos/5/updates/x86_64/
+baseurl=file:///home/rsiddall/mock/repos/centos/5/updates/x86_64/
+
+[groups]
+name=groups
+baseurl=http://dev.centos.org/centos/buildsys/5/
+"""
+
+
+config_opts['macros'] = """
+%_topdir /builddir/build
+%_rpmfilename  %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
+
+# Change the next two lines to reflect yourself.
+
+%packager  Freeside Internet Services, Inc. <rpm@freeside.biz>
+#%vendor   
+#%distribution 
+
+# please change this to reflect the Distro Tree and Repo hosting packages!
+#%dist    <distro>.<yourtag> 
+%centos_ver     5
+
+#%_smp_mflags   -j1
+
+"""
+
+
diff --git a/rpm/build/mock/defaults.cfg b/rpm/build/mock/defaults.cfg
new file mode 100644 (file)
index 0000000..3f9fcf6
--- /dev/null
@@ -0,0 +1,39 @@
+# mock defaults
+#
+# Define default values here.
+# These values are overwritten in the /etc/mock/CHROOT.cfg files.
+#
+# Example:
+#
+# config_opts['foo'] = bar
+config_opts['basedir'] = '/var/lib/mock/'
+config_opts['chroot'] = '/usr/sbin/mock-helper chroot'
+config_opts['mount'] = '/usr/sbin/mock-helper mount'
+config_opts['umount'] = '/usr/sbin/mock-helper umount'
+config_opts['rm'] = '/usr/sbin/mock-helper rm'
+config_opts['mknod'] = '/usr/sbin/mock-helper mknod'
+config_opts['yum'] = '/usr/sbin/mock-helper yum'
+config_opts['runuser'] = '/sbin/runuser'
+config_opts['chrootuser'] = 'mockbuild'
+config_opts['chrootgroup'] = 'mockbuild'
+config_opts['chrootuid'] = os.geteuid()
+config_opts['chrootgid'] = os.getegid()
+config_opts['chroothome'] = '/builddir'
+config_opts['clean'] = True
+
+# caching related options
+config_opts['rebuild_cache'] = False
+config_opts['use_cache'] = False
+config_opts['pack_cmd'] = "/usr/sbin/mock-helper pack"
+config_opts['unpack_cmd'] = "/usr/sbin/mock-helper unpack"
+config_opts['cache_ext'] = ".tar.gz"
+config_opts['cache_topdir'] = "root-cache"
+config_opts['max_cache_age_days'] = 15
+
+# allow some network tests to run under the chroot
+config_opts['files']['/etc/resolv.conf'] = open("/etc/resolv.conf","r").read()
+config_opts['files']['/etc/hosts'] = open("/etc/hosts","r").read()
+
+config_opts['chroot_setup_cmd'] = 'install buildsys-build'
+#config_opts['chroot_setup_cmd'] = 'groupinstall build'
+
diff --git a/rpm/build/mock/logging.ini b/rpm/build/mock/logging.ini
new file mode 100644 (file)
index 0000000..fadc6a8
--- /dev/null
@@ -0,0 +1,84 @@
+[formatters]
+keys: detailed,simple,unadorned,state
+[handlers]
+keys: simple_console,detailed_console,unadorned_console,simple_console_warnings_only
+[loggers]
+keys: root,build,state,mock
+[formatter_state]
+format: %(asctime)s - %(message)s
+
+[formatter_unadorned]
+format: %(message)s
+[formatter_simple]
+format: %(levelname)s: %(message)s
+;useful for debugging:
+[formatter_detailed]
+format: %(levelname)s %(filename)s:%(lineno)d:  %(message)s
+[handler_unadorned_console]
+class: StreamHandler
+args: []
+formatter: unadorned
+level: INFO
+
+[handler_simple_console]
+class: StreamHandler
+args: []
+formatter: simple
+level: INFO
+
+[handler_simple_console_warnings_only]
+class: StreamHandler
+args: []
+formatter: simple
+level: WARNING
+
+[handler_detailed_console]
+class: StreamHandler
+args: []
+formatter: detailed
+level: WARNING
+
+; usually dont want to set a level for loggers
+; this way all handlers get all messages, and messages can be filtered
+; at the handler level
+;
+; all these loggers default to a console output handler
+; 
+[logger_root]
+level: NOTSET
+handlers: simple_console
+
+; mock logger normally has no output
+;  catches stuff like mock.trace_decorator and mock.util
+;  dont normally want to propagate to root logger, either
+[logger_mock]
+level: NOTSET
+handlers: 
+qualname: mock
+propagate: 1
+
+[logger_state]
+level: NOTSET
+; unadorned_console only outputs INFO or above
+handlers: unadorned_console
+qualname: mock.Root.state
+propagate: 0
+
+[logger_build]
+level: NOTSET
+handlers: simple_console_warnings_only
+qualname: mock.Root.build
+propagate: 0
+
+; the following is a list mock logger qualnames used within the code:
+; 
+;  qualname: mock.util
+;  qualname: mock.uid
+;  qualname: mock.trace_decorator
+
diff --git a/rpm/build/mock/site-defaults.cfg b/rpm/build/mock/site-defaults.cfg
new file mode 100644 (file)
index 0000000..0ee2082
--- /dev/null
@@ -0,0 +1,98 @@
+# mock defaults
+# vim:tw=0:ts=4:sw=4:et:
+#
+# This config file is for site-specific default values that apply across all
+# configurations. Options specified in this config file can be overridden in
+# the individual mock config files.
+#
+# The defaults.cfg delivered by default has NO options set. Only set options
+# here if you want to override the defaults.
+#
+# Entries in this file follow the same format as other mock config files.
+# config_opts['foo'] = bar
+
+#############################################################################
+#
+# Things that we recommend you set in defaults.cfg:
+#
+# config_opts['basedir'] = '/var/lib/mock/'
+# config_opts['cache_topdir'] = '/var/cache/mock'
+#  Note: the path pointed to by basedir and cache_topdir must be owned 
+#        by group 'mock' and must have mode: g+rws
+# config_opts['rpmbuild_timeout'] = 0
+# config_opts['use_host_resolv'] = True
+
+# You can configure log format to pull from logging.ini formats of these names:
+# config_opts['build_log_fmt_name'] = "unadorned"
+# config_opts['root_log_fmt_name']  = "detailed"
+# config_opts['state_log_fmt_name'] = "state"
+#
+# mock will normally set up a minimal chroot /dev.
+# If you want to use a pre-configured /dev, disable this and use the bind-mount
+# plugin to mount your special /dev
+# config_opts['internal_dev_setup'] = True
+#
+# internal_setarch defaults to 'True' if the python 'ctypes' package is
+#  available. It is in the python std lib on >= python 2.5. On older versions,
+#  it is available as an addon. On systems w/o ctypes, it will default to
+#  'False'
+# config_opts['internal_setarch'] = False
+#
+# the cleanup_on_* options allow you to automatically clean and remove the
+# mock build directory, but only take effect if --resultdir is used.
+# config_opts provides fine-grained control. cmdline only has big hammer
+#
+# config_opts['cleanup_on_success'] = 1
+# config_opts['cleanup_on_failure'] = 1
+
+#############################################################################
+#
+# plugin related. Below are the defaults. Change to suit your site
+# policy. defaults.cfg is a good place to do this.
+#
+# NOTE: Some of the caching options can theoretically affect build
+#  reproducability. Change with care.
+#
+# config_opts['plugin_conf']['ccache_enable'] = True
+# config_opts['plugin_conf']['ccache_opts']['max_cache_size'] = '4G'
+# config_opts['plugin_conf']['ccache_opts']['dir'] = "%(cache_topdir)s/%(root)s/ccache/"
+# config_opts['plugin_conf']['yum_cache_enable'] = True
+# config_opts['plugin_conf']['yum_cache_opts']['max_age_days'] = 30
+# config_opts['plugin_conf']['yum_cache_opts']['dir'] = "%(cache_topdir)s/%(root)s/yum_cache/"
+# config_opts['plugin_conf']['root_cache_enable'] = True
+# config_opts['plugin_conf']['root_cache_opts']['max_age_days'] = 15
+# config_opts['plugin_conf']['root_cache_opts']['dir'] = "%(cache_topdir)s/%(root)s/root_cache/"
+# config_opts['plugin_conf']['root_cache_opts']['compress_program'] = "gzip"
+# config_opts['plugin_conf']['root_cache_opts']['extension'] = ".gz"
+#
+# bind mount plugin is enabled by default but has no configured directories to mount
+# config_opts['plugin_conf']['bind_mount_enable'] = True
+# config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/host/path', '/bind/mount/path/in/chroot/' ))
+#
+# config_opts['plugin_conf']['tmpfs_enable'] = False
+# config_opts['plugin_conf']['tmpfs_opts'] = {'required_ram_mb': 1024}
+
+#############################################################################
+#
+# Things that you can change, but we dont recommend it:
+# config_opts['chroothome'] = '/builddir'
+# config_opts['clean'] = True
+
+#############################################################################
+#
+# Things that are best suited for individual chroot config files:
+#
+# MUST SET (in individual chroot cfg file):
+# config_opts['root'] = 'name-of-yum-build-dir'
+# config_opts['target_arch'] = 'i386'
+# config_opts['yum.conf'] = ''
+#
+# CAN SET, defaults usually work ok:
+# config_opts['chroot_setup_cmd'] = 'install buildsys-build'
+# config_opts['log_config_file'] = 'logging.ini'
+# config_opts['more_buildreqs']['srpm_name-version-release'] = 'dependencies'
+# config_opts['macros']['Add_your_macro_name_here'] = "add macro value here"
+# config_opts['files']['path/name/no/leading/slash'] = "put file contents here."
+# config_opts['chrootuid'] = os.getuid()
+# config_opts['chrootgid'] = grp.getgrnam("mock")[2]
+# config_opts['useradd'] = '/usr/sbin/useradd -m -u %(uid)s -g %(gid)s -d %(home)s -n %(user)s' # Fedora/RedHat
diff --git a/rpm/build/mock/sles-10-i386.cfg b/rpm/build/mock/sles-10-i386.cfg
new file mode 100644 (file)
index 0000000..ad1a62b
--- /dev/null
@@ -0,0 +1,59 @@
+#!/usr/bin/python -tt
+
+import os
+
+config_opts['root'] = 'sles-10-i386'
+config_opts['basedir'] = '/var/lib/mock/'
+config_opts['chroot'] = '/usr/sbin/mock-helper chroot'
+config_opts['mount'] = '/usr/sbin/mock-helper mount'
+config_opts['umount'] = '/usr/sbin/mock-helper umount'
+config_opts['rm'] = '/usr/sbin/mock-helper rm'
+config_opts['mknod'] = '/usr/sbin/mock-helper mknod'
+config_opts['yum'] = '/usr/sbin/mock-helper yum'
+config_opts['runuser'] = '/bin/su'
+config_opts['chroot_setup_cmd'] = 'groupinstall build build-minimal build-base'
+config_opts['chrootuser'] = 'mockbuild'
+config_opts['chrootgroup'] = 'users'
+config_opts['chrootuid'] = os.geteuid()
+config_opts['chrootgid'] = os.getegid()
+config_opts['chroothome'] = '/builddir'
+config_opts['clean'] = True
+config_opts['target_arch'] = 'i386'
+config_opts['use_cache'] = 1
+
+
+config_opts['yum.conf'] = """
+[main]
+cachedir=/var/cache/yum
+debuglevel=1
+logfile=/var/log/yum.log
+reposdir=/dev/null
+retries=20
+obsoletes=1
+gpgcheck=0
+assumeyes=1
+
+# repos
+
+[base]
+name=base
+#baseurl=http://hb.linuxdev.us.dell.com/pub/yum/sles10/base/i386/
+#baseurl=http://redshank.elirion.net/sles
+baseurl=file:///home/rsiddall/mock/repos/sles10/i386
+
+[build]
+name=build
+#baseurl=http://hb.linuxdev.us.dell.com/pub/yum/sles10/base/i386/
+#baseurl=http://grosbeak.elirion.net/repo/sles/10/build/i386/
+baseurl=file:///home/rsiddall/public_html/repo/sles/10/build/i386
+
+[groups]
+name=groups
+#baseurl=http://hb.linuxdev.us.dell.com/pub/yum/mock/buildgroups/sles10/i386/
+#baseurl=http://redshank.elirion.net/slesgroup/sles10/i386/
+baseurl=file:///home/rsiddall/mock/buildgroups/sles10/i386
+
+"""
+
+
+
diff --git a/rpm/build/mock/sles-10-x86_64.cfg b/rpm/build/mock/sles-10-x86_64.cfg
new file mode 100644 (file)
index 0000000..d55b40a
--- /dev/null
@@ -0,0 +1,59 @@
+#!/usr/bin/python -tt
+
+import os
+
+config_opts['root'] = 'sles-10-x86_64'
+config_opts['basedir'] = '/var/lib/mock/'
+config_opts['chroot'] = '/usr/sbin/mock-helper chroot'
+config_opts['mount'] = '/usr/sbin/mock-helper mount'
+config_opts['umount'] = '/usr/sbin/mock-helper umount'
+config_opts['rm'] = '/usr/sbin/mock-helper rm'
+config_opts['mknod'] = '/usr/sbin/mock-helper mknod'
+config_opts['yum'] = '/usr/sbin/mock-helper yum'
+config_opts['runuser'] = '/bin/su'
+config_opts['chroot_setup_cmd'] = 'groupinstall build build-minimal build-base'
+config_opts['chrootuser'] = 'mockbuild'
+config_opts['chrootgroup'] = 'users'
+config_opts['chrootuid'] = os.geteuid()
+config_opts['chrootgid'] = os.getegid()
+config_opts['chroothome'] = '/builddir'
+config_opts['clean'] = True
+config_opts['target_arch'] = 'x86_64'
+config_opts['use_cache'] = 1
+
+
+config_opts['yum.conf'] = """
+[main]
+cachedir=/var/cache/yum
+debuglevel=1
+logfile=/var/log/yum.log
+reposdir=/dev/null
+retries=20
+obsoletes=1
+gpgcheck=0
+assumeyes=1
+
+# repos
+
+[base]
+name=base
+#baseurl=http://hb.linuxdev.us.dell.com/pub/yum/sles10/base/x86_64/
+#baseurl=http://redshank.elirion.net/sles
+baseurl=file:///home/rsiddall/mock/repos/sles10/x86_64
+
+[build]
+name=build
+#baseurl=http://hb.linuxdev.us.dell.com/pub/yum/sles10/base/x86_64/
+#baseurl=http://grosbeak.elirion.net/repo/sles/10/build/x86_64/
+baseurl=file:///home/rsiddall/public_html/repo/sles/10/build/x86_64
+
+[groups]
+name=groups
+#baseurl=http://hb.linuxdev.us.dell.com/pub/yum/mock/buildgroups/sles10/x86_64/
+#baseurl=http://redshank.elirion.net/slesgroup/sles10/x86_64/
+baseurl=file:///home/rsiddall/mock/buildgroups/sles10/x86_64
+
+"""
+
+
+
diff --git a/rpm/build/native/Ovid.diff b/rpm/build/native/Ovid.diff
new file mode 100644 (file)
index 0000000..81db7c5
--- /dev/null
@@ -0,0 +1,30 @@
+--- Package.pm.orig     2007-05-25 09:54:14.000000000 -0400
++++ Package.pm  2007-07-07 15:35:20.000000000 -0400
+@@ -165,6 +165,7 @@
+     push @out, $self->provreq($n);
+   }
++  return join("\n", map { "Provides: $_"; } @out) if scalar(@out) > 5;
+   return join('', 'Provides: ', join ' ', @out);
+ }
+@@ -376,10 +377,15 @@
+ %install
+-make PREFIX=%{_prefix} \
+-     DESTDIR=%{buildroot} \
+-     INSTALLDIRS=@installdirs@ \
+-     install
++if [ -f Build.PL -a -f Build ] ; then
++     ./Build destdir=%{buildroot} \
++          install
++else
++     make PREFIX=%{_prefix} \
++          DESTDIR=%{buildroot} \
++          INSTALLDIRS=@installdirs@ \
++          install
++fi
+ [ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress
+
diff --git a/rpm/build/native/build-from-cvs b/rpm/build/native/build-from-cvs
new file mode 100755 (executable)
index 0000000..aa1319b
--- /dev/null
@@ -0,0 +1,75 @@
+#!/bin/sh
+#
+# Copyright 2008, Elirion, Inc.  All rights reserved.
+# This software is licensed under the same terms as Freeside itself.
+#
+# This script builds SRPMs if the Freeside CVS contents have changed.
+# It must have reference copies of the Freeside versions it builds.
+# Each SRPM's "release" is set to the date & time the script is run.
+# The version number is forced to the CVS version.  The version and release
+# hard-coded in the last .spec file committed to CVS are NOT used.
+#
+source $HOME/freeside-cvs
+RELEASE=`date +%Y%m%d%H%M%S`
+QUIET_FLAG=
+#FORCE_FLAG=0
+FORCE_FLAG=1
+#VERSIONS='1.7 1.9'
+VERSIONS='1.7'
+
+while getopts "fhqv:" flag
+do
+        case $flag in
+               f)
+                       echo "Force mode"
+                       FORCE_FLAG=1;;
+               q)
+                       echo "Quiet mode"
+                       QUIET_FLAG=-q;;
+               v)
+                       echo "Changing versions from $VERSIONS to $OPTARG"
+                       VERSIONS=$OPTARG;;
+               *)
+                       usage;;
+        esac
+done
+
+usage() {
+       echo "build-from-cvs: build SRPMs if the Freeside CVS contents have changed"
+       echo "where:"
+       echo " -f: force building SRPMs even if CVS is unchanged"
+       echo " -h: print this usage information"
+       echo " -q: run quietly"
+       echo " -v <versions>: change versions (currently: $VERSIONS)"
+       exit 0
+}
+
+for VERSION in $VERSIONS; do
+       echo ${VERSION}
+       /bin/rm -rf ref-${VERSION}
+       cp -pr freeside-${VERSION} ref-${VERSION}
+       cd freeside-${VERSION}
+       cvs update -d -P
+       cd ..
+       diff -qr --exclude=CVS freeside-${VERSION} ref-${VERSION}
+       RETVAL=$?
+       if [ $FORCE_FLAG = 1 -o $RETVAL -gt 0 ]; then
+               # Build the tarball with the modified .spec file in it, hard-coding the release into the .spec file
+               cd freeside-${VERSION}
+               for SPECFILE in install/rpm/freeside.spec rpm/freeside.spec; do
+               if [ -f $SPECFILE ]; then
+                       cp -pf $SPECFILE ..
+                       perl -p -i -e "s/\d+[^\}]+/${VERSION}/ if /%define\s+version\s+(\d+[^\}]+)\}/;" ${SPECFILE}
+                       perl -pi -e "s/\$1/${RELEASE}/ if /%define\s+release\s+(\d+)/;" $SPECFILE
+                       tar zcvf $HOME/redhat/SOURCES/freeside-${VERSION}.tar.gz --exclude CVS ../freeside-${VERSION}
+                       mv -f ../`basename $SPECFILE` `dirname $SPECFILE`
+               fi
+               done
+               cd ..
+               rpmbuild -ts $HOME/redhat/SOURCES/freeside-${VERSION}.tar.gz
+               # Could do a koji-build here
+               # Or move the SRPM to a staging directory for the build machine to check
+               # Should make the Bundles and check the dependencies for changes
+       fi
+       /bin/rm -rf ref-${VERSION}
+done
diff --git a/rpm/build/native/freeside-cvs b/rpm/build/native/freeside-cvs
new file mode 100755 (executable)
index 0000000..88d12b4
--- /dev/null
@@ -0,0 +1,2 @@
+export CVSROOT=":pserver:anonymous:anonymous@cvs.freeside.biz:/home/cvs/cvsroot"
+export CVS_RSH="ssh"
diff --git a/rpm/build/native/makesrpm b/rpm/build/native/makesrpm
new file mode 100755 (executable)
index 0000000..fc9703e
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+cpanflute2 --just-spec --noperlreqs --email='Ivan Kohler <ivan@freeside.biz>' --release=1  /home/rsiddall/Business-OnlinePayment-Jety-0.06.tar.gz > /home/rsiddall/redhat/SPECS/Business-OnlinePayment-Jety.spec;
+perl -pi -e 's/perl(perl)/perl/g' /home/rsiddall/redhat/SPECS/Business-OnlinePayment-Jety.spec
+rpmbuild -bs --nodeps --define '_sourcedir /home/rsiddall/' --define '_srcrpmdir /home/rsiddall/redhat/SRPMS' /home/rsiddall/redhat/SPECS/Business-OnlinePayment-Jety.spec
diff --git a/rpm/build/native/ovid-0.12-1.x86_64.rpm b/rpm/build/native/ovid-0.12-1.x86_64.rpm
new file mode 100644 (file)
index 0000000..363e089
Binary files /dev/null and b/rpm/build/native/ovid-0.12-1.x86_64.rpm differ
diff --git a/rpm/build/native/ovid2flute b/rpm/build/native/ovid2flute
new file mode 100755 (executable)
index 0000000..5e26711
--- /dev/null
@@ -0,0 +1,141 @@
+#!/usr/bin/perl -w
+#
+# Convert the output from ovid --deps into a list of modules to run through cpanflute2 to get
+# better .spec files, and generate SRPMs from these.
+
+use strict;
+use Getopt::Long;
+
+# Need to fix up modules where Ovid parses the name incorrectly
+my %badparse=(
+       'Crypt-PasswdMD-5' => 'Crypt-PasswdMD5',
+       'IPC-Run-3' => 'IPC-Run3',
+       'Digest-SHA-1' => 'Digest-SHA1',
+       'Digest-MD-4' => 'Digest-MD4',
+);
+
+my %extra_buildreqs=(
+       'File-Rsync' => [ qw/rsync/ ],
+       'MIMETools' => [ qw/perl(Mail::Header) perl(Mail::Internet) perl(Mail::Field) perl(IO::Stringy) perl(File::Temp)/ ],
+       'HTML::Scrubber' => [ qw/perl(HTML::Parser) perl(HTML::Tagset)/ ],
+#      'Time::Duration' => [ qw/perl(Test::Pod) perl(Test::Pod::Coverage)/ ],
+);
+
+my %extra_reqs=(
+       'File-Rsync' => [ qw/rsync/ ],
+);
+
+my %opts;
+
+GetOptions(\%opts, 'packager=s', 'release=s');
+
+$opts{packager} = 'Richard Siddall <richard.siddall@elirion.net>' if !defined($opts{packager});
+
+# Need to process modules that cause Ovid to crash
+#my @extramods= qw/Text::CSV_XS Pod::Simple Crypt::SSLeay/;
+#my @extramods= qw/Crypt::SSLeay/;
+my @extramods= qw/IPC::ShareLite/;
+
+my $specfiledir="/home/rsiddall/work/redhat/SPECS";
+$specfiledir = "/home/rsiddall/redhat/SPECS" if ! -d $specfiledir;
+my $srpmdir="/home/rsiddall/work/redhat/SRPMS";
+$srpmdir = "/home/rsiddall/redhat/SRPMS" if ! -d $srpmdir;
+
+foreach (reverse <STDIN>) {
+       next if !defined($_);
+       #print $_;
+       last if $_ !~ /^([-\w:]+) perl-([-\w\.]+)(-\d+[\w\.]+?)$/;
+       #print "$1 = $2\n"
+       my ($name, $rpm, $ver) = ($1, $2, $3);
+       print "# $name ($rpm - $ver)\n";
+       foreach my $cand (keys %badparse) {
+               if ($rpm =~ /^$cand/) {
+                       $rpm =~ s/^$cand/$badparse{$cand}/;
+                       print "# Fixed up $rpm\n";
+                       last;
+               }
+       }
+       printcmds($name, "$rpm$ver");
+       #print "cpanspec -v --packager 'Unknown <nobody\@example.com>' $name\n";
+       #print "echo $rpm\n";
+       #print "repoquery perl-$rpm\n";
+       #touchsrpms($name, "$rpm$ver");
+}
+
+exit;
+
+foreach my $name (@extramods) {
+       my $rpm = $name;
+       $rpm =~ s/::/-/g;
+       my $tarball = `find ~/.cpan/sources -name '$rpm-*' -print | tail -1`;
+       #print "$name (Extra!)\n"
+       if ($tarball =~ /\/($rpm-.*?)(\.tar\.gz|\.tgz)\s*$/) {
+               $rpm = $1;
+               printcmds($name, $rpm);
+       } else {
+               die "Can't find full rpm name for $name in \"$tarball\"\n";
+       }
+}
+
+sub touchsrpms {
+       my ($name, $rpm) = @_;
+       my $repofolder ="/var/www/html/repo/sles/10/freeside-1.9/stable/x86_64";
+       my $srpmfolder ="/home/rsiddall/work/redhat/SRPMS";
+       my @files = glob "$repofolder/perl-$rpm-*.rpm";
+       if (! scalar(@files)) {
+               print "Can't find $rpm in $repofolder\n";
+               @files = glob "$srpmfolder/perl-$rpm-*.src.rpm\n";
+               if (scalar(@files)) {
+                       my $file = pop @files;
+                       print "touch $file\n";
+               } else {
+                       print STDERR "No corresponding SRPM: $srpmfolder/perl-$rpm-*.src.rpm\n";
+                       printcmds($name, $rpm);
+               }
+       }
+}
+
+sub printcmds {
+       my ($name, $rpm) = @_;
+
+       my $tarball = `find ~/.cpan -name '$rpm.tar.gz' -print`;
+       $tarball = `find ~/.cpan -name '$rpm.tgz' -print` if ! $tarball;
+       chomp($tarball);
+#      my $specfile = "$specfiledir/$name.spec";
+       my $rpmname = $rpm;
+       $rpmname = $1 if $rpm =~ /^(?:.*\/)?(.*)-(?:v\.?)?([^-]+)$/;
+       my $specfile = "$specfiledir/perl-$rpmname.spec";
+       $specfile =~ s/::/-/g;
+       # Work out which version of the SRPM we're going to generate.
+       my $rel;
+       if (!defined($opts{release})) {
+               for ($rel = 1; ; $rel++) {
+                       my $srpm = "$srpmdir/perl-$rpm-$rel.src.rpm";
+                       last if ! -e $srpm;
+                       print "# File exists: $srpm\n";
+               }
+       } else {
+               $rel = $opts{release};
+       }
+       my $fluteopts = "";
+       foreach my $cand (keys %extra_buildreqs) {
+               if ($rpm =~ /^$cand/) {
+                       $fluteopts .= join "", map { "--buildrequires $_ " } @{$extra_buildreqs{$cand}};
+                       last;
+               }
+       }
+       foreach my $cand (keys %extra_reqs) {
+               if ($rpm =~ /^$cand/) {
+                       $fluteopts .= join "", map { "--requires $_ " } @{$extra_reqs{$cand}};
+                       last;
+               }
+       }
+       print "cpanflute2 --just-spec --noperlreqs --email='$opts{packager}' --release=$rel $fluteopts $tarball > $specfile;\n";
+       # Should fix up the .spec file
+       print "perl -pi -e 's/perl\\(perl\\)/perl/g' $specfile;\n";
+       my $tarballdir = `dirname $tarball` or die "Can't find tarball for $name: $tarball\n";
+       chomp($tarballdir);
+       print "rpmbuild -bs --nodeps --define '_sourcedir $tarballdir' --define '_srcrpmdir $srpmdir' $specfile\n";
+       print "# Generates: $srpmdir/perl-$rpm-$rel.src.rpm\n";
+}
+