From 2aef98cb23fd608bd95de67d796243d50c020c35 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Sat, 4 Oct 2008 18:52:23 -1000 Subject: [PATCH] Giant directory of the old scripts. Placed here for reference as to what remains to be done. The orig/ subdir is the unmodified tools from anaconda. The scratch/ subdir is a merge of orig in to a working area. I delete blocks of code from there as I rewrite them. --- rewrite/orig/scripts/buildinstall | 213 ++++ rewrite/orig/scripts/buildinstall.functions | 120 +++ rewrite/orig/scripts/makestamp.py | 90 ++ rewrite/orig/scripts/maketreeinfo.py | 113 ++ rewrite/orig/scripts/mk-images | 965 +++++++++++++++++ rewrite/orig/scripts/mk-images.alpha | 131 +++ rewrite/orig/scripts/mk-images.efi | 199 ++++ rewrite/orig/scripts/mk-images.ia64 | 173 ++++ rewrite/orig/scripts/mk-images.ppc | 171 +++ rewrite/orig/scripts/mk-images.s390 | 53 + rewrite/orig/scripts/mk-images.x86 | 164 +++ rewrite/orig/scripts/scrubtree | 82 ++ rewrite/orig/scripts/upd-instroot | 1030 +++++++++++++++++++ rewrite/orig/utils/Makefile | 99 ++ rewrite/orig/utils/filtermoddeps | 25 + rewrite/orig/utils/geninitrdsz.c | 62 ++ rewrite/orig/utils/genmodinfo | 76 ++ rewrite/orig/utils/mk-s390-cdboot.c | 251 +++++ rewrite/orig/utils/modlist.c | 130 +++ rewrite/orig/utils/trimpciids | 80 ++ rewrite/scratch/buildinstall | 6 + rewrite/scratch/buildinstall.functions | 120 +++ rewrite/scratch/filtermoddeps | 25 + rewrite/scratch/geninitrdsz.c | 62 ++ rewrite/scratch/genmodinfo | 76 ++ rewrite/scratch/mk-images | 940 +++++++++++++++++ rewrite/scratch/mk-images.alpha | 131 +++ rewrite/scratch/mk-images.efi | 199 ++++ rewrite/scratch/mk-images.ia64 | 173 ++++ rewrite/scratch/mk-images.ppc | 171 +++ rewrite/scratch/mk-images.s390 | 53 + rewrite/scratch/mk-images.x86 | 164 +++ rewrite/scratch/mk-s390-cdboot.c | 156 +++ rewrite/scratch/modlist.c | 130 +++ rewrite/scratch/scrubtree | 70 ++ rewrite/scratch/trimpciids | 80 ++ rewrite/scratch/upd-instroot | 266 +++++ rewrite/to_remove_from_anaconda | 20 + 38 files changed, 7069 insertions(+) create mode 100755 rewrite/orig/scripts/buildinstall create mode 100755 rewrite/orig/scripts/buildinstall.functions create mode 100755 rewrite/orig/scripts/makestamp.py create mode 100644 rewrite/orig/scripts/maketreeinfo.py create mode 100755 rewrite/orig/scripts/mk-images create mode 100644 rewrite/orig/scripts/mk-images.alpha create mode 100755 rewrite/orig/scripts/mk-images.efi create mode 100644 rewrite/orig/scripts/mk-images.ia64 create mode 100644 rewrite/orig/scripts/mk-images.ppc create mode 100644 rewrite/orig/scripts/mk-images.s390 create mode 100644 rewrite/orig/scripts/mk-images.x86 create mode 100755 rewrite/orig/scripts/scrubtree create mode 100755 rewrite/orig/scripts/upd-instroot create mode 100644 rewrite/orig/utils/Makefile create mode 100755 rewrite/orig/utils/filtermoddeps create mode 100644 rewrite/orig/utils/geninitrdsz.c create mode 100755 rewrite/orig/utils/genmodinfo create mode 100644 rewrite/orig/utils/mk-s390-cdboot.c create mode 100644 rewrite/orig/utils/modlist.c create mode 100755 rewrite/orig/utils/trimpciids create mode 100755 rewrite/scratch/buildinstall create mode 100755 rewrite/scratch/buildinstall.functions create mode 100755 rewrite/scratch/filtermoddeps create mode 100644 rewrite/scratch/geninitrdsz.c create mode 100755 rewrite/scratch/genmodinfo create mode 100755 rewrite/scratch/mk-images create mode 100644 rewrite/scratch/mk-images.alpha create mode 100755 rewrite/scratch/mk-images.efi create mode 100644 rewrite/scratch/mk-images.ia64 create mode 100644 rewrite/scratch/mk-images.ppc create mode 100644 rewrite/scratch/mk-images.s390 create mode 100644 rewrite/scratch/mk-images.x86 create mode 100644 rewrite/scratch/mk-s390-cdboot.c create mode 100644 rewrite/scratch/modlist.c create mode 100755 rewrite/scratch/scrubtree create mode 100755 rewrite/scratch/trimpciids create mode 100755 rewrite/scratch/upd-instroot create mode 100644 rewrite/to_remove_from_anaconda diff --git a/rewrite/orig/scripts/buildinstall b/rewrite/orig/scripts/buildinstall new file mode 100755 index 00000000..97eaf614 --- /dev/null +++ b/rewrite/orig/scripts/buildinstall @@ -0,0 +1,213 @@ +#!/bin/bash +# +# buildinstall +# +# Copyright (C) 2007 Red Hat, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +usage() { + echo "Usage: buildinstall --version --product --release [--output outputdir] [--discs ] " >&2 + exit 1 +} + +PRODUCTPATH="anaconda" + +while [ $# -gt 0 ]; do + case $1 in + # general options affecting how we build things + --nogr) + NOGRSTR="--nogr" + shift + ;; + --debug) + DEBUGSTR="--debug" + shift + ;; + + # release information + --version) + VERSION=$2 + shift; shift + ;; + --release) + RELEASESTR=$2 + shift; shift + ;; + --product) + PRODUCTSTR=$2 + shift; shift + ;; + --variant) + VARIANT=$2 + shift; shift + ;; + --bugurl) + BUGURL=$2 + shift; shift + ;; + + --output) + OUTPUT=$2 + shift; shift + ;; + --updates) + UPDATES=$2 + shift; shift + ;; + --mirrorlist) + MIRRORLIST="$MIRRORLIST $2" + shift; shift + ;; + + *) + if [ -z "$REPO" ]; then + REPO=$1 + else + EXTRA_REPOS="$EXTRA_REPOS $1" + fi + shift + ;; + esac +done + +if [ -z "$PRODUCTSTR" ]; then + usage +fi + +if [ -z "$VERSION" ]; then + usage +fi + +if [ -z "$REPO" ]; then + usage +fi + +if [ -z "$RELEASESTR" ]; then + usage +fi + +if [ -z "$BUGURL" ]; then + BUGURL="your distribution provided bug reporting tool." +fi + +if [[ "$REPO" =~ ^/ ]]; then + [ -n "$OUTPUT" ] || OUTPUT=$REPO + REPO="file://$REPO" +fi + +if [ -z "$OUTPUT" ]; then + usage +fi + +if [ ! -d "$OUTPUT" ]; then + mkdir -p $OUTPUT +fi + +BUILDINSTDIR=$(mktemp -d ${TMPDIR:-/tmp}/buildinstall.tree.XXXXXX) +TREEDIR=$(mktemp -d ${TMPDIR:-/tmp}/treedir.XXXXXX) +CACHEDIR=$(mktemp -d ${TMPDIR:-/tmp}/yumcache.XXXXXX) + +yumconf=$(mktemp ${TMPDIR:-/tmp}/yum.conf.XXXXXX) +cat > $yumconf <> $yumconf <> $yumconf </dev/null 2>&1 || continue + LDSO=$(echo $ldso |sed -e "s,$root,,") + done + fi + + # I still hate shell. + declare -i n=0 + while read NAME I0 FILE ADDR I1 ; do + [ "$FILE" == "not" ] && FILE="$FILE $ADDR" + NAMES[$n]="$NAME" + FILES[$n]="$FILE" + let n++ + done << EOF + $(/usr/sbin/chroot $root env LD_TRACE_PRELINKING=1 LD_WARN= \ + LD_TRACE_LOADED_OBJECTS=1 $LDSO $bin) +EOF + + [ ${#FILES[*]} -eq 0 ] && return 1 + + # we don't want the name of the binary in the list + if [ "${FILES[0]}" == "$bin" ]; then + FILES[0]="" + NAMES[0]="" + [ ${#FILES[*]} -eq 1 ] && return 1 + fi + + declare -i n=0 + while [ $n -lt ${#FILES[*]} ]; do + FILE="${FILES[$n]}" + if [ "$FILE" == "not found" ]; then + cat 1>&2 <. +# + +import os,sys,string +import getopt +import time + + +def usage(): + args = "" + for key in data: + args = "%s [--%s=%s]" %(args, key, key) + print("%s: %s" % (sys.argv[0], args)) + sys.exit(1) + +data = {"timestamp": None, + "releasestr": None, + "arch": None, + "discNum": None, + "outfile": None} +allDiscs = None + +opts = [] +for key in data.keys(): + opts.append("%s=" % (key,)) +opts.append("allDiscs") + +(args, extra) = getopt.getopt(sys.argv[1:], '', opts) +if len(extra) > 0: + print("had extra args: %s" % extra) + usage() + +for (str, arg) in args: + if str[2:] in data.keys(): + data[str[2:]] = arg + elif str == "--allDiscs": + allDiscs = 1 + else: + print("unknown str of ", str) + usage() + +if data["timestamp"] is None: + sys.stderr.write("timestamp not specified; using the current time\n") + data["timestamp"] = time.time() +else: + data["timestamp"] = float(data["timestamp"]) + +if data["releasestr"] is None: + print("What should be the release name associated with this disc?\n") + data["releasestr"] = sys.stdin.readline()[:-1] + +if data["arch"] is None: + print("What arch is this disc for?") + data["arch"] = sys.stdin.readline()[:-1] + +if data["discNum"] is None and allDiscs is None: + sys.stderr.write("No disc number specified; assuming disc 1\n") + data["discNum"] = "1" + +if data["outfile"] is None: + f = sys.stdout +else: + f = open(data["outfile"], "w") + +f.write("%f\n" % data["timestamp"]) +f.write("%s\n" % data["releasestr"]) +f.write("%s\n" % data["arch"]) +if allDiscs is None: + f.write("%s\n" % data["discNum"]) +else: + f.write("0\n") + + diff --git a/rewrite/orig/scripts/maketreeinfo.py b/rewrite/orig/scripts/maketreeinfo.py new file mode 100644 index 00000000..226d5139 --- /dev/null +++ b/rewrite/orig/scripts/maketreeinfo.py @@ -0,0 +1,113 @@ +#!/usr/bin/python +# +# makes a .treeinfo file. if information isn't provided, emit some warnings. +# +# Copyright (C) 2007 Red Hat, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Author(s): Will Woods +# + +import os,sys,string +import getopt +import time +import ConfigParser + + +def usage(): + args = "" + for key in data: + args = "%s [--%s=%s]" %(args, key, key) + print("%s: %s" % (sys.argv[0], args)) + sys.exit(1) + +# TODO: add composeid, images, etc. +# TODO: take releasestr as an option and break it up into family/variant/version? + +data = {"timestamp": time.time(), + "family": None, + "variant": None, + "version": None, + "arch": None, + "discnum": None, + "totaldiscs": None, + "packagedir": None, + "outfile": None} +allDiscs = None + +opts = [] +for key in data.keys(): + opts.append("%s=" % (key,)) +opts.append("allDiscs") + +(args, extra) = getopt.getopt(sys.argv[1:], '', opts) +if len(extra) > 0: + print("had extra args: %s" % extra) + usage() + +for (str, arg) in args: + if str[2:] in data.keys(): + data[str[2:]] = arg + elif str == "--allDiscs": + allDiscs = 1 + else: + print("unknown str of ", str) + usage() + +# Make sure timestamp is actually a float +if type(data["timestamp"]) != float: + data["timestamp"] = float(data["timestamp"]) + +if data["family"] is None: + sys.stderr.write("--family missing! This is probably bad!\n") + data["family"] = "" + +if data["variant"] is None: + sys.stderr.write("--variant missing, but that's OK.\n") + data["variant"] = "" + +if data["version"] is None: + sys.stderr.write("--version missing! This is probably bad!\n") + data["version"] = "" + +if data["arch"] is None: + sys.stderr.write("--arch missing! This is probably bad!\n") + data["arch"] = "" + +if data["discnum"] is None and allDiscs is None: + sys.stderr.write("--discnum missing; assuming disc 1\n") + data["discnum"] = "1" + +if data["totaldiscs"] is None and allDiscs is None: + sys.stderr.write("--totaldiscs missing; assuming 1\n") + data["totaldiscs"] = "1" + +if data["packagedir"] is None: + sys.stderr.write("--packagedir missing. This might cause some weirdness.\n") + data["packagedir"] = "" + + +if data["outfile"] is None: + f = sys.stdout +else: + f = open(data["outfile"], "w") + +section='general' +c=ConfigParser.ConfigParser() +c.add_section(section) +for k,v in data.items(): + if k != 'outfile': + c.set(section,k,v) +c.write(f) diff --git a/rewrite/orig/scripts/mk-images b/rewrite/orig/scripts/mk-images new file mode 100755 index 00000000..1eb9529b --- /dev/null +++ b/rewrite/orig/scripts/mk-images @@ -0,0 +1,965 @@ +#!/bin/bash +# +# mk-images +# +# Copyright (C) 2007 Red Hat, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +LANG=C + +PATH=$PATH:/sbin:/usr/sbin +IMAGEUUID=$(date +%Y%m%d%H%M).$(uname -i) +TMPDIR=${TMPDIR:-/tmp} + +usage () { + echo "usage: mk-images