Пример #1
0
def import_packages():
  for root, dirs, files in os.walk('cache'):
    for file_name in files:
      file_path = os.path.join(root, file_name)
      if not file_path.endswith('.deb'):
	continue
      watchcmd.run('reprepro -V -b repro includedeb osdv %s' % file_path)
Пример #2
0
def configure_sources():
  sources_file = open('%s/etc/apt/sources.list' % chroot_dir)
  for line in sources_file.readlines():
    if line.startswith('deb-src'):
      return
  sources_file.close()
  source_file = open('%s/etc/apt/sources.list' % chroot_dir, 'a')
  source_file.write("\ndeb-src http://ftp.debian.org/debian lenny main contrib non-free\n")
  source_file.close()
  watchcmd.run("chroot %s apt-get update" % chroot_dir)
Пример #3
0
  def run(self, name, command, dir_name = None, ignore_result = False):
    if not os.path.exists('state'):
      os.mkdir('state')
    name = name.replace('/', '_')
    stamp_file_name = 'state/.%s-done' % name
    if os.path.exists(stamp_file_name):
      return
    if dir_name is not None:
      if os.path.exists(dir_name):
	watchcmd.run('sudo rm -rf %s' % dir_name)
    watchcmd.run(command, ignore_result)
    file = open(stamp_file_name, 'w')
    file.close()
Пример #4
0
def build_packages():
  watchcmd.run("chroot %s apt-get update" % chroot_dir)
  watchcmd.run("chroot %s apt-get -y install apt-utils" % chroot_dir)
  watchcmd.run("chroot %s apt-get -y install build-essential" % chroot_dir)
  watchcmd.run("chroot %s apt-get -y install dpkg-dev" % chroot_dir)
  watchcmd.run("chroot %s apt-get -y install fakeroot" % chroot_dir)
  watchcmd.run("chroot %s apt-get -y install python-minimal" % chroot_dir)
  watchcmd.run("chroot %s apt-get -y install squashfs-tools" % chroot_dir)
  watchcmd.run("reprepro -V -b repro includedeb osdv build-chroot/var/cache/apt/archives/squashfs-tools_1%3a3.3-7_i386.deb")
  watchcmd.run("chroot %s apt-get -y install genisoimage" % chroot_dir)
  watchcmd.run("reprepro -V -b repro includedeb osdv build-chroot/var/cache/apt/archives/genisoimage_9%3a1.1.9-1_i386.deb")
Пример #5
0
def restore_packages():
  apt_archive_dir = '%s/var/cache/apt/archives' % (chroot_dir)
  if not os.path.exists(apt_archive_dir):
    os.makedirs(apt_archive_dir)
  watchcmd.run('cp cache/packages_bootstrap/*.deb %s/var/cache/apt/archives' % (chroot_dir))
Пример #6
0
def cache_packages():
  if os.path.exists('cache/packages_bootstrap'):
    watchcmd.run('rm -rf cache/packages_bootstrap')
  os.makedirs('cache/packages_bootstrap')
  watchcmd.run('cp %s/var/cache/apt/archives/*.deb cache/packages_bootstrap' % (chroot_dir))
Пример #7
0
def build_package(package_name):
  watchcmd.run('chroot %s python -u /tmp/build-package.py %s' % (chroot_dir, package_name))
Пример #8
0
  watchcmd.run("chroot %s apt-get -y install fakeroot" % chroot_dir)
  watchcmd.run("chroot %s apt-get -y install python-minimal" % chroot_dir)
  watchcmd.run("chroot %s apt-get -y install squashfs-tools" % chroot_dir)
  watchcmd.run("reprepro -V -b repro includedeb osdv build-chroot/var/cache/apt/archives/squashfs-tools_1%3a3.3-7_i386.deb")
  watchcmd.run("chroot %s apt-get -y install genisoimage" % chroot_dir)
  watchcmd.run("reprepro -V -b repro includedeb osdv build-chroot/var/cache/apt/archives/genisoimage_9%3a1.1.9-1_i386.deb")


package_name = None
if len(sys.argv) > 1:
  package_name = sys.argv[1]

try:
  restore_packages()
  if not os.path.exists('.stage_build_chroot'):
    watchcmd.run('debootstrap --download-only --verbose --variant buildd lenny %s http://ftp.debian.org/debian' % (chroot_dir))
    cache_packages()
    watchcmd.run('debootstrap --verbose --variant buildd lenny %s http://ftp.debian.org/debian' % (chroot_dir))
    build_packages()
    watchcmd.run('touch .stage/build_chroot')
  configure_sources()
  restore_packages()
  manifest_file_name = 'build/manifest'
  manifest_file = open(manifest_file_name)
  for file_name in file_names_to_copy:
    shutil.copyfile(os.path.join(build_base_dir, file_name), os.path.join(ext_chroot_tmp_dir, file_name))
  watchcmd.run('cp -r patches %s' % (ext_chroot_tmp_dir))
  if package_name is None:
    file_names = os.listdir('patches')
    for file_name in file_names:
      package_name = os.path.splitext(file_name)[0]
Пример #9
0
#!/usr/bin/env python

import os
import re
import sys

sys.path.append('build')
import watchcmd

watchcmd.run('cp config/bootstrap.orig config/bootstrap')
pvote_package_dir = '../pvote'
pvote_package_file = os.path.join(pvote_package_dir, 'build/pvote_1.0b-1_all.deb')
if not os.path.exists(pvote_package_file):
  os.chdir(pvote_package_dir)
  watchcmd.run('./build.sh')
  os.chdir('../debian-live')

watchcmd.run('cp %s config/chroot_local-packages' % (pvote_package_file))
watchcmd.run('sudo lh_bootstrap')
watchcmd.run('sudo lh_chroot')

def import_packages():
  for root, dirs, files in os.walk('cache'):
    for file_name in files:
      file_path = os.path.join(root, file_name)
      if not file_path.endswith('.deb'):
	continue
      watchcmd.run('reprepro -V -b repro includedeb osdv %s' % file_path)

import_packages()
Пример #10
0
#!/usr/bin/env python

import os
import select
import subprocess
import sys
import watchcmd

package_name = sys.argv[1]

if not os.path.exists('/tmp/work'):
  os.mkdir('/tmp/work')
os.chdir('/tmp/work')
watchcmd.run('rm -rf %s*' % (package_name))
watchcmd.run('apt-get -y build-dep %s' % (package_name))
watchcmd.run('apt-get -y source %s' % (package_name))
file_names = os.listdir('/tmp/work')
for file_name in file_names:
  if os.path.isdir(file_name) and file_name.startswith(package_name):
    source_dir_name = file_name
os.chdir(source_dir_name)
print os.getcwd()
patch_file_name = '/tmp/patches/%s.patch' % (package_name)
if os.path.exists(patch_file_name):
  watchcmd.run('patch -p0 < %s' % (patch_file_name))
watchcmd.run('dpkg-buildpackage -rfakeroot')