Пример #1
0
def setup():
    cat = run_batch("cat data/misc/gummi.desktop.in | grep Categories=")[1].split('=')[1].strip()
    for it in ['GTK', 'GNOME']:
        if not it in cat:
            cat = "%s;%s" % (it, cat)
            pisitools.dosed('data/misc/gummi.desktop.in', '^(Categories=).*', r'\1%s' % cat)
    autotools.configure()
Пример #2
0
    def close(self):
        self.tar.close()

        if self.tar.mode == 'wb' and self.type == 'tarlzma':
            ret, out, err = util.run_batch("lzma e -a2 -d26 -fb64 %s %s" % (self.file_path, self.file_path + '.lzma'))
            if ret != 0:
                raise LZMAError(err)
Пример #3
0
    def unpack_dir(self, target_dir):
        rmode = ""
        if self.type == 'tar':
            rmode = 'r:'
        elif self.type == 'targz':
            rmode = 'r:gz'
        elif self.type == 'tarbz2':
            rmode = 'r:bz2'
        elif self.type == 'tarlzma':
            rmode = 'r:'
            self.file_path = self.file_path.rstrip(ctx.const.lzma_suffix)
            ret, out, err = util.run_batch("lzma d %s %s" % (self.file_path + ctx.const.lzma_suffix,
                                                             self.file_path))
            if ret != 0:
                raise LZMAError(err)
        else:
            raise ArchiveError(_("Archive type not recognized"))

        self.tar = tarfile.open(self.file_path, rmode)
        oldwd = os.getcwd()
        os.chdir(target_dir)

        uid = os.getuid()
        gid = os.getgid()

        install_tar_path = util.join_path(ctx.config.tmp_dir(), ctx.const.install_tar)
        for tarinfo in self.tar:
            # Installing packages (especially shared libraries) is a
            # bit tricky. You should also change the inode if you
            # change the file, cause the file is opened allready and
            # accessed. Removing and creating the file will also
            # change the inode and will do the trick (in fact, old
            # file will be deleted only when its closed).
            # 
            # Also, tar.extract() doesn't write on symlinks... Not any
            # more :).
            if self.file_path == install_tar_path:
                if os.path.isfile(tarinfo.name) or os.path.islink(tarinfo.name):
                    try:
                        os.unlink(tarinfo.name)
                    except OSError, e:
                        ctx.ui.warning(e)

            self.tar.extract(tarinfo)

            # tarfile.extract does not honor umask. It must be honored explicitly.
            # see --no-same-permissions option of tar(1), which is the deafult
            # behaviour.
            #
            # Note: This is no good while installing a pisi package. Thats why
            # this is optional.
            if self.no_same_permissions and not os.path.islink(tarinfo.name):
                os.chmod(tarinfo.name, tarinfo.mode & ~ctx.const.umask)

            if self.no_same_owner:
                if not os.path.islink(tarinfo.name):
                    os.chown(tarinfo.name, uid, gid)
                else:
                    os.lchown(tarinfo.name, uid, gid)
Пример #4
0
def setup():
    if not shelltools.isFile(Archive):
        shelltools.system(
            '/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %s %s  --header "Cookie:oraclelicensejdk-%s-oth-JPR=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com"'
            % (Archive, Url, Ver))
    hash = run_batch("cat %s.sha1" % Arch)[1].split()[0]
    if not check_file_hash(Archive, hash): raise Error("Wrong sha1sum.")
    shelltools.system("tar -xzf %s" % Archive)
Пример #5
0
def setup():
    if not shelltools.isFile(BinName):
        shelltools.system('/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %s %s  --header "Cookie:oraclelicensejdk-%s-oth-JPR=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com"' % (BinName, UrlName, Name))
    hash = run_batch("cat jdk-6u34-linux-%s.bin.sha1" % Arch)[1].split()[0]
    if not check_file_hash(BinName, hash): raise Error("Wrong sha1sum.")
    shelltools.makedirs("unbundle-jdk")
    shelltools.cd("unbundle-jdk")
    shelltools.system("sh ../%s --noregister" % BinName)
