Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] createrepo: Implement --dbpath command line option
Date: Wed, 1 Apr 2015 15:12:18 +0300	[thread overview]
Message-ID: <20150401121218.GA11145@linux.intel.com> (raw)
In-Reply-To: <1427890012-10595-1-git-send-email-ed.bartosh@linux.intel.com>

On Wed, Apr 01, 2015 at 03:06:52PM +0300, Ed Bartosh wrote:
> --dbpath option can be used in cases where users don't want
> createrepo to use system rpm db to avoid possible collisiouns
> with other programs.
> 
> For bitbake builds it would be possible to specify different
> databases even for every createrepo run. Considering that rootfs
> builds can run multiple createrepo in parallel, it can help to avoid
> race conditions caused by accessing or creating the same rpm database
> by multiple createrepo instances at the same time.
> 
> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
> ---
>  .../createrepo/createrepo/createrepo-dbpath.patch  | 51 ++++++++++++++++++++++
>  .../createrepo/createrepo_0.4.11.bb                |  1 +
>  2 files changed, 52 insertions(+)
>  create mode 100644 meta/recipes-support/createrepo/createrepo/createrepo-dbpath.patch
> 
> diff --git a/meta/recipes-support/createrepo/createrepo/createrepo-dbpath.patch b/meta/recipes-support/createrepo/createrepo/createrepo-dbpath.patch
> new file mode 100644
> index 0000000..2b113bf
> --- /dev/null
> +++ b/meta/recipes-support/createrepo/createrepo/createrepo-dbpath.patch
> @@ -0,0 +1,51 @@
> +--- createrepo-0.4.11.orig/genpkgmetadata.py	2015-03-30 22:18:19.904000000 +0300
> ++++ createrepo-0.4.11.orig/genpkgmetadata.py	2015-03-30 22:28:49.208000000 +0300
> +@@ -65,6 +65,7 @@
> +      -p, --pretty = output xml files in pretty format.
> +      --update = update existing metadata (if present)
> +      -d, --database = generate the sqlite databases.
> ++     --dbpath <dir> = specify path to rpm db directory.
> +     """)
> + 
> +     sys.exit(retval)
> +@@ -72,10 +73,13 @@
> + class MetaDataGenerator:
> +     def __init__(self, cmds):
> +         self.cmds = cmds
> +-        self.ts = rpm.TransactionSet()
> +         self.pkgcount = 0
> +         self.files = []
> + 
> ++        if self.cmds['dbpath']:
> ++            rpm.addMacro("_dbpath", self.cmds['dbpath'])
> ++        self.ts = rpm.TransactionSet()
> ++
> +     def _os_path_walk(self, top, func, arg):
> +         """Directory tree walk with callback function.
> +          copy of os.path.walk, fixes the link/stating problem
> +@@ -435,6 +439,7 @@
> +     cmds['dir-pattern-match'] = ['.*bin\/.*', '^\/etc\/.*']
> +     cmds['skip-symlinks'] = False
> +     cmds['pkglist'] = []
> ++    cmds['dbpath'] = None
> + 
> +     try:
> +         gopts, argsleft = getopt.getopt(args, 'phqVvndg:s:x:u:c:o:CSi:', ['help', 'exclude=',
> +@@ -442,7 +447,7 @@
> +                                                                   'baseurl=', 'groupfile=', 'checksum=',
> +                                                                   'version', 'pretty', 'split', 'outputdir=',
> +                                                                   'noepoch', 'checkts', 'database', 'update',
> +-                                                                  'skip-symlinks', 'pkglist='])
> ++                                                                  'skip-symlinks', 'pkglist=', 'dbpath='])
> +     except getopt.error, e:
> +         errorprint(_('Options Error: %s.') % e)
> +         usage()
> +@@ -516,6 +521,8 @@
> +                 cmds['skip-symlinks'] = True
> +             elif arg in ['-i', '--pkglist']:
> +                 cmds['pkglist'] = a
> ++            elif arg == '--dbpath':
> ++                cmds['dbpath'] = os.path.realpath(a)
> +                                 
> +     except ValueError, e:
> +         errorprint(_('Options Error: %s') % e)
> diff --git a/meta/recipes-support/createrepo/createrepo_0.4.11.bb b/meta/recipes-support/createrepo/createrepo_0.4.11.bb
> index 49b45fc..adc193e 100644
> --- a/meta/recipes-support/createrepo/createrepo_0.4.11.bb
> +++ b/meta/recipes-support/createrepo/createrepo_0.4.11.bb
> @@ -14,6 +14,7 @@ SRC_URI= "http://createrepo.baseurl.org/download/${BP}.tar.gz \
>            file://python-scripts-should-use-interpreter-from-env.patch \
>  	  file://createrepo-rpm549.patch \
>  	  file://recommends.patch \
> +	  file://createrepo-dbpath.patch \
>  	  file://rpm-createsolvedb.py \
>           "
>  

Please, don't apply this patch. I've just sent updated one. Sorry for the confusion.


-- 
Regards,
Ed


  reply	other threads:[~2015-04-01 12:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-30  8:30 [PATCH] rootfs.py: Remove rpm database from staging area Ed Bartosh
2015-03-30  8:53 ` Richard Purdie
2015-03-30 14:56   ` Mark Hatle
2015-03-30 15:14   ` Mark Hatle
2015-03-30 19:00     ` Ed Bartosh
2015-03-30 19:22       ` Mark Hatle
2015-03-30 22:47     ` Ed Bartosh
2015-03-30 23:49       ` [PATCH] createrepo: Implement --dbpath command line option Ed Bartosh
2015-03-31  0:16         ` [PATCH] package_manager: call createrepo with --dbpath pointing inside WORKDIR Ed Bartosh
2015-03-31 12:06           ` Richard Purdie
2015-03-31 16:09           ` Mark Hatle
2015-04-01 11:17             ` Ed Bartosh
2015-03-31 21:25         ` [PATCH] createrepo: Implement --dbpath command line option Burton, Ross
2015-04-01 11:19           ` Ed Bartosh
2015-04-01 12:06           ` Ed Bartosh
2015-04-01 12:12             ` Ed Bartosh [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-04-01 12:09 Ed Bartosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150401121218.GA11145@linux.intel.com \
    --to=ed.bartosh@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox