Mercurial Fetcher and AUTOREV - mercurial

I'm trying to get a bitbake file to pull down the latest revision of a mercurial repo when it builds. It's unfortunately undocumented (https://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html#auto-revisions), though there are a few mailing list posts on the topic. None of my attempts to recreate their methods have panned out.
This is what the .bb file looks like:
###############################################################################
# Variables for locations.
###############################################################################
SRC_URI = "hg://foo//bar/foobar/test;rev=${SRCREV};protocol=ssh;branch=default;module=root"
SRCREV = "${AUTOREV}"
# Sources are downloaded to an hg subdirectory when pulling a repo.
S = "${WORKDIR}/hg"
###############################################################################
# The version of the library we're going to install.
###############################################################################
# Set PV to SRCPV so bitbake knows it should always check SRC_URI for a new
# version of the application.
PV = "${SRCPV}"
PR = "r0"
PE = "1"
And here's the relevant part of the output error:
/usr/bin/env hg up -C -r AUTOINC
| DEBUG: Python function base_do_unpack finished
| DEBUG: Python function do_unpack finished
| ERROR: Function failed: Fetcher failure: Fetch command failed with exit code 255, output:
| abort: unknown revision 'AUTOINC'!
|
NOTE: recipe test-1_AUTOINC+AUTOINC-r0: task do_unpack: Failed
DEBUG: Teardown for bitbake-worker
NOTE: Tasks Summary: Attempted 361 tasks of which 359 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/home/intern/git/poky/meta/recipes-core/test/test_0.0.1.bb, do_unpack
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
The problem seems to be that AUTOREV is resolving to AUTOINC instead of a hash number. Any thoughts on what I can change to fix this?

You can use "tip" as source revision like:
SRCREV = "tip"
SRCMODULE = "myapp"
SRC_URI = "hg://hg_server_url;rev=${SRCREV};protocol=http;branch=${SRCBRANCH};module=${SRCMODULE}"
Keep only in mind (found that hard way) that hg_server_url shouldn't include target repo subname, but include it as SRCMODULE !

Related

Snort 3.1.47 Configuration Issue on CentOS 8.5: undefined variable name: RULE_PATH

I'm working to install snort 3.1.47 on CentOS 8.5 while following the "Snort 3.1.00 on CentOS 8 Stream" manual from Snort's official documentation.
I finished configuring snort along with this manual and I'm now trying to start Snort on my network interface using the following command.
/usr/local/snort/bin/snort -c /usr/local/snort/etc/snort/snort.lua -i enp37s0 -l /var/log/snort --plugin-path /usr/local/snort/extra -k none
However, the output this command generates mentions the error FATAL: ips.rules:2 undefined variable name: RULE_PATH while reading my snort.lua file.
The content of the ips array inside my snort.lua file is as follows:
ips =
{
mode = tap,
rules = [[
include $RULE_PATH/snort3-app-detect.rules
include $RULE_PATH/snort3-browser-chrome.rules
include $RULE_PATH/snort3-browser-firefox.rules
...
include $RULE_PATH/snort3-x11.rules
]]
}
The RULE_PATH variable is defined in the snort_defaults.lua file:
---------------------------------------------------------------------------
-- default paths
---------------------------------------------------------------------------
-- Path to your rules files (this can be a relative path)
RULE_PATH = '../../rules'
BUILTIN_RULE_PATH = '../../builtin_rules'
PLUGIN_RULE_PATH = '../../so_rules'
-- If you are using reputation preprocessor set these
PASS_LIST_PATH = '../../intel'
BLOCK_LIST_PATH = '../../intel'
I don't understand why it would be undefined, because snort_defaults.lua is imported at the beginning of the snort.lua file:
---------------------------------------------------------------------------
-- 2. configure defaults
---------------------------------------------------------------------------
-- HOME_NET and EXTERNAL_NET must be set now
-- setup the network addresses you are protecting
HOME_NET = [[ 192.168.1.0/24 ]]
-- set up the external network addresses.
-- (leave as "any" in most situations)
EXTERNAL_NET = 'any'
-- dofile(conf_dir .. '/snort_defaults.lua')
-- dofile(conf_dir .. '/file_magic.lua')
include 'snort_defaults.lua'
include 'file_magic.lua'
What could be making Snort think that my RULE_PATH variable is undefined?
I have googled to fix this issue, but I could not find the right solution.
Thanks you in advance for your answer.
Regards.

COPR fedoraproject.org builder refuses to download sources specified in my .spec file

I have a package build in https://copr.fedoraproject.org. My spec for rpkg is here. The build is failing with the following
Generated rpkg config:
[rpkg]
preprocess_spec = True
[git]
anon_clone_url = https://github.com/%(repo_path)s
[lookaside]
download_url = https://${git_props:remote_netloc}/repo/pkgs/%(repo_path)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s
Writing config into /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/.config/rpkg.conf
Running: rpkg srpm --outdir /var/lib/copr-rpmbuild/results --spec /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router
cmd: ['rpkg', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/results', '--spec', '/var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router']
cwd: /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router
rc: 1
stdout: Wrote: /var/lib/copr-rpmbuild/results/skupper-router.spec
stderr: git_dir_pack: archiving /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router:
commit cb2a29004b1660168cc4a6894e521b0cf71cb25d (HEAD -> jd_2022_03_15_rpm, origin/jd_2022_03_15_rpm)
Date: Sat Apr 9 01:04:32 2022 +0200
add static build rpm
git_dir_pack: Wrote: /var/lib/copr-rpmbuild/results/skupper-router-cb2a2900.tar.gz
error: Bad source: /var/lib/copr-rpmbuild/results/qpid-proton-0.37.0.tar.gz: No such file or directory
Copr build error: git_dir_pack: archiving /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router:
commit cb2a29004b1660168cc4a6894e521b0cf71cb25d (HEAD -> jd_2022_03_15_rpm, origin/jd_2022_03_15_rpm)
Date: Sat Apr 9 01:04:32 2022 +0200
add static build rpm
git_dir_pack: Wrote: /var/lib/copr-rpmbuild/results/skupper-router-cb2a2900.tar.gz
error: Bad source: /var/lib/copr-rpmbuild/results/qpid-proton-0.37.0.tar.gz: No such file or directory
(full log at https://download.copr.fedorainfracloud.org/results/jdanek/skupper-router/srpm-builds/04126008/builder-live.log.gz)
On my machine, running rpkg srpm succeeds.
I searched around and it seems to me that COPR should be willing to download sources if they are distributed over https, which mine are.
Can I use the lookaside cache feature, somehow, for my sources?
Normally, downloading the qpid-proton file by https would work in Copr. It's done by rpmbuild (being invoked by rpkg) if there is %_disable_source_fetch 0 defined in rpm macros somewhere.
The problem is that one of the lines in the spec file is: %undefine _disable_source_fetch which disables this behavior for the given spec file.
Your build fails on the git_dir_pack (rpkg-util, aka rpkg failure). This happened before the rpmbuild process even started.
A few weeks ago we migrated the Copr builders to Fedora 35,
and thus also to rpkg-util v3. Feel free to take a look how
to fix similar issues.
Or perhaps contact the rpkg-util upstream for a guidance.
The problem is that the sources file apparently must be downloaded from the lookaside cache. So, let's create ourselves one. Or at least, the appearance of one.
First, download the required source archive to your computer, to the git repo checkout dir, and do an "offline upload" using rpkg
wget https://www.apache.org/dist/qpid/proton/0.37.0/qpid-proton-0.37.0.tar.gz
rpkg upload --offline qpid-proton-0.37.0.tar.gz
This creates sources file. Commit that to the repo. Undo the edit to .gitignore that this also did. (If that rpkg command fails, ignore that as long as the sources file got created.)
Create new file rpkg.conf with the following content, and commit it to repo.
[lookaside]
download_url = https://www.apache.org/dist/qpid/proton/0.37.0/%(filename)s
Now push that and build it in COPR.
(Don't get confused by the obviously wrong download_url printed below; our rpkg.conf in the repo directory is overriding that.)
Running: git checkout jd_2022_03_15_rpm_cstdint
cmd: ['git', 'checkout', 'jd_2022_03_15_rpm_cstdint']
cwd: /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router
rc: 0
stdout: branch 'jd_2022_03_15_rpm_cstdint' set up to track 'origin/jd_2022_03_15_rpm_cstdint'.
stderr: Switched to a new branch 'jd_2022_03_15_rpm_cstdint'
Generated rpkg config:
[rpkg]
preprocess_spec = True
[git]
anon_clone_url = https://github.com/%(repo_path)s
[lookaside]
download_url = https://${git_props:remote_netloc}/repo/pkgs/%(repo_path)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s
Writing config into /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/.config/rpkg.conf
Running: rpkg srpm --outdir /var/lib/copr-rpmbuild/results --spec /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router
cmd: ['rpkg', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/results', '--spec', '/var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router']
cwd: /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router
rc: 0
stdout: Downloading qpid-proton-0.37.0.tar.gz from jiridanek/skupper-router at www.apache.org:
Wrote: /var/lib/copr-rpmbuild/results/skupper-router.spec
Wrote: /var/lib/copr-rpmbuild/results/skupper-router-0.0.git.3560.d7714b9c-2.0.0.fc35.src.rpm
stderr: git_dir_pack: archiving /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router:
commit d7714b9cac0641d4e34c0774b875fcb67cee8793 (HEAD -> jd_2022_03_15_rpm_cstdint, origin/jd_2022_03_15_rpm_cstdint)
Author: Jiri Daněk <jdanek#redhat.com>
Date: Wed Apr 13 17:13:22 2022 +0200
add autopack
git_dir_pack: Wrote: /var/lib/copr-rpmbuild/results/skupper-router-d7714b9c.tar.gz
Output: ['skupper-router.spec', 'qpid-proton-0.37.0.tar.gz', 'skupper-router-0.0.git.3560.d7714b9c-2.0.0.fc35.src.rpm', 'skupper-router-d7714b9c.tar.gz']
Success!

Failed to import extension mercurial_keyring - Rhodecode - Object has no attribute NullHandler

Machine Env: Windows7 box with Cygwin/TortoiseHg, Linux box (RHEL).
Mercurial/Hg - 3.0.1 version
I'm trying to integrate mercurial_keyring to perform username/password less operations. Mercurial keyring prompts first time per user / per repository link but after that, it doesn't prompt.
Our Hg repository code recently migrated to RhodeCode.
I have mercurial_keyring.py (python) file available on my machine (provided by this link): https://pypi.python.org/pypi/mercurial_keyring and https://bitbucket.org/Mekk/mercurial_keyring/src/tip/mercurial_keyring.py
While doing hg clone or any hg command, I'm getting the following error when used at command prompt (either in Linux or Windows machine via Cygwin).
*** failed to import extension hgext.mercurial_keyring from /root/AKS/goga/mercurial_keyring.py: 'module' object has no attribute 'NullHandler'
My ~/.hgrc file looks like:
# example config (see "hg help config" for more info)
[ui]
# name and email, e.g.
# username = Jane Doe <jdoe#example.com>
username=koba <koba.loki#shenzi.com>
[extensions]
# uncomment these lines to enable some popular extensions
# (see "hg help extensions" for more info)
# pager =
# progress =
# color =
hgext.mercurial_keyring = /root/AKS/goga/mercurial_keyring.py
[paths]
default = http://hg-server.cm.shenzi.com:8082
[auth]
default1.schemes = http https
default1.prefix = hg-server:8082
default1.username = koba
default.schemes = http https
default.prefix = hg-server.cm.shenzi.com:8082
default.username = koba
default3.schemes = http https
default3.prefix = 12.112.91.112
default3.username = koba
In Cygwin, I also got another error:
*** failed to import extension hgext.mercurial_keyring from ~/MerKeyRing/mercurial_keyring.py: No module named keyring

"gclient sync" fails due to SSL3 certificate verify failed

I have been trying to fetch chromium source code. However, I got stuck on gclient sync for 2 days.
gclient sync fails every time due to error related to SSL certificate verification failure.
LOG is as below:
rna#rna-P580:~/workspace/project$ gclient sync
Syncing projects: 98% (83/84), done.
________ running 'download_from_google_storage --no_resume --platform=linux* --no_auth --bucket chromium-gn -s src/buildtools/linux32/gn.sha1' in '/home/rna/workspace/project'
/home/rna/workspace/project/depot_tools/third_party/boto/pyami/config.py:75: UserWarning: Unable to load AWS_CREDENTIAL_FILE ()
warnings.warn('Unable to load AWS_CREDENTIAL_FILE (%s)' % full_path)
Failure: [Errno 1] _ssl.c:509: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed.
Error: Command download_from_google_storage --no_resume --platform=linux* --no_auth --bucket chromium-gn -s src/buildtools/linux32/gn.sha1 returned non-zero exit status 1 in /home/rna/workspace/project
I am guessing this happens because i am behind company firewall.
So I requested to open http & https. But still no luck.
Can someone help me out, please? I'm on ubuntu 13.10
I ran into this problem as well, what fixed it for me was doing: sudo apt-get update and sudo apt-get upgrade.
I modified DEPS below /trunk directory, comment some code as :
#{
# # Download test resources, i.e. video and audio files from Google Storage.
# "pattern": "\\.sha1",
# "action": ["download_from_google_storage",
# "--directory",
# "--recursive",
# "--num_threads=10",
# "--no_auth",
# "--bucket", "chromium-webrtc-resources",
# Var("root_dir") + "/resources"],
# },
,
and retry to run gclient runhooks and I can get a correct result.
FROM:
https://code.google.com/p/webrtc/issues/detail?id=3314

Mercurial and Bugzilla integration?

I try to make the Mercurial work with my existing Bugzilla setup. however, it didn't work. The local hgrc is attached below for reference.
My question is, how I can trace whether the bugzilla is called/executed once I submit a "hg commit"?
Every time I do a commit, the following error is presented, and I suspect the bugzilla is not executed.
[root test01]# hg -v com -m "BZ 686" file
could not import hgext.hgext.bugzilla (No module named hgext.bugzilla): trying hgext.bugzilla
file
committed changeset 57:0c26a22fc01f
If I configured the extension as below, there is no error, but there is no comment insert into the Bugzilla DB. So it means this also does not work.
[extensions]
bugzilla = /usr/local/lib64/python2.5/site-packages/hgext/bugzilla.py
please help!
paul
P.S. below is the content of the hgrc file.
============
[extensions]
hgext.bugzilla =
[ui]
debug = true
verbose = True
[web]
contact = Admin <db#127.0.0.1>
description = Testing
allow_push = account01
push_ssl = False
baseurl = /HG001/DEV/test01
[hooks]
incoming.bugzilla = python:hgext.bugzilla.hook
[bugzilla]
host = 127.0.0.1
db = bugs
password = db
version = 3.0
strip = 4
bzuser = db#1.0.0.127
hgweb = http://127.0.0.1
bzdir = /var/www/html/bugzilla
template = Changeset {node|short}, made by {author} in the {webroot} repos, refers to this bug.\n
For complete details, see
{hgweb}{webroot}?cmd=changeset;node={node|short}\n
Changeset Description:\n
\t{desc|tabindent}
[usermap]
hguser=bugzilla.user#domain.com
Thanks. BTW, I tried to use the debug mode during the "hg commit". it is found that the hooks are really not being called to execute. any idea?
[root test01]# hg --verbose --debug --traceback --debugger com -m "BZ 686:a" file
entering debugger - type c to continue starting hg or h for help
/HG001/PD/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(86)_runcatch()
(Pdb) b 3
End of file
(Pdb) r
d
committed changeset 75:4b90f38e600ac153ec305413345d2836c6358c50
--Return--
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(89)_runcatch()->None
(Pdb) r
--Return--
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(64)dispatch()->None
(Pdb) r
SystemExit: None
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(27)run()
(Pdb) r
--Return--
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(27)run()->None
(Pdb) r
SystemExit: None
/usr/local/bin/hg(38)()
-> mercurial.dispatch.run()
(Pdb)
if I run a simple hooks [running hook pretxncommit], I can see it is being executed. but the "incoming.bugzilla" seems not being called.
I also use the "hg help extensions" in my execeution path, the bugzilla extension id enabled.
enabled extensions:
bugzilla
hooks for integrating with the Bugzilla bug tracker
[root# test01]# hg --verbose --debug --traceback --debugger com -m "BZ 686:a" d
entering debugger - type c to continue starting hg or h for help
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(86)_runcatch()
-> try:
(Pdb) r
rd
running hook pretxncommit.bug_id_required: ./check_bug_id $HG_NODE
rcommitted changeset 82:dcadb6ed6c0a28a76d25473ab2f5346967e9b103
--Return--
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(89)_runcatch()->None
-> ui.flush()
(Pdb) r
--Return--
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(64)dispatch()->None
-> return _runcatch(req)
(Pdb) r
SystemExit: None
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(27)run()
-> sys.exit(dispatch(request(sys.argv[1:])))
(Pdb) r
--Return--
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(27)run()->None
-> sys.exit(dispatch(request(sys.argv[1:])))
(Pdb) r
SystemExit: None
/usr/local/bin/hg(38)()
-> mercurial.dispatch.run()
(Pdb) r
--Return--
/usr/local/bin/hg(38)()->None
-> mercurial.dispatch.run()
(Pdb) r
The extension should be just bugzilla, as far as I remember.
[extensions]
bugzilla =
And probably the hook should also be plain bugzilla.hook instead of hgext.bugzilla.hook.