Пример #6
0
def setup():
    if not shelltools.isFile(BinName):
        shelltools.system(
            '/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %s %s  --header "Cookie:oraclelicensejdk-%s-oth-JPR=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com"'
            % (BinName, UrlName, Name))
    hash = run_batch("cat jdk-6u34-linux-%s.bin.sha1" % Arch)[1].split()[0]
    if not check_file_hash(BinName, hash): raise Error("Wrong sha1sum.")
    shelltools.makedirs("unbundle-jdk")
    shelltools.cd("unbundle-jdk")
    shelltools.system("sh ../%s --noregister" % BinName)
Пример #7
0
    def close(self):
        self.tar.close()

        if self.tar.mode == 'w' and self.type == 'tarlzma':
            batch = None
            lzma = "lzma -z"
            if ctx.config.values.build.compressionlevel:
                lzma += " -%d" % ctx.config.values.build.compressionlevel
            ret, out, err = util.run_batch("%s %s" % (lzma, self.file_path))
            if ret != 0:
                raise LZMAError(err)
Пример #8
0
    def close(self):
        self.tar.close()

        if 'w' in str(self.tar.mode) and self.type == 'tarlzma':
            batch = None
            if ctx.config.values.build.compressionlevel:
                batch = "lzma -%s -z %s" % (ctx.config.values.build.compressionlevel, self.file_path)
            else:
                batch = "lzma -z %s" % self.file_path

            ret, out, err = util.run_batch(batch)
            if ret != 0:
                raise LzmaRuntimeError(err)
Пример #9
0
    def close(self):
        self.tar.close()

        if self.tar.mode == 'wb' and self.type == 'tarlzma':
            batch = None
            if ctx.config.values.build.compressionlevel:
                batch = "lzmash -%s %s" % (ctx.config.values.build.compressionlevel, self.file_path)
            else:
                batch = "lzmash %s" % self.file_path

            ret, out, err = util.run_batch(batch)
            if ret != 0:
                raise LZMAError(err)
Пример #10
0
    def unpack_dir(self, target_dir):
        self.file_path = util.remove_suffix(".Z", self.file_path)

        ret, out, err = util.run_batch(
                "uncompress -cf %s.Z > %s" % (self.file_path, self.file_path))
        if ret != 0:
            raise RuntimeError(
                        _("Problem occured while uncompressing %s.Z file")
                        % self.file_path)

        self.tar = tarfile.open(self.file_path)

        oldwd = None
        try:
            # Don't fail if CWD doesn't exist (#6748)
            oldwd = os.getcwd()
        except OSError:
            pass
        os.chdir(target_dir)

        uid = os.getuid()
        gid = os.getgid()

        for tarinfo in self.tar:
            self.tar.extract(tarinfo)

            # tarfile.extract does not honor umask. It must be honored
            # explicitly. See --no-same-permissions option of tar(1),
            # which is the deafult behaviour.
            #
            # Note: This is no good while installing a pisi package.
            # Thats why this is optional.
            if self.no_same_permissions and not os.path.islink(tarinfo.name):
                os.chmod(tarinfo.name, tarinfo.mode & ~ctx.const.umask)

            if self.no_same_owner:
                if not os.path.islink(tarinfo.name):
                    os.chown(tarinfo.name, uid, gid)
                else:
                    os.lchown(tarinfo.name, uid, gid)

        # Bug #10680 and addition for tarZ files
        os.unlink(self.file_path)

        try:
            if oldwd:
                os.chdir(oldwd)
        # Bug #6748
        except OSError:
            pass
        self.tar.close()
