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

相关文章

Java循环创建对象内存溢出的解决方法

《Java循环创建对象内存溢出的解决方法》在Java中,如果在循环中不当地创建大量对象而不及时释放内存,很容易导致内存溢出(OutOfMemoryError),所以本文给大家介绍了Java循环创建对象... 目录问题1. 解决方案2. 示例代码2.1 原始版本(可能导致内存溢出)2.2 修改后的版本问题在

大数据小内存排序问题如何巧妙解决

《大数据小内存排序问题如何巧妙解决》文章介绍了大数据小内存排序的三种方法:数据库排序、分治法和位图法,数据库排序简单但速度慢,对设备要求高;分治法高效但实现复杂;位图法可读性差,但存储空间受限... 目录三种方法:方法概要数据库排序(http://www.chinasem.cn对数据库设备要求较高)分治法(常

Vue项目中Element UI组件未注册的问题原因及解决方法

《Vue项目中ElementUI组件未注册的问题原因及解决方法》在Vue项目中使用ElementUI组件库时,开发者可能会遇到一些常见问题,例如组件未正确注册导致的警告或错误,本文将详细探讨这些问题... 目录引言一、问题背景1.1 错误信息分析1.2 问题原因二、解决方法2.1 全局引入 Element

linux报错INFO:task xxxxxx:634 blocked for more than 120 seconds.三种解决方式

《linux报错INFO:taskxxxxxx:634blockedformorethan120seconds.三种解决方式》文章描述了一个Linux最小系统运行时出现的“hung_ta... 目录1.问题描述2.解决办法2.1 缩小文件系统缓存大小2.2 修改系统IO调度策略2.3 取消120秒时间限制3

关于@MapperScan和@ComponentScan的使用问题

《关于@MapperScan和@ComponentScan的使用问题》文章介绍了在使用`@MapperScan`和`@ComponentScan`时可能会遇到的包扫描冲突问题,并提供了解决方法,同时,... 目录@MapperScan和@ComponentScan的使用问题报错如下原因解决办法课外拓展总结@

MybatisGenerator文件生成不出对应文件的问题

《MybatisGenerator文件生成不出对应文件的问题》本文介绍了使用MybatisGenerator生成文件时遇到的问题及解决方法,主要步骤包括检查目标表是否存在、是否能连接到数据库、配置生成... 目录MyBATisGenerator 文件生成不出对应文件先在项目结构里引入“targetProje

C#使用HttpClient进行Post请求出现超时问题的解决及优化

《C#使用HttpClient进行Post请求出现超时问题的解决及优化》最近我的控制台程序发现有时候总是出现请求超时等问题,通常好几分钟最多只有3-4个请求,在使用apipost发现并发10个5分钟也... 目录优化结论单例HttpClient连接池耗尽和并发并发异步最终优化后优化结论我直接上优化结论吧,

Java内存泄漏问题的排查、优化与最佳实践

《Java内存泄漏问题的排查、优化与最佳实践》在Java开发中,内存泄漏是一个常见且令人头疼的问题,内存泄漏指的是程序在运行过程中,已经不再使用的对象没有被及时释放,从而导致内存占用不断增加,最终... 目录引言1. 什么是内存泄漏?常见的内存泄漏情况2. 如何排查 Java 中的内存泄漏?2.1 使用 J

numpy求解线性代数相关问题

《numpy求解线性代数相关问题》本文主要介绍了numpy求解线性代数相关问题,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧... 在numpy中有numpy.array类型和numpy.mat类型,前者是数组类型,后者是矩阵类型。数组

解决systemctl reload nginx重启Nginx服务报错:Job for nginx.service invalid问题

《解决systemctlreloadnginx重启Nginx服务报错:Jobfornginx.serviceinvalid问题》文章描述了通过`systemctlstatusnginx.se... 目录systemctl reload nginx重启Nginx服务报错:Job for nginx.javas