Esempio n. 1
0
 def test_keyring_isnt_reset_after_being_removed(self):
     open(self.keyring_file, "w").close()
     filename = self.makeFile(SOURCES_LIST_2, dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     sysconf.remove(("channels",
                     "aptsync-a3ea5e5aa96019e33241318e7f87a3d1",
                     "keyring"))
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(sysconf.get("channels"),
                       {"aptsync-a3ea5e5aa96019e33241318e7f87a3d1":
                           {"type": "apt-deb",
                            "name": "distro/name3 - comp1 comp2",
                            "distribution": "distro/name3",
                            "components": "comp1 comp2",
                            "baseurl": "http://some/url/"},
                       })
Esempio n. 2
0
 def test_keyring_isnt_reset_after_being_removed(self):
     open(self.keyring_file, "w").close()
     filename = self.makeFile(SOURCES_LIST_2, dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     sysconf.remove(("channels",
                     "aptsync-a3ea5e5aa96019e33241318e7f87a3d1",
                     "keyring"))
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(sysconf.get("channels"),
                       {"aptsync-a3ea5e5aa96019e33241318e7f87a3d1":
                           {"type": "apt-deb",
                            "name": "distro/name3 - comp1 comp2",
                            "distribution": "distro/name3",
                            "components": "comp1 comp2",
                            "baseurl": "http://some/url/"},
                       })
Esempio n. 3
0
 def tearDown(self):
     sysconf.remove("deb-arch")
     open("%s/aptdeb/trustdb.gpg" % TESTDATADIR, 'w').write(self.trustdb)
 def tearDown(self):
     sysconf.remove("channels")
Esempio n. 5
0
 def tearDown(self):
     sysconf.remove("channels")
     sysconf.remove("sync-apt-keyring")
     sysconf.remove("sync-apt-trustdb")
Esempio n. 6
0
 def tearDown(self):
     sysconf.remove("log-level")
Esempio n. 7
0
 def tearDown(self):
     sysconf.remove("channels")
     sysconf.remove("sync-apt-keyring")
     sysconf.remove("sync-apt-trustdb")
 def rmmirrors(self):
     sysconf.remove("mirrors")
 def cleanup():
     os.chdir(current_path)
     sysconf.remove("rpm-root")
Esempio n. 10
0
 def tearDown(self):
     sysconf.remove("deb-arch")
     open("%s/aptdeb/trustdb.gpg" % TESTDATADIR, 'w').write(self.trustdb)
Esempio n. 11
0
 def tearDown(self):
     sysconf.remove("log-level")
Esempio n. 12
0
 def tearDown(self):
     sysconf.remove("deb-arch")
Esempio n. 13
0
    def _initSmart(self, command=None, argv=None):
        iutil.mkdirChain(self.smart_dir)
        iutil.mkdirChain(self.wrapper_dir)

        buf = """#!/bin/bash

export PATH="${PATH}"
export D="%s"
export OFFLINE_ROOT="$D"
export IPKG_OFFLINE_ROOT="$D"
export OPKG_OFFLINE_ROOT="$D"
export INTERCEPT_DIR="/"
export NATIVE_ROOT="/"

exec 1>>/tmp/scriptlet.log 2>&1

echo $2 $1/$3 $4
if [ $2 = "/bin/sh" ]; then
  $2 -x $1/$3 $4
else
  $2 $1/$3 $4
fi
if [ $? -ne 0 ]; then
  if [ $4 -eq 1 ]; then
    mkdir -p $1/etc/rpm-postinsts
    num=100
    while [ -e $1/etc/rpm-postinsts/${num}-* ]; do num=$((num + 1)); done
    name=`head -1 $1/$3 | cut -d' ' -f 2`
    echo "#!$2" > $1/etc/rpm-postinsts/${num}-${name}
    echo "# Arg: $4" >> $1/etc/rpm-postinsts/${num}-${name}
    cat $1/$3 >> $1/etc/rpm-postinsts/${num}-${name}
    chmod +x $1/etc/rpm-postinsts/${num}-${name}
  else
    echo "Error: pre/post remove scriptlet failed"
  fi
fi
""" % (self.sysroot)

        fd = open(self.wrapper_dir + "/scriptlet_wrapper", "w")
        fd.write(buf)
        fd.close()
        os.chmod(self.wrapper_dir + "/scriptlet_wrapper", 0755)

        self.smart_ctrl = init(command,
                               argv=argv,
                               datadir=self.smart_dir,
                               configfile=None,
                               gui=False,
                               shell=False,
                               quiet=True,
                               interface=None,
                               forcelocks=False,
                               loglevel=None)

        # Override the dummy interface with the locally defined one
        iface.object = AnacondaInterface(self.smart_ctrl)

        initDistro(self.smart_ctrl)
        initPlugins()
        initPycurl()
        initPsyco()

        sysconf.set("rpm-root", self.sysroot, soft=True)
        sysconf.set("rpm-extra-macros._tmppath", "/install/tmp", soft=True)
        sysconf.set("rpm-extra-macros._cross_scriptlet_wrapper",
                    self.wrapper_dir + "/scriptlet_wrapper",
                    soft=True)
        sysconf.set("rpm-nolinktos", "1")
        sysconf.set("rpm-noparentdirs", "1")

        sysconf.remove("channels")

        self.repo_manager = SmartRepoManager(self.runSmart)
Esempio n. 14
0
 def setUp(self):
     self.config_dir = self.makeDir()
     self.urpmi_dir = os.path.join(self.config_dir, "urpmi")
     self.media_dir = os.path.join(self.config_dir, "media")
     os.mkdir(self.urpmi_dir)
     sysconf.remove("channels")
Esempio n. 15
0
 def cleanup():
     os.chdir(current_path)
     sysconf.remove("rpm-root")
Esempio n. 16
0
 def tearDown(self):
     sysconf.remove("channels")
 def setUp(self):
     self.config_dir = self.makeDir()
     self.urpmi_dir = os.path.join(self.config_dir, "urpmi")
     self.media_dir = os.path.join(self.config_dir, "media")
     os.mkdir(self.urpmi_dir)
     sysconf.remove("channels")