Пример #11
0
    def unpack_dir(self, target_dir):
        self.file_path = util.remove_suffix(".Z", self.file_path)

        ret, out, err = util.run_batch(
                "uncompress -cf %s.Z > %s" % (self.file_path, self.file_path))
        if ret != 0:
            raise RuntimeError(
                        _("Problem occured while uncompressing %s.Z file")
                        % self.file_path)

        self.tar = tarfile.open(self.file_path)

        oldwd = None
        try:
            # Don't fail if CWD doesn't exist (#6748)
            oldwd = os.getcwd()
        except OSError:
            pass
        os.chdir(target_dir)

        uid = os.getuid()
        gid = os.getgid()

        for tarinfo in self.tar:
            self.tar.extract(tarinfo)

            # tarfile.extract does not honor umask. It must be honored
            # explicitly. See --no-same-permissions option of tar(1),
            # which is the deafult behaviour.
            #
            # Note: This is no good while installing a pisi package.
            # Thats why this is optional.
            if self.no_same_permissions and not os.path.islink(tarinfo.name):
                os.chmod(tarinfo.name, tarinfo.mode & ~ctx.const.umask)

            if self.no_same_owner:
                if not os.path.islink(tarinfo.name):
                    os.chown(tarinfo.name, uid, gid)
                else:
                    os.lchown(tarinfo.name, uid, gid)

        # Bug #10680 and addition for tarZ files
        os.unlink(self.file_path)

        try:
            if oldwd:
                os.chdir(oldwd)
        # Bug #6748
        except OSError:
            pass
        self.tar.close()
Пример #12
0
def executable_insinto(destinationDirectory, sourceFiles):
    '''insert a executable file into destinationDirectory'''

    if not sourceFiles or not destinationDirectory:
        raise ArgumentError(_('Insufficient arguments.'))

    if not can_access_directory(destinationDirectory):
        makedirs(destinationDirectory)

    for sourceFile in list(sourceFiles):
        #print 'pkgsrcDIR()=',get.sourceDIR()
        sourceFile = join_path(get.sourceDIR(), sourceFile)
        #print 'sourceFile,destDir=',sourceFile, destinationDirectory
        for source in glob.glob(sourceFile):
            #TODO FIXME: use an internal install routine for these
            if util.is_osx() == True:
                util.run_batch('ginstall -m0755 -o root -g wheel %s %s' %
                               (source, destinationDirectory),
                               sudo=True)
            else:
                util.run_batch('install -m0755 -o root -g root %s %s' %
                               (source, destinationDirectory),
                               sudo=True)
Пример #13
0
    def close(self):
        self.tar.close()

        if self.tar.mode == 'wb' and self.type == 'tarlzma':
            batch = None
            if ctx.config.values.build.compressionlevel:
                batch = "lzma -%s -z %s" % (
                    ctx.config.values.build.compressionlevel, self.file_path)
            else:
                batch = "lzma -z %s" % self.file_path

            ret, out, err = util.run_batch(batch)
            if ret != 0:
                raise LzmaRuntimeError(err)
Пример #14
0
    def close(self):
        self.tar.close()

        if self.tar.mode == 'w' and self.type == 'tarlzma':
            batch = None
            if util.is_osx():
                lzma = "lzma"
            else:
                lzma = "lzmash"
            if ctx.config.values.build.compressionlevel:
                batch = "%s -%s %s" % (lzma, ctx.config.values.build.
                                       compressionlevel, self.file_path)
            else:
                batch = "%s %s" % (lzma, self.file_path)

            ret, out, err = util.run_batch(batch)
            if ret != 0:
                raise LZMAError(err)
Пример #15
0
    def unpack_dir(self, target_dir):
        rmode = ""
        if self.type == 'tar':
            rmode = 'r:'
        elif self.type == 'targz':
            rmode = 'r:gz'
        elif self.type == 'tarbz2':
            rmode = 'r:bz2'
        elif self.type == 'tarlzma':
            rmode = 'r:'
            self.file_path = self.file_path.rstrip(ctx.const.lzma_suffix)
            ret, out, err = util.run_batch(
                "lzma d %s %s" %
                (self.file_path + ctx.const.lzma_suffix, self.file_path))
            if ret != 0:
                raise LZMAError(err)
        else:
            raise ArchiveError(_("Archive type not recognized"))

        self.tar = tarfile.open(self.file_path, rmode)
        oldwd = os.getcwd()
        os.chdir(target_dir)

        install_tar_path = util.join_path(ctx.config.tmp_dir(),
                                          ctx.const.install_tar)
        for tarinfo in self.tar:
            # Installing packages (especially shared libraries) is a
            # bit tricky. You should also change the inode if you
            # change the file, cause the file is opened allready and
            # accessed. Removing and creating the file will also
            # change the inode and will do the trick (in fact, old
            # file will be deleted only when its closed).
            #
            # Also, tar.extract() doesn't write on symlinks... Not any
            # more :).
            if self.file_path == install_tar_path:
                if os.path.isfile(tarinfo.name) or os.path.islink(
                        tarinfo.name):
                    try:
                        os.unlink(tarinfo.name)
                    except OSError, e:
                        ctx.ui.warning(e)

            self.tar.extract(tarinfo)
Пример #16
0
    def unpack_dir(self, target_dir):
        rmode = ""
        if self.type == 'tar':
            rmode = 'r:'
        elif self.type == 'targz':
            rmode = 'r:gz'
        elif self.type == 'tarbz2':
            rmode = 'r:bz2'
        elif self.type == 'tarlzma':
            rmode = 'r:'
            self.file_path = self.file_path.rstrip(ctx.const.lzma_suffix)
            ret, out, err = util.run_batch("lzma d %s %s" % (self.file_path + ctx.const.lzma_suffix,
                                                             self.file_path))
            if ret != 0:
                #FIXME: see bug #2836
                raise LZMAError(out)
        else:
            raise ArchiveError(_("Archive type not recognized"))

        self.tar = tarfile.open(self.file_path, rmode)
        oldwd = os.getcwd()
        os.chdir(target_dir)

        install_tar_path = util.join_path(ctx.config.tmp_dir(), ctx.const.install_tar)
        for tarinfo in self.tar:
            # Installing packages (especially shared libraries) is a
            # bit tricky. You should also change the inode if you
            # change the file, cause the file is opened allready and
            # accessed. Removing and creating the file will also
            # change the inode and will do the trick (in fact, old
            # file will be deleted only when its closed).
            # 
            # Also, tar.extract() doesn't write on symlinks... Not any
            # more :).
            if self.file_path == install_tar_path:
                if os.path.isfile(tarinfo.name) or os.path.islink(tarinfo.name):
                    try:
                        os.unlink(tarinfo.name)
                    except OSError, e:
                        ctx.ui.warning(e)

            self.tar.extract(tarinfo)
Пример #17
0
    def unpack_dir(self, target_dir):
        rmode = ""
        if self.type == 'tar':
            rmode = 'r:'
        elif self.type == 'targz':
            rmode = 'r:gz'
        elif self.type == 'tarbz2':
            rmode = 'r:bz2'
        elif self.type == 'tarlzma':
            rmode = 'r:'
            self.file_path = self.file_path.rstrip('.lzma')
            ret, out, err = util.run_batch("lzma d %s %s" % (self.file_path + '.lzma', self.file_path))
            if ret != 0:
                raise LZMAError(err)
        else:
            raise ArchiveError(_("Archive type not recognized"))

        self.tar = tarfile.open(self.file_path, rmode)
        oldwd = os.getcwd()
        os.chdir(target_dir)
        for tarinfo in self.tar:
            self.tar.extract(tarinfo)
        os.chdir(oldwd)
        self.close()
Пример #18
0
    def unpack_dir(self, target_dir):
        rmode = ""
        if self.type == 'tar':
            rmode = 'r:'
        elif self.type == 'targz':
            rmode = 'r:gz'
        elif self.type == 'tarbz2':
            rmode = 'r:bz2'
        elif self.type == 'tarlzma':
            rmode = 'r:'
            self.file_path = self.file_path.rstrip(ctx.const.lzma_suffix)
            ret, out, err = util.run_batch(
                "lzma -k -f -d %s%s" % (self.file_path, ctx.const.lzma_suffix))
            if ret != 0:
                raise LzmaRuntimeError(err)
        else:
            raise UnknownArchiveType

        self.tar = tarfile.open(self.file_path, rmode)
        oldwd = os.getcwd()
        os.chdir(target_dir)

        uid = os.getuid()
        gid = os.getgid()

        install_tar_path = util.join_path(ctx.config.tmp_dir(),
                                          ctx.const.install_tar)
        for tarinfo in self.tar:
            # Installing packages (especially shared libraries) is a
            # bit tricky. You should also change the inode if you
            # change the file, cause the file is opened allready and
            # accessed. Removing and creating the file will also
            # change the inode and will do the trick (in fact, old
            # file will be deleted only when its closed).
            #
            # Also, tar.extract() doesn't write on symlinks... Not any
            # more :).
            if self.file_path == install_tar_path:
                if os.path.isfile(tarinfo.name) or os.path.islink(
                        tarinfo.name):
                    try:
                        os.unlink(tarinfo.name)
                    except OSError, e:
                        ctx.ui.warning(e)

            self.tar.extract(tarinfo)

            # tarfile.extract does not honor umask. It must be honored explicitly.
            # see --no-same-permissions option of tar(1), which is the deafult
            # behaviour.
            #
            # Note: This is no good while installing a pisi package. Thats why
            # this is optional.
            if self.no_same_permissions and not os.path.islink(tarinfo.name):
                os.chmod(tarinfo.name, tarinfo.mode & ~ctx.const.umask)

            if self.no_same_owner:
                if not os.path.islink(tarinfo.name):
                    os.chown(tarinfo.name, uid, gid)
                else:
                    os.lchown(tarinfo.name, uid, gid)
Пример #19
0
def setup():
    if not shelltools.isFile(Archive):
        shelltools.system('/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %s %s  --header "Cookie:oraclelicensejdk-%s-oth-JPR=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com"' % (Archive, Url, Ver))
    hash = run_batch("cat %s.sha1" % Arch)[1].split()[0]
    if not check_file_hash(Archive, hash): raise Error("Wrong sha1sum.")
    shelltools.system("tar -xzf %s" % Archive)
Пример #20
0
def system(command):
    command = string.join(string.split(command))
    return run_batch(command, True)[0]
