deepin add-apt-repository 诸多问题及其解决

2024-04-20 23:58

本文主要是介绍deepin add-apt-repository 诸多问题及其解决,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

deepin不会自带这个命令的,需要安装

apt-get install python-software-properties
sudo apt-get install software-properties-common

知乎上的解决方法:
https://www.zhihu.com/question/30361833/answer/84878458

测试命令:

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php

但是使用起来会报错:

Traceback (most recent call last):File "/usr/bin/add-apt-repository", line 160, in <module>sp = SoftwareProperties(options=options)File "/usr/lib/python2.7/dist-packages/softwareproperties/SoftwareProperties.py", line 96, in __init__self.reload_sourceslist()File "/usr/lib/python2.7/dist-packages/softwareproperties/SoftwareProperties.py", line 584, in reload_sourceslistself.distro.get_sources(self.sourceslist)    File "/usr/lib/python2.7/dist-packages/aptsources/distro.py", line 93, in get_sources(self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Deepin/stable

我们看到/usr/share/python-apt/templates/Deepin.info

Suite: unstable
RepositoryType: deb
BaseURI: http://packages.deepin.com/deepin/
MatchURI: \.deepin\.com
MirrorsFile: Deepin.mirrors
Description: Deepin 'unstable'
Component: main
CompDescription: Officially supported
Component: contrib
CompDescription: DFSG-compatible Software with Non-Free Dependencies
Component: non-free
CompDescription: Non-DFSG-compatible Software

(没什么卵用)

修改/etc/lsb-release

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=wily
DISTRIB-DESCRIPTION="Ubuntu wily"

最后需要修改一下/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py文件

#  software-properties backend
#
#  Copyright (c) 2004-2007 Canonical Ltd.
#                2004-2005 Michiel Sikkes
#
#  Author: Michiel Sikkes <michiel@eyesopened.nl>
#          Michael Vogt <mvo@debian.org>
#          Sebastian Heinlein <glatzor@ubuntu.com>
#
#  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, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
#  USAfrom __future__ import absolute_import, print_functionimport apt_pkg
import copy
from hashlib import md5
import re
import os
import glob
import shutil
import threading
import atexit
import tempfile
try:from string import maketrans
except ImportError:maketrans = str.maketrans
import statfrom tempfile import NamedTemporaryFile
from xml.sax.saxutils import escape
try:from configparser import ConfigParser
except ImportError:from ConfigParser import ConfigParser
from gettext import gettext as _import aptsources
import aptsources.distro
import softwarepropertiesfrom .AptAuth import AptAuth
from aptsources.sourceslist import SourcesList, SourceEntry
from . import shortcuts
from . import ppa
from . import cloudarchive_SHORTCUT_FACTORIES = [ppa.shortcut_handler,cloudarchive.shortcut_handler,shortcuts.shortcut_handler,
]class SoftwareProperties(object):# known (whitelisted) channelsCHANNEL_PATH="/usr/share/app-install/channels/"# release upgrades policyRELEASE_UPGRADES_CONF = "/etc/update-manager/release-upgrades"#RELEASE_UPGRADES_CONF = "/tmp/release-upgrades"(RELEASE_UPGRADES_NORMAL,RELEASE_UPGRADES_LTS,RELEASE_UPGRADES_NEVER) = list(range(3))release_upgrades_policy_map = {RELEASE_UPGRADES_NORMAL : 'normal',RELEASE_UPGRADES_LTS    : 'lts',RELEASE_UPGRADES_NEVER  : 'never',}def __init__(self, datadir=None, options=None, rootdir="/"):""" Provides the core functionality to configure the used software repositories, the corresponding authentication keys and update automation """self.popconfile = rootdir+"/etc/popularity-contest.conf"self.rootdir = rootdirif rootdir != "/":apt_pkg.config.set("Dir", rootdir)# FIXME: some saner way is needed hereif datadir == None:datadir = "/usr/share/software-properties/"self.options = optionsself.datadir = datadirself.sourceslist = SourcesList()self.distro = aptsources.distro.get_distro()self.seen_server = []self.modified_sourceslist = Falseself.reload_sourceslist()self.backup_sourceslist()self.backup_apt_conf()# FIXME: we need to store this value in a config option#self.custom_mirrors = ["http://adasdwww.de/ubuntu"]self.custom_mirrors= []# apt-key stuffself.apt_key = AptAuth(rootdir=rootdir)atexit.register(self.wait_for_threads)def wait_for_threads(self):" wait for all running threads (PPA key fetchers) to exit "for t in threading.enumerate():if t.ident != threading.current_thread().ident:t.join()def backup_apt_conf(self):"""Backup all apt configuration options"""self.apt_conf_backup = {}for option in softwareproperties.CONF_MAP.keys():value = apt_pkg.config.find_i(softwareproperties.CONF_MAP[option])self.apt_conf_backup[option] = valuedef restore_apt_conf(self):"""Restore the stored apt configuration"""for option in self.apt_conf_backup.keys():apt_pkg.config.set(softwareproperties.CONF_MAP[option],str(self.apt_conf_backup[option]))self.write_config()def get_update_automation_level(self):""" Parse the apt cron configuration. Try to fit a predefined use case and return it. Special case: if the user made a custom configurtation, that we cannot represent it will return None """if apt_pkg.config.find_i(softwareproperties.CONF_MAP["autoupdate"]) > 0:# Autodownloadif apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 1\and os.path.exists("/usr/bin/unattended-upgrade"):return softwareproperties.UPDATE_INST_SECelif apt_pkg.config.find_i(softwareproperties.CONF_MAP["autodownload"]) == 1 and  \apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 0:return softwareproperties.UPDATE_DOWNLOADelif apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 0 and \apt_pkg.config.find_i(softwareproperties.CONF_MAP["autodownload"]) == 0:return softwareproperties.UPDATE_NOTIFYelse:return Noneelif apt_pkg.config.find_i(softwareproperties.CONF_MAP["unattended"]) == 0 and \apt_pkg.config.find_i(softwareproperties.CONF_MAP["autodownload"]) == 0:return softwareproperties.UPDATE_MANUALelse:return Nonedef set_update_automation_level(self, state):""" Set the apt periodic configurtation to the selected update automation level. To synchronize the cache update and the actual upgrading function, the upgrade function, e.g. unattended, will run every day, if enabled. """if state == softwareproperties.UPDATE_INST_SEC:apt_pkg.config.set(softwareproperties.CONF_MAP["unattended"], str(1))apt_pkg.config.set(softwareproperties.CONF_MAP["autodownload"], str(1))elif state == softwareproperties.UPDATE_DOWNLOAD:apt_pkg.config.set(softwareproperties.CONF_MAP["autodownload"], str(1))apt_pkg.config.set(softwareproperties.CONF_MAP["unattended"], str(0))elif s

这篇关于deepin add-apt-repository 诸多问题及其解决的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!


原文地址:
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.chinasem.cn/article/921668

相关文章

MySQL 中查询 VARCHAR 类型 JSON 数据的问题记录

《MySQL中查询VARCHAR类型JSON数据的问题记录》在数据库设计中,有时我们会将JSON数据存储在VARCHAR或TEXT类型字段中,本文将详细介绍如何在MySQL中有效查询存储为V... 目录一、问题背景二、mysql jsON 函数2.1 常用 JSON 函数三、查询示例3.1 基本查询3.2

Pyserial设置缓冲区大小失败的问题解决

《Pyserial设置缓冲区大小失败的问题解决》本文主要介绍了Pyserial设置缓冲区大小失败的问题解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面... 目录问题描述原因分析解决方案问题描述使用set_buffer_size()设置缓冲区大小后,buf

PyInstaller打包selenium-wire过程中常见问题和解决指南

《PyInstaller打包selenium-wire过程中常见问题和解决指南》常用的打包工具PyInstaller能将Python项目打包成单个可执行文件,但也会因为兼容性问题和路径管理而出现各种运... 目录前言1. 背景2. 可能遇到的问题概述3. PyInstaller 打包步骤及参数配置4. 依赖

resultMap如何处理复杂映射问题

《resultMap如何处理复杂映射问题》:本文主要介绍resultMap如何处理复杂映射问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录resultMap复杂映射问题Ⅰ 多对一查询:学生——老师Ⅱ 一对多查询:老师——学生总结resultMap复杂映射问题

解决SpringBoot启动报错:Failed to load property source from location 'classpath:/application.yml'

《解决SpringBoot启动报错:Failedtoloadpropertysourcefromlocationclasspath:/application.yml问题》这篇文章主要介绍... 目录在启动SpringBoot项目时报如下错误原因可能是1.yml中语法错误2.yml文件格式是GBK总结在启动S

java实现延迟/超时/定时问题

《java实现延迟/超时/定时问题》:本文主要介绍java实现延迟/超时/定时问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录Java实现延迟/超时/定时java 每间隔5秒执行一次,一共执行5次然后结束scheduleAtFixedRate 和 schedu

idea maven编译报错Java heap space的解决方法

《ideamaven编译报错Javaheapspace的解决方法》这篇文章主要为大家详细介绍了ideamaven编译报错Javaheapspace的相关解决方法,文中的示例代码讲解详细,感兴趣的... 目录1.增加 Maven 编译的堆内存2. 增加 IntelliJ IDEA 的堆内存3. 优化 Mave

如何解决mmcv无法安装或安装之后报错问题

《如何解决mmcv无法安装或安装之后报错问题》:本文主要介绍如何解决mmcv无法安装或安装之后报错问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录mmcv无法安装或安装之后报错问题1.当我们运行YOwww.chinasem.cnLO时遇到2.找到下图所示这里3.

浅谈配置MMCV环境,解决报错,版本不匹配问题

《浅谈配置MMCV环境,解决报错,版本不匹配问题》:本文主要介绍浅谈配置MMCV环境,解决报错,版本不匹配问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录配置MMCV环境,解决报错,版本不匹配错误示例正确示例总结配置MMCV环境,解决报错,版本不匹配在col

Vue3使用router,params传参为空问题

《Vue3使用router,params传参为空问题》:本文主要介绍Vue3使用router,params传参为空问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐... 目录vue3使用China编程router,params传参为空1.使用query方式传参2.使用 Histo