Config spec for UCM components - clearcase-ucm

this is kind of a follow up to this question: ClearCase UCM: Get latest version from Dev-stream
I need a dynamic view to have the LATEST (or CHECKED_OUT) version of certain components of a UCM VOB and at the same time specific baselines for other components.
For components where I want to include a specific baseline I can just include them with
element component_1/... BASELINEwhere BASELINE is just a name of a baseline (without the need to specify a stream or anything).
The folder of the component is later included by a element * /main/LATEST-directive (at least to my knowledge).
As mentioned in the above mentioned link I can also add a line likeelement component_2/... /main/INT-STREAM/DEV-STREAM/LATEST which should give me the latest version of DEV-STREAM.
Now I found out that sometimes (when the DEV-STREAM was 'branched' from version /main/0 I need a element component_2/... /main/DEV-STREAM/LATESTto get the latest version of this component. And in other cases there is no DEV-STREAM (because the file was obviously never changed and therefore the DEV-STREAM is not created), so I need a third lineelement component_2/... /main/INT-STREAM/LATEST.
And the same applies to version CHECKED_OUT.
As I want to create the config spec by script I would either need to find out where the component_2 is located (in the INT-STREAM or the DEV-STREAM) and where the DEV-STREAM was branched off or I would have to include 6 lines (one of them should match) for each component - in comparison to the one line for the baseline. Obviously I wouldn't want to include each file (there are VERY many) but would like to be able to simply specify the component with all its subfolders, just like for the baseline.
Thanks for reading - and obviously for any answers

You can avoid all those multiple rules with:
element component_2/... .../DEV-STREAM/LATEST
element component_2/... .../INT-STREAM/LATEST -mkbranch DEV-STREAM
The order is important, and the '...' allows you to select a branch without knowing of its exact parent branch.

Related

using versionNumber plugin in Jenkins

Context:
We build our maven apps in which version number is injected by a build.properties file. Problem with this approach is that for every release, version number needs to be bumped manually.
Browsing online to fix this problem, i bumped into version number plugin which offers some cool ways to fix the issue.
For instance -Dproject.version=${BUILD_YEAR}.${BUILDS_THIS_YEAR} will solve the issue for me
Problem
I have issue setting up the values for the defined variables
Quoting from the doc:
Initialization Values
Before the build is started, the number of
builds this year / month / week / day can be specified on the command
line or via the job's plugin-configuration web-GUI. If they are
specified, then they will override whatever values are currently in
production. This allows you to migrate your version number from
another system to Jenkins if you choose to do so.
Additionally, it is possible to automatically override the number of
builds this year / month / week / day with values taken from
environment-variables. Instead of just providing a simple number in
the form-fields of the job's plugin-configuration which overrides the
value for the next build (as described above), you can instead provide
an environment-variable whose value will be extracted and used during
the next builds. If it is not set or its value is not convertible to a
positive integer (without loosing precision), the value of the
previous build will be taken instead and increased by one (as is the
standard behavior).
In the last sentence, it says
If it is not set or its value is not convertible to a positive integer (without
loosing precision), the value of the previous build will be taken instead
and increased by one (as is the standard behavior)
So, going by this i built an jar with injected values of BUILD_YEAR and BUILDS_THIS_YEAR, worked as expected (jenkin says Building my_app_2019.1-SNAPSHOT). After that, i removed the variables assuming that they would be picked but unfortunatley jenkin says Building my_app_${BUILD_YEAR}.${BUILDS_THIS_YEAR}-SNAPSHOT.
There is no relevant doc around this or may be i have missed something totally obvious
Question
How do i ensure these var are injected correctly in my maven builds? or rather how do i populate the values using the plugin?
This is not a jenkins pipeline, its a simple jar builds.
Missed setting up Create a formatted version number as below :
updated as per image above and changed command to -Dproject.version=${VERSION_NUMBER}-SNAPSHOT.... voila!!!!!

Alternative to using ant <modified> selector?

I'm trying to find an alternative to a helpful piece of functionality provided by ant - the <modified> selector.
When specifying a set of files in ant, you can use the <modified> selector to only include files whose content has changed since the last time it was run.
The selector computes a value for a file, compares that to the value stored in a cache and selects the file if these two values differ.
Is there an existing way of doing this in bash? I don't want to use a full blown build tool or similar just to return a list of modified file paths.

Poedit: Avoid Reordering of translations in .po file

I use Poedit in a project for localization. Whenever I change an entry with poedit, it reorders all elements. I think it reorders the elements according to their line number and file but since I´m working with many coders on this project, poedit must not reorder all elements to avoid unneccessary line changes in the repository. Does anyone know how to achieve that?
Poedit never, under any circumstances, reorders content of the file when you “change an entry”. Files are always saved in the order they had when loaded, and it’s been like this since the very first version.
I have two explanations:
Either you’re confusing content of the file with the view presented in Poedit (where you can select your preferred display order in the View menu), in which case just change the display to whatever you like. But this seems unlikely.
Or you’re talking about not “changing an entry” in the file, but updating the PO file from source code. If that’s the case, it’s possible that you or some of your coworkers are using some very old version of Poedit. The fix would be to update to the current version, because the scan order was fixed to be stable across platforms in v1.6.5 1.3 years ago.
If it’s neither, you need to describe the issue reproducibly.

Expressions in a build rule "Output Files"?

Can you include expressions in the "Output Files" section of a build rule in Xcode? Eg:
$(DERIVED_FILE_DIR)$(echo "/dynamic/dir")/$(INPUT_FILE_BASE).m
Specifically, when translating Java files with j2objc, the resulting files are saved in subfolders, based on the java packages (eg. $(DERIVED_FILE_DIR)/com/google/Class.[hm]). This is without using --no-package-directories, which I can't use because of duplicate file names in different packages.
The issue is in Output Files, because Xcode doesn't know how to search for the output file at the correct location. The default location is $(DERIVED_FILE_DIR)/$(INPUT_FILE_BASE).m, but I need to perform a string substitution to insert the correct path. However any expression added as $(expression) gets ignored, as it was never there.
I also tried to export a variable from the custom script and use it in Output Files, but that doesn't work either because the Output Files are transformed into SCRIPT_OUTPUT_FILE_X before the custom script is ran.
Unfortunately, Xcode's build support is pretty primitive (compared to say, make, which is third-odd years older :-). One option to try is splitting the Java source, so that the two classes with the same names are in different sub-projects. If you then use different prefixes for each sub-project, the names will be disambiguated.
A more fragile, but maybe simpler approach is to define a separate rule for the one of the two classes, so that it can have a unique prefix assigned. Then add an early build phase to translate it before any other Java classes, so the rules don't overlap.
For me, the second alternative does work (Xcode 7.3.x) - to a point.
My rule is not for Java, but rather for Google Protobuf, and I tried to maintain the same hierarchy (like your Java package hierarchy) in the generated code as in the source .proto files. Indeed files (.pb.cc and .pb.h) were created as expected, with their hierarchies, inside the Build/Intermediates/myProject.build/Debug/DerivedSources directory.
However, Xcode usually knows to continue and compile the generated output into the current target - but that breaks as it only looks for files in the actual ${DERIVED_FILE} - not within sub-directories underneath.
Could you please explain better "Output Files are transformed into SCRIPT_OUTPUT_FILE_X" ? I do not understand.

ClearCase UCM: Get latest version from Dev-stream

I'm stuck over the config spec for a dynamic view.
I try to get the latest version of a folder of a UCM stream from the Dev-stream into another (Base) dynamic view.
My idea would have been to do a
element PathToFolder/... .../DEV-STREAM-NAME/LATEST
but that won't give me anything in the view.
The config spec that is automatically generated by UCM does not help me as it specifies a specific baseline and creates a branch once you check out a file (which I of course do not want, I only need read-access to the version).
Is it possible to access the latest version from the Dev-stream, or do I have to skip the folder altogether in the config spec and just copy it using the operating system (which would be possible but takes quite long as the folder might be quite large)?
Thanks for any answers and Best Regards
You need to make sure the parent folders are selected as well:
element vob/... .../DEV-STREAM-NAME/LATEST
element vob/path/... .../DEV-STREAM-NAME/LATEST
element vob/path/to/... .../DEV-STREAM-NAME/LATEST
element vob/path/to/folder/... .../DEV-STREAM-NAME/LATEST
element * /main/LATEST
If one of the parent folder has no version in DEV-STREAM-NAME, but a version in the parent stream (like INT-STREAM-NAME), you would need to select that as well.
element vob/path/to/... .../INT-STREAM-NAME/LATEST

Resources