[Scons-users] tagging files (RPM packaging)
Werner Reisberger
wr at pure.ch
Mon Jan 3 02:06:10 EST 2022
On 2022-01-02 23:10, Bill Deegan wrote:
> Do you have either:
> env = Environment(tools=["default", "packaging"])
>
> Or
> env =Environment(...)
>
> and then
> env.Tool('packaging')
>
> ?
I called it as written in the man page.
env = Environment(tools=["default", "packaging"])
folowed by
env.Package( ... )
Please see below my full SConstruct file. You can just run it after
creating some dummy input files.
I also created a github repo for this
https://github.com/wrbr/sconstest/
This repo is also for testing hierarchical RPM builds which doesn't work
out of the box. I will open a separate thread for this.
--Werner
> On Sun, Jan 2, 2022 at 2:52 AM Werner Reisberger <wr at pure.ch> wrote:
>
>> On 2022-01-01 23:00, Bill Deegan wrote:
>>> Can you try:
>>>
>>> Tag('file2.txt', 'DOC')
>>
>> This gives me: AttributeError: 'SConsEnvironment' object has no
>> attribute 'Tag':
>> Calling
>> env.Tag('file2.txt', 'DOC')
>> gives: AttributeError: 'str' object has no attribute 'Tag':
>>
>> Please find below an example of a basic SConstruct file which
>> should
>> make the behaviour more clear. I am working on Redhat 7 and Centos
>> 8
>> with python 3.6.8 and SCons v4.3.0.
>>
>> The test directory looks like
>>
>> bin/ etc/ man/ SConstruct
>>
>> .../bin: ./etc: ./man:
>> a.sh c.conf m.txt
>>
>> Running scons with the below SConstruct produces a rpm with all
>> three
>> files. The bin/a.sh has the right file attributes when installed. I
>>
>> don't replicate the full directory structure but for the sake of
>> demonstrating the tagging behaviour this should be sufficient.
>>
>> I could open a github project for this but I would rather offer to
>> extend the existing tagging test
>>
> (https://github.com/SCons/scons/blob/master/test/packaging/rpm/tagging.py
>> [1])
>> which will give the opportunity to dive a bit into the python code
>> :)
>>
>> Basically I would like to use SCons to build a couple of RPM's
>> which are
>> currently build by make. It's mostly precompiled stuff.
>>
>> --Werner
>>
>>
> #################################################################################################
>> env = Environment(tools=["default", "packaging"])
>> mma = File([ "bin/a.sh", "etc/c.conf", "man/m.txt" ])
>> env.Install("/var/tmp/tagtest", mma)
>> # following tagging works
>> env.Tag(mma[0], UNIX_ATTR='(755, root, adm)')
>> env.Tag(mma[1], CONFIG=' ') # adds an extra space between attribute
>> and
>> filename
>> env.Tag(mma[2], DOC=' ')
>> # should work according to docs but does not
>> # env.Tag("bin/a.sh", UNIX_ATTR='0o755')
>> # env.Tag("etc/c.conf", CONFIG)
>> # env.Tag("man/m.txt", DOC)
>> env.Package(
>> NAME='tagtest',
>> VERSION='1.0.0',
>> PACKAGEVERSION=0,
>> LICENSE="gpl",
>> PACKAGETYPE="rpm",
>> SUMMARY="Check tags",
>> DESCRIPTION="test basics",
>> X_RPM_GROUP="build/tools",
>> )
>>
> ###################################################################################################
>>> On Sat, Jan 1, 2022 at 1:57 PM Bill Deegan
>> <bill at baddogconsulting.com>
>>> wrote:
>>>
>>>> Also:
>>>> Which version of Python?
>>>>
>>>> Which version of SCons?
>>>> Which OS and version are you running?
>>>>
>>>> Thanks,
>>>> Bill
>>>>
>>>> On Sat, Jan 1, 2022 at 1:55 PM Bill Deegan
>>>> <bill at baddogconsulting.com> wrote:
>>>>
>>>> Werner,
>>>>
>>>> Can you make a sample github repo with all the attributes you're
>>>> trying to use, and an example rpmspec file?
>>>>
>>>> That should provide enough information to make sure we fix the
>> issue
>>>> you're running into.
>>>>
>>>> Thanks,
>>>> Bill
>>>> SCons Project Co-Manager
>>>>
>>>> On Sat, Jan 1, 2022 at 9:45 AM Mats Wichmann <mats at wichmann.us>
>>>> wrote:
>>>> On 1/1/22 07:16, Werner Reisberger wrote:
>>>>> The RPM packages I am trying to build with SCons require
>> certain
>>>> tags
>>>>> but most of the tags does not work out of the box.
>>>>>
>>>>> E.g. The SCons man page proposes the following call to tag a
>> file
>>>> with
>>>>> the DOC attribute:
>>>>>
>>>>> # marks file2.txt to be a documentation file
>>>>> Tag('file2.txt', DOC)
>>>>>
>>>>> This does not work. I have to say
>>>>>
>>>>> Tag('file2.txt', DOC=' ')
>>>>>
>>>>> That's because the tag is defined as
>>>>>
>>>>> 'PACKAGING_DOC' : '%%doc %s',
>>>>>
>>>>> but DOC attributes in RPM spec files have the format
>>>>>
>>>>> %doc file_name
>>>>>
>>>>> It's different with the UNIX_ATTR tag where file mode and
>>>> owner/group
>>>>> have to be appended like
>>>>>
>>>>> %attr(644, root, adm) /etc/yp.conf
>>>>>
>>>>> The tag command for UNIX_ATTR in the SCons man page also
>> doesn't
>>>> work:
>>>>>
>>>>> # makes sure the built library will be installed with
>>>> 644 file
>>>>> access mode
>>>>> Tag(Library('lib.c'), UNIX_ATTR="0o644")
>>>>>
>>>>> You need to follow the RPM specification
>>>>>
>>>>
>>>
>>
> (http://ftp.rpm.org/max-rpm/s1-rpm-anywhere-specifying-file-attributes.html
>> [2]
>>>> [1])
>>>>>
>>>>>
>>>>> However the tagging test script on GitHub does it right.
>>>>>
>>>>> Like the DOC attribute the following tag definitions need to be
>>>> fixed:
>>>>>
>>>>> 'PACKAGING_CONFIG' :
>> '%%config
>>>> %s', # =>
>>>>> '%%config'
>>>>> 'PACKAGING_CONFIG_NOREPLACE' :
>>>> '%%config(noreplace) %s', # =>
>>>>> '%%config(noreplace)'
>>>>> 'PACKAGING_UNIX_ATTR' : '%%attr
>>>> %s', # =>
>>>>> '%%attr(%s)'
>>>>> 'PACKAGING_LANG_' :
>>>> '%%lang(%s) %s', # =>
>>>>> '%%lang(%s)'
>>>>> 'PACKAGING_X_RPM_VERIFY' : '%%verify
>>>> %s', # =>
>>>>> '%%verify (%s)' ?
>>>>> 'PACKAGING_X_RPM_DIR' : '%%dir
>>>> %s', # =>
>>>>> '%%dir'
>>>>> 'PACKAGING_X_RPM_DOCDIR' : '%%docdir
>>>> %s', # =>
>>>>> '%%docdir'
>>>>> 'PACKAGING_X_RPM_GHOST' : '%%ghost
>> %s',
>>>> } # =>
>>>>> '%%ghost'
>>>>>
>>>>> Unfortunately my python knowledge is rather basic but let me
>> know
>>>> how I
>>>>> can help.
>>>>
>>>> Looks like this code hasn't been touched in a very long time
>>>> (except for
>>>> some fiddling of docstrings and newer Python syntax, it's
>> largely
>>>> unchanged since 2007) . One wonders if it's actually being
>> used -
>>>> you
>>>> may be a trailblazer here! Not sure if the actual problem is the
>>>> tag
>>>> specifications or the tag "compiler" in the code, we should be
>> able
>>>> to
>>>> figure it out though. Help could be as simple as providing a
>>>> minimal
>>>> SConscript that shows the problem.
>>>>
>>>>>
>>>>> Happy 2022 and keep on going with your great work!
>>>>>
>>>>
>>>> Thanks!
>>>>
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-users at scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users [3] [2]
>>>
>>>
>>> Links:
>>> ------
>>> [1]
>>>
>>
> http://ftp.rpm.org/max-rpm/s1-rpm-anywhere-specifying-file-attributes.html
>> [2]
>>> [2] https://pairlist4.pair.net/mailman/listinfo/scons-users [3]
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users [3]
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users [3]
>
>
> Links:
> ------
> [1]
> https://github.com/SCons/scons/blob/master/test/packaging/rpm/tagging.py
> [2]
> http://ftp.rpm.org/max-rpm/s1-rpm-anywhere-specifying-file-attributes.html
> [3] https://pairlist4.pair.net/mailman/listinfo/scons-users
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
More information about the Scons-users
mailing list