Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 1006225 Details for
Bug 1156528
[rfe] use dnf instead of yum
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh90 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
yum to dnf migration
dnf.patch (text/plain), 14.50 KB, created by
Michael Mráka
on 2015-03-25 09:28:08 UTC
(
hide
)
Description:
yum to dnf migration
Filename:
MIME Type:
Creator:
Michael Mráka
Created:
2015-03-25 09:28:08 UTC
Size:
14.50 KB
patch
obsolete
>diff -ur mach-1.0.4.orig/mach.spec mach-1.0.4/mach.spec >--- mach-1.0.4.orig/mach.spec 2015-03-08 23:19:45.000000000 +0100 >+++ mach-1.0.4/mach.spec 2015-03-25 10:23:45.767378307 +0100 >@@ -13,7 +13,7 @@ > Requires: rpm > Requires: rpm-build > Requires: rpm-python >-Requires: yum >+Requires: dnf > Requires: createrepo > Requires: sed > Requires: cpio >@@ -27,7 +27,7 @@ > > %description > mach makes a chroot. >-Using yum or apt-get and a suid binary, it manages to install clean chroot >+Using dnf or apt-get and a suid binary, it manages to install clean chroot > environments based on the original packages for that distribution. > > The clean root can be used to run jail roots, to create image files, or >diff -ur mach-1.0.4.orig/mach.spec.in mach-1.0.4/mach.spec.in >--- mach-1.0.4.orig/mach.spec.in 2014-07-24 18:29:14.000000000 +0200 >+++ mach-1.0.4/mach.spec.in 2015-03-25 10:12:00.495130462 +0100 >@@ -13,7 +13,7 @@ > Requires: rpm > Requires: rpm-build > Requires: rpm-python >-Requires: yum >+Requires: dnf > Requires: createrepo > Requires: sed > Requires: cpio >@@ -27,7 +27,7 @@ > > %description > mach makes a chroot. >-Using yum or apt-get and a suid binary, it manages to install clean chroot >+Using dnf or apt-get and a suid binary, it manages to install clean chroot > environments based on the original packages for that distribution. > > The clean root can be used to run jail roots, to create image files, or >diff -ur mach-1.0.4.orig/scripts/mach.in mach-1.0.4/scripts/mach.in >--- mach-1.0.4.orig/scripts/mach.in 2013-01-20 22:16:53.000000000 +0100 >+++ mach-1.0.4/scripts/mach.in 2015-03-25 10:18:59.121626837 +0100 >@@ -85,13 +85,13 @@ > build everything to build rpms > status show status of mach roots > unlock override root lock >- yum run host\'s yum on target root >+ dnf run host\'s dnf on target root > ''' > > # list of allowed commands > allowed_commands = ('apt-get', 'apt-cache', 'build', > 'chroot', 'clean', 'rebuild', 'rpm', >- 'setup', 'status', 'unlock', 'yum') >+ 'setup', 'status', 'unlock', 'dnf') > > # read default configuration > config = { >@@ -114,10 +114,10 @@ > 'rm': '@SBINDIR@/mach-helper rm', > 'apt-get': '@SBINDIR@/mach-helper apt-get', > 'apt-cache': '/usr/bin/apt-cache', >- 'yum': '@SBINDIR@/mach-helper yum', >+ 'dnf': '@SBINDIR@/mach-helper dnf', > 'mknod': '@SBINDIR@/mach-helper mknod', > 'runuser': '/bin/su', >- 'installer': 'yum', >+ 'installer': 'dnf', > > # root_*: commands run inside the build root > 'root_rpmbuild': 'rpmbuild', >@@ -440,8 +440,8 @@ > debug ("BuildRequires from header: %s" % buildreqs) > # remove non-packagey things from buildreqs, like autodeps > if buildreqs: >- # for yum, we filter rpmlib() deps >- if self.root.config['installer'] == 'yum': >+ # for dnf, we filter rpmlib() deps >+ if self.root.config['installer'] == 'dnf': > return filter (lambda x: not x.startswith("rpmlib("), buildreqs) > # ...and for others, that and everything containing / > return filter (lambda x: not (re.search("[/]", x) or re.search("rpmlib", x)), buildreqs) >@@ -660,10 +660,10 @@ > > self.installer (args, interactive = True) > >- # mach yum >- def yum (self, args): >- if self.config['installer'] != 'yum': >- raise self.Error, "Installer is not configured to be yum" >+ # mach dnf >+ def dnf (self, args): >+ if self.config['installer'] != 'dnf': >+ raise self.Error, "Installer is not configured to be dnf" > > self._setup_prep () > >@@ -676,9 +676,9 @@ > # if no message specified, then it's up to caller > def installer (self, args, message = None, > progress = False, interactive = False): >- "run apt-get (arg) or yum (arg) from outside the root on the root" >- if self.config['installer'] == "yum": >- conf = 'yum.conf' >+ "run apt-get (arg) or dnf (arg) from outside the root on the root" >+ if self.config['installer'] == "dnf": >+ conf = 'dnf.conf' > extras = '--installroot=' + self.rootdir + ' ' > else: > conf = 'apt.conf' >@@ -1030,8 +1030,8 @@ > debug ("already clean, returning") > return > >- # clean up yum cache >- if self.config['installer'] == 'yum': >+ # clean up dnf cache >+ if self.config['installer'] == 'dnf': > try: > self.installer (["clean", "all", ]) > except Exception, e: >@@ -1050,10 +1050,10 @@ > debug ("Removing statedir %s" % self.statedir) > os.system ("rm -rf %s" % self.statedir) > >- # remove yum cache for the local packages >+ # remove dnf cache for the local packages > packagesdirname = config['packages']['dir'] > fullpath = os.path.join ('@LOCALSTATEDIR@', 'cache', >- 'mach', packagesdirname, 'yum', "local.%s" % self.root) >+ 'mach', packagesdirname, 'dnf', "local.%s" % self.root) > debug ('checking for removal of %s' % fullpath) > if os.path.exists (fullpath): > cmd = '%s -rfv %s' % (config['rm'], fullpath) >@@ -1087,7 +1087,7 @@ > srcs = get_sources_dict (self.config) > root = self.config['root'] > rootdir = get_config_dir (self.config, 'root') >- if self.config['installer'] == 'yum': >+ if self.config['installer'] == 'dnf': > line = 'file://%s/usr/src/@PKGDIR@/RPMS.mach-local' % rootdir > else: > line = 'rpm-dir file://%s/usr/src rpm mach-local' % rootdir >@@ -1102,7 +1102,7 @@ > self.do_chroot ("chown -R %s:%s /usr/src/rpm/RPMS" % (builduser, buildgroup), fatal = True) > > try: >- if self.config['installer'] != 'yum': >+ if self.config['installer'] != 'dnf': > self.installer (["update", ]) > except Root.Error: > raise self.Error, 'could not update installer' >@@ -1484,7 +1484,7 @@ > # for now, we do, for multiple builds > # self.do_chroot ('rm ' + file) > >- # update internal apt/yum repo >+ # update internal apt/dnf repo > self.update_local_repo () > print "Build of %s succeeded, results in\n%s" % (fullname, pkgresultdir) > resultdirs.append (pkgresultdir) >@@ -1667,11 +1667,11 @@ > debug (command) > os.system (command) > >- # yum bits >+ # dnf bits > ensure_dir (os.path.join (self.rootdir, 'var', 'log')) >- open (os.path.join (self.rootdir, 'var', 'log', 'yum.log'), 'w') >+ open (os.path.join (self.rootdir, 'var', 'log', 'dnf.log'), 'w') > ensure_dir (os.path.join (self.statedir, 'yum/yum.repos.d')) >- ensure_dir (os.path.join (self.rootdir, 'var/cache/mach/yum')) >+ ensure_dir (os.path.join (self.rootdir, 'var/cache/mach/dnf')) > > # generic bits > #FIXME: os.chmod (root + '/var/lib/rpm', g+s) >@@ -1721,7 +1721,7 @@ > if os.WIFEXITED (status) and os.WEXITSTATUS (status) == 0: > epochopt = 'Options { "--promoteepoch"; }' > >- # create a custom apt.conf/yum.conf file >+ # create a custom apt.conf/dnf.conf file > > root = self.rootdir > state = self.statedir >@@ -1775,12 +1775,12 @@ > ''' > self.set_state ("apt.conf", conf) > >- # create a custom yum.conf file >+ # create a custom dnf.conf file > # FIXME: the list of double dots going up should be gotten > # by calculating the depth of the file tree > conf = ''' > [main] >-cachedir = /../../../../..''' + os.path.join ('@LOCALSTATEDIR@', 'cache', 'mach', packagesdirname, 'yum') + ''' >+cachedir = /../../../../..''' + os.path.join ('@LOCALSTATEDIR@', 'cache', 'mach', packagesdirname, 'dnf') + ''' > reposdir = /../../../../..''' + os.path.join (state, 'yum', 'yum.repos.d') > > # if the distro's config dict contains "excludearch", add an exclude >@@ -1791,14 +1791,14 @@ > words.append("*.%s" % arch) > conf = conf + "\nexclude = %s\n" % " ".join(words) > >- self.set_state ("yum.conf", conf) >+ self.set_state ("dnf.conf", conf) > > # create sources.list > srcs = get_sources_dict (config) > create_sources_list (config, srcs) > > # run installer update >- if self.config['installer'] != 'yum': >+ if self.config['installer'] != 'dnf': > self.installer (["update", ], "Updating installer", > self.progress ()) > >@@ -1850,7 +1850,7 @@ > > def _upgrade_packages (self): > # make the installer upgrade everything to the latest version >- if self.config['installer'] == 'yum': >+ if self.config['installer'] == 'dnf': > self.installer (["-y update", ]) > else: > self.installer (["-y update", ]) >@@ -2206,8 +2206,8 @@ > root = config['root'] > for platform in config['sourceslist'][root].keys (): > for source in config['sourceslist'][root][platform]: >- if config['installer'] == 'yum': >- sourcestype = 'yumsources' >+ if config['installer'] == 'dnf': >+ sourcestype = 'dnfsources' > else: > sourcestype = 'aptsources' > try: >@@ -2234,7 +2234,7 @@ > sys.exit (1) > > >- if config['installer'] == 'yum': >+ if config['installer'] == 'dnf': > debug ("Creating files in yum.repos.d") > for source in list.keys(): > line = list[source] >@@ -2245,35 +2245,31 @@ > # we want to set metadata_expire to 0 for local files, so that we > # can immediately use results of local builds > if line.startswith('file://'): >- v = yum_version () >- debug ('local repository, and yum version %r' % (v, )) >- if v >= (2, 6, 0): >- debug ('adding line to expire_metadata for local repo') >- sources.write("metadata_expire=0\n") >- else: >- debug ('yum < 2.6.0, no need to add expire_metadata') >+ debug ('local repository, and dnf version %r' % (v, )) >+ debug ('adding line to expire_metadata for local repo') >+ sources.write("metadata_expire=0\n") > >- ensure_dir (os.path.join (root, 'var/cache/mach/yum/%s/packages' % source)) >- ensure_dir (os.path.join (root, 'var/cache/mach/yum/%s/headers' % source)) >+ ensure_dir (os.path.join (root, 'var/cache/mach/dnf/%s/packages' % source)) >+ ensure_dir (os.path.join (root, 'var/cache/mach/dnf/%s/headers' % source)) > if source.startswith('local.'): > debug ('updating local repository %s' % source) > cmd = 'createrepo %s/usr/src/@PKGDIR@/RPMS.mach-local' % root > (status, output) = do_with_output (cmd, False) > if status != 0: >- raise Exception, "Could not update local yum repository" >- # at some point yum seems to not properly realize the repo is >- # updated; do the equivalent of yum clean metadata only for >+ raise Exception, "Could not update local dnf repository" >+ # at some point dnf seems to not properly realize the repo is >+ # updated; do the equivalent of dnf clean metadata only for > # the local repo > packagesdirname = config['packages']['dir'] > for file in ['cachecookie', 'primary.xml.gz', 'repomd.xml']: > fullpath = os.path.join ('@LOCALSTATEDIR@', 'cache', >- 'mach', packagesdirname, 'yum', source, file) >+ 'mach', packagesdirname, 'dnf', source, file) > debug ('checking for removal of %s' % fullpath) > if os.path.exists (fullpath): > cmd = '%s %s' % (config['rm'], fullpath) > (status, output) = do_with_output (cmd, False) > >- ensure_dir (os.path.join (root, 'var/cache/mach/yum/%s/packages' % source)) >+ ensure_dir (os.path.join (root, 'var/cache/mach/dnf/%s/packages' % source)) > sources.close () > else: > debug ("Creating sources.list") >@@ -2326,16 +2322,6 @@ > "usermod --append -G mach %s\n" % os.getlogin()) > sys.exit (1) > >-# return the yum version as a tuple >-def yum_version (): >- # my FC5 yum prints "Loading installonlyn" plugin as the first line. ugh. >- # my FC9 yum prints a whole bunch of crap about installed rpms after the >- # first line. ugh+ >- output = commands.getoutput ('yum --version 2>/dev/null | grep -v "Loading installonlyn" | head -n 1') >- version = output.rstrip () >- l = map (int, version.split (".")) >- return tuple (l) >- > # check if everything is in order to actually do stuff > def sanity_check (config): > user_check () >@@ -2514,7 +2500,7 @@ > # be interactive > if command == "apt-get": command = "intaptget" > if command == "apt-cache": command = "aptcache" >- if command == "yum": command = "yum" >+ if command == "dnf": command = "dnf" > > if command == "status": > status (config) >diff -ur mach-1.0.4.orig/src/mach-helper.c mach-1.0.4/src/mach-helper.c >--- mach-1.0.4.orig/src/mach-helper.c 2012-11-10 12:49:11.000000000 +0100 >+++ mach-1.0.4/src/mach-helper.c 2015-03-25 10:22:39.177137509 +0100 >@@ -223,14 +223,14 @@ > do_command ("/usr/bin/apt-get", &(argv[1])); > } > >-/* allow yum -c (statesdir/.../yum.conf) ... */ >+/* allow dnf -c (statesdir/.../dnf.conf) ... */ > void >-do_yum (int argc, char *argv[]) >+do_dnf (int argc, char *argv[]) > { > char *installroot = NULL; > > /* enough arguments ? >- * mach-helper yum -c (statesdir/.../yum.conf) --installroot=..., 6 */ >+ * mach-helper dnf -c (statesdir/.../dnf.conf) --installroot=..., 6 */ > if (argc < 6) > error ("not enough arguments"); > >@@ -248,7 +248,7 @@ > installroot = argv[4] + 14; > check_dir_allowed (rootsdir, installroot); > >- do_command ("/usr/bin/yum", &(argv[1])); >+ do_command ("/usr/bin/dnf", &(argv[1])); > } > > void >@@ -491,8 +491,8 @@ > do_rpm (argc, argv); > else if (strncmp ("apt-get", argv[1], 7) == 0) > do_apt_get (argc, argv); >- else if (strncmp ("yum", argv[1], 3) == 0) >- do_yum (argc, argv); >+ else if (strncmp ("dnf", argv[1], 3) == 0) >+ do_dnf (argc, argv); > else if (strncmp ("mknod", argv[1], 5) == 0) > do_mknod (argc, argv); > else if (strncmp ("env", argv[1], 3) == 0)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1156528
: 1006225