Пример #21
0
    def unpack_dir(self, target_dir):
        rmode = ""
        if self.type == 'tar':
            rmode = 'r:'
        elif self.type == 'targz':
            rmode = 'r:gz'
        elif self.type == 'tarbz2':
            rmode = 'r:bz2'
        elif self.type == 'tarlzma':
            rmode = 'r:'
            self.file_path = self.file_path.rstrip(ctx.const.lzma_suffix)
            ret, out, err = util.run_batch("lzma -k -f -d %s%s" % (self.file_path,ctx.const.lzma_suffix))
            if ret != 0:
                raise LzmaRuntimeError(err)
        elif self.type == 'tarZ':
            rmode = 'r:'
            self.file_path = self.file_path.rstrip('.Z')
            ret, out, err = util.run_batch("uncompress -f %s%s" % (self.file_path,'.Z'))
            if ret != 0:
                raise RuntimeError, 'Problem occured while uncompressing %s.Z file' % self.file_path
        else:
            raise UnknownArchiveType

        self.tar = tarfile.open(self.file_path, rmode)
        oldwd = None
        try:
            # Don't fail if CWD doesn't exist (#6748)
            oldwd = os.getcwd()
        except OSError:
            pass
        os.chdir(target_dir)

        uid = os.getuid()
        gid = os.getgid()

        install_tar_path = util.join_path(ctx.config.tmp_dir(), ctx.const.install_tar)
        for tarinfo in self.tar:
            # Installing packages (especially shared libraries) is a
            # bit tricky. You should also change the inode if you
            # change the file, cause the file is opened allready and
            # accessed. Removing and creating the file will also
            # change the inode and will do the trick (in fact, old
            # file will be deleted only when its closed).
            # 
            # Also, tar.extract() doesn't write on symlinks... Not any
            # more :).
            if self.file_path == install_tar_path:
                if os.path.isfile(tarinfo.name) or os.path.islink(tarinfo.name):
                    try:
                        os.unlink(tarinfo.name)
                    except OSError, e:
                        ctx.ui.warning(e)

            self.tar.extract(tarinfo)

            # tarfile.extract does not honor umask. It must be honored explicitly.
            # see --no-same-permissions option of tar(1), which is the deafult
            # behaviour.
            #
            # Note: This is no good while installing a pisi package. Thats why
            # this is optional.
            if self.no_same_permissions and not os.path.islink(tarinfo.name):
                os.chmod(tarinfo.name, tarinfo.mode & ~ctx.const.umask)

            if self.no_same_owner:
                if not os.path.islink(tarinfo.name):
                    os.chown(tarinfo.name, uid, gid)
                else:
                    os.lchown(tarinfo.name, uid, gid)

            # Added for package-manager
            if tarinfo.name.endswith(".desktop"):
                ctx.ui.notify(pisi.ui.desktopfile, desktopfile=tarinfo.name)
Пример #22
0
def postInstall(fromVersion, fromRelease, toVersion, toRelease):
    if not run_batch("cat /etc/passwd | grep polkitd")[1].split(":")[5] == "/var/lib/polkit-1":
        run_batch("usermod -d /var/lib/polkit-1 polkitd")
Пример #23
0
    options.destdir=sys.argv[2]
else:
    options.destdir = '/'
pisi.api.init(database=True, comar=False, options=options)

filename = sys.argv[1]
package = Package(filename)
package.read()
util.clean_dir('/tmp/install')
package.extract_dir_flat('install', '/tmp/install')
deps = set()
needed = set()
for file in package.files.list:
    #print file.path, file.type
    if file.type == 'executable':
        (ret, lines) = util.run_batch('objdump -p %s' % util.join_path('/tmp/install', file.path))
        for x in lines:
            if x.startswith('  NEEDED'):
                needed.add(x[8:].strip())

#print 'needed guys', needed

for lib in needed:

    (ret, out) = util.run_batch('locate %s' % lib)
    path = out[0].strip().lstrip('/')
    try:
        (pkg_name, file_info) = ctx.filesdb.get_file(path)
        ctx.ui.info("Library dependency: '%s' due to library '%s'" % (pkg_name, file_info.path))
        deps.add(pkg_name)
    except:
Пример #24
0
    options.destdir = sys.argv[2]
else:
    options.destdir = '/'
pisi.api.init(database=True, comar=False, options=options)

filename = sys.argv[1]
package = Package(filename)
package.read()
util.clean_dir('/tmp/install')
package.extract_dir_flat('install', '/tmp/install')
deps = set()
needed = set()
for file in package.files.list:
    #print file.path, file.type
    if file.type == 'executable':
        (ret, lines) = util.run_batch(
            'objdump -p %s' % util.join_path('/tmp/install', file.path))
        for x in lines:
            if x.startswith('  NEEDED'):
                needed.add(x[8:].strip())

#print 'needed guys', needed

for lib in needed:

    (ret, out) = util.run_batch('locate %s' % lib)
    path = out[0].strip().lstrip('/')
    try:
        (pkg_name, file_info) = ctx.filesdb.get_file(path)
        ctx.ui.info("Library dependency: '%s' due to library '%s'" %
                    (pkg_name, file_info.path))
        deps.add(pkg